Solved

MFC Print Engine

Posted on 1998-11-04
2
230 Views
Last Modified: 2013-11-20
I want to print and printpreview using MFC SDI engine.  The input file is kind of an excel (spreadsheet) report....with columns and rows....I want my print engine to check for the horizontal overflow of page and to split page at the proper location so that the rest of the document is placed on the next page.  Also, at the same time the document (which is spreadsheet report type) contains embeded bitmaps....i want my engine to take care of boundaries (margins)...the bitmap should not be split on two pages....it should be placed on one page.....
In nutshell my print engine should handle:
1. Horizontal overflow of pages.
2. Vertical overflow of pages.
3. Take care the embeded bitmaps.

thanks in advance for reply..it will be quite helpful if someone can give a generic outline of the code....
0
Comment
Question by:braina
2 Comments
 

Author Comment

by:braina
ID: 1324239
Edited text of question
0
 
LVL 1

Accepted Solution

by:
sudhirbrat earned 10 total points
ID: 1324240
you should take care while printing, you have find the number of pages and check for horizontal over flows.

You can calculate the size of your table and the bitmap position in CView::OnBeginPrinting().
This function is called just after the print dialog. So here you know the selected page size to be printed and the Printer Device context.

CMyView::OnBeginPrinting(CDC *pDC, CPrintinfo* pInfo)
{
    //Find the number of pages and assign it to the CPrintInfo structure.
     pInfo->m_nPages = FindNumberOfPages(pDC);
}

Find each row size and column size.
You know the printable rectangle area from pInfo->m_rectDraw.
From the above two u get no. of pages.
And also check the position of the bitmap, and check whether it is coming on a single page.

So, after finding the number of pages, The OnPrint function is called for each page.
You can get the current page number in CPrintInfo member m_nCurPage, and draw according to the page number.

Let me know if this helps you.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now