Determing printed page info via two pass printing

My app prints multiple pages of text and graphics.  I need to know
which page various information will appear (e.g., to create a table of
contents, for page references between pages, etc).  It is difficult to
calculate which page the information will appear, because the page
breaks vary based on the printer's dc (e.g., font sizes, paper sizes,
etc).  I am using StartDoc(), OnBeginPrinting(), my own print dialog,
etc. and not supporting MFC's print preview.

It seems the best way (and maybe only way) to determine which page
various information will appear is to print in two passes.  The first
pass would simply be to calculate which page the information will be
printed on, and the second time would do actual printing.  I can
prevent the first pass from being printed by calling dc.AbortDoc() at
the end of the pass.  This ALMOST does what I need, except called
AbortDoc "clears" the dc (i.e., causes it to forget page sizes, etc).
To restore the dc, I have to basically redisplay the print dialog and
create another dc (which works, but it obviously is not practical to
display the print dialog twice!).

Do you have any ideas how I can do this "two pass" printing, but not
actually have the first pass go to the printer?  I sort of need a way
to remove everything that was sent to the printer in the first pass,
without actually clearing the dc.  Or maybe I need to "print" to a
memory dc that has the same properties (i.e., height, width, margins,
etc.) as the printer dc on the first pass...

Thanks for any advice!


junk (27)
8/11/2005 6:00:29 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 28


Similar Artilces:

Page can not be displayed 05-31-05
Hi! I successfully instaled CRM server. Pages are in C:\inetpub\CRM I'm able to start the Deployment Manager with problem. My problem is : I can access CRM only using the server IP in Internet Explorer. For example : This way, I can enter the site. But I'd want to be able to access it with something more convenient, like http://crm. This is why I made CRM be installed in C:\inetpub\CRM. I'm probably missing something here. What can I do? Thanks in advance for any advice! Mathieu. It sounds as if you need to create a DNS record with the CRM n...

One cell is printing per page
When trying to print a worksheet, one cell is printing per page. I have tried changing the width to 1 page Wide and "Automatic" pages tall, as well as resetting the print area, with no fix. When I change the scale %, it will move the page breaks, but then my sheet will not fit on one page. When I try dragging the page breaks in Page break preview, I get a message that "Microsoft Excel cannot move the page break because doing so would reduce the scale to below the minimum 10 percent". This has happened to me several times sporadically, and I (nor anyone I...

Problem printing a bitmap
I'm attempting to print a page of labels from a dialog printing a logo on each label along with some text. The bitmap for the logo is much larger than I need so I use StretchBlt to shrink it to size for printing. This worked fine thru much of my testing but now it no longer prints the logo for some reason and I can't seem to figure out why. Prior to beginning the label print I load the bitmap with the following code: bResult = m_cBitmapLogo.LoadBitmap (IDB_LOGO_1); m_cBitmapLogo.GetBitmap (&m_bmLogo); Then a function is called from within a loop to print each label. The ...

change size of document for printing
I have created a 24"X36" document to be printed on our plotter. I would like to know how to reduce and print this document to 8 1/2" X 11" as easily as possible. Thanks... Keith wrote: > I have created a 24"X36" document to be printed on our plotter. I would like to know how to reduce and print this document to 8 1/2" X 11" as easily as possible. Thanks... Publisher does not offer a built in solution for this. You would need to create a duplicate of your publication and group all of your objects and resize accordingly. Otherwise, some printer ...

Passing to and back from Dialog
When a user double-clicks a text box, a dialog box is to open and the info from that text box sent over so that the dialog box would have some initial data to display. The user than can change that information from within the dialog box. When the user clicks on the OK button, that information needs to be returned to the same routine (the textbox doubleclick) that called the dialog box. To send data over, I thought to use the .Tag property of the dialog box. Dialog.Tag = dMyDateInfo Dialog.Show 1, Me The dialog's Activate method deals with the dMyDateInfo sent over. ...

Print Command
I have lost the CTRL P print command; does anyone know how I can get that back? -- /BJ In the Customize Keyboard dialog box, locate the FilePrint command, which you will find in the All Commands category. See which shortcut is currently assigned (if any), and reassign Ctrl+P. To open the dialog box, do the following: - Click Tools | Customize, and click the Keyboard button (Word 97-2003). - Click Office button | Word Options; in the Customize category, click Customize (Word 2007). -- Stefan Blom Microsoft Word MVP "BJ" <

Layout and print problem
I have created a booklet. The first page appears as a single page. The next pages appear as pairs left and right pf a layout then the last page. In print preview it look ok but prints reversed i.e. left prints on righ and vis versa. I can't get it to print as it appears in preview nor can I get it to print so I can print via desktop printer i.e by inserting the page then printing one side then turning it over for the reverse. I clearly don't understand soething to do with page set up or pagination set up When you look at the first two page spread, is page two on the left? I know...

how do i adjust the margins in publisher for printing?
I'm working in publisher making a newsletter. After I printed my draft I realized that there are 1" margins on my hard copy; but on my screen the text and images are touching the edge of the page. I tried to arrange the margin guides and also changed my settings in print preview ... to no avail!! Any help would be great, thanks. Krista <> was very recently heard to utter: > I'm working in publisher making a newsletter. After I printed my > draft I realized that there are 1" margins on my hard copy; but on my > screen the t...

Hyperlink created in Access does not function when printed to pdf
I have a database in Access 2007 in which I created a field that hyperlinks to Google Maps for an office location. In Access database, the hyperlink works perfectly. When I print the report to Adobe PDF, the link cannot be accessed. I have a similar field that opens our e-mail program and generates an e-mail. THAT works, but the hyperlink does not. I hope this makes sense. Thanks in advance. You could use a different pdf printer driver. For example win2pdf will take any text that looks like a hyperlink and change it to an actual hyperlink in the pdf file. I assume t...

Printing Externally
is there a way to print a word document externally. Say I am in an exce file, and every time I print my excel file, it has to print a certai word file. Is there a way of doing this?? -- tess45 ----------------------------------------------------------------------- tess457's Profile: View this thread: Excel has an event that fires when you print the workbook. Rightclick on the excel icon to the left of File (on the worksheet menubar). Select view code and paste th...

Printing calendar via OWA gives script error
Hello, I have a problem when i'm printing the calendar via OWA from a client with Windows NT 4 SP6 and IE5.5SP1. When pushing the print button in the calendar view, an error is displayed with the following text: An error has occurred in the script on this page. Line 8 Char 75 Error 'CONST_XMLDOM' is undefined Code 0 URL http://<url>/exchweb/6.5.7226.0/controls/ The server is an MS Windows 2003 with Exchange 2003. Does anyone know this problem ? Thanks, Paul ...

How do print a chart so the chart area 'fill' shows through it?
I select 'none' for background in the Plot area, and I've selected a gradient fill effect for the Chart Area. The screen displays correctly, shows the chart fill with the Plot Area as 'transparent', but when I send this to the printer the background of the Plot Area is solid black. Somehow I have randomly been able to achieve the desired result, but can't seem to repeat the magical order of steps I did to make it work for other charts in the some workbook. So what's the trick? -- holly Holly - The usual culprit when printing comes out wrong is the printer d...

Two table in one query
Hi All, I have 2 tables and unit them in a query but no join them. Why I can't update the records inside the query/form? Is that impossible to update the records in this condition?. Thank's all New_Access wrote: > Hi All, > I have 2 tables and unit them in a query but no join them. > Why I can't update the records inside the query/form? > Is that impossible to update the records in this condition?. > > Thank's all No. Many multi-table queries produce read only results. This varies depending on the number of tables, number and type of joins, and which f...

Cannot Print Spreadsheet
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I have a MacBook Pro running OSX 10.6 Snow Leopard. I have Microsoft Office For Mac 2008 installed Version 12.2.4, which is the latest update. I have also updated my HP printer with the latest driver for Mac Snow Leopard . My printer works just fine. HP Tech Support advises that the problem is not with my printer. I can print documents from Word just fine. But I CANNOT print a spreadsheet or workbook from Excel! <br><br>I have been through several of the posts on the Excel Forum, and have checked to ...

how do i stop report being printed after each doc is printed
i GET A PRINTED REPORT AFTER EACH DOCUMENT I PRINT.hOW DO I STOP THIS. Either check that 'Print document properties' isn't selected (Office button => Word options => Display => Printing Options) or check your printer settings. Yves "JOEMC" <> wrote in message >i GET A PRINTED REPORT AFTER EACH DOCUMENT I PRINT.hOW DO I STOP THIS. ...

Total in every Page in Print-out in Excel
Is there a possibility that automatic page total be included in th foote -- Message posted from Hi This is a builtin feature in Excel since...some time! See View, Header and Footer You should come up with &[Pages] in your footer HTH Cordially Pascal "elmergev >" <<> a �crit dans le message de > Is there a possibility that automatic page total be included in the > footer > > > --- > Message posted from > ...

Non-Breaking Space + Print Issue
I have two questions for the group. 1) I'm having the same problem as others with getting the Y axis labels to print completely. It appears that the last character of the axis label is cut in half. I've seen someone post the code for a non-breaking space, but I can't find it. 2) I have some bubble charts that I'm trying to print. When I print them directly from excel, they print as squares with inscribed circles. The same happens when I print from Word and the chart is copies as a picture file from Excel to Word. Once the Word document is PDF'd, the bubble cha...

Publisher '03 layout won't match page setup for 11 x 17
As the other posts suggest, I 1st set my printer(HP9650) to 11 x17. Then same in 'page setup' in Publisher '03. Page layout still only shows an 8.5 x 11page. I can't find anything that will change this default layout! Do the rulers at the side and top indicate it is 8.5 x 11? Or is it an assumption no change took place after setting the printer size. Some things to try if it indeed did not change with your HP9650 printer. See if there is a update to your printer driver. If that doesn't solve it, change the printer in Publisher to a pdf printer and set it to 11 x...

Cannot print all statements
Hi When I try and print all my statements RMS is only printing half. I have two different account types setup and it's only printing off one set. There is no difference in the account type setup and as most of the other messages are that RMS prints all or nothing I suspect that this is not something it's supposed to do. Anyone any advice on why it's doing it. Am on version 1.3 for the record. -- Jenny ...

printing multi-worksheet workbooks
Hello, i am using Windows XP Office 2000, and direct printing to a Xerox 425ST. I first tried printing a multi-worksheet workbook 2 sided and stapled, and it did not work, single siding some worksheets and stapling only the first worksheet. Xerox told me this was a known problem with Excel. Yay. Can this be fixed? I am trying to just double side, not staple, as Xerox told me it was only an issue if you staple AND double side...still only single siding it for me. Help??? Hi, I read a support article on this and it told me to be sure each worksheet had the same print setting, i...

Determing Column Name
I am trying to determine the column name based on an expression. My table has column names like GROSWAGS_1, GROSWAGS_2, etc. The number represents a month. Here's what I've got so far. declare @GrossWagesColumn as Char(30) declare @MonthNumber as Int Set @MonthNumber = 4 Set @GrossWagesColumn = '['+'GROSWAGS_'+LTrim(RTrim(Cast(@MonthNumber as CHAR(2))))+']' Select employid, @GrossWagesColumn as GrossWages from Table1 Unfortunately, I'm getting the table name in my results instead of the data for the column. EMPLOYID GrossW...

Print issue with print dialogue
I have modified a macro which opens a form to print. It initially had the action PrintOut and now has the action RunCommand with the command Primt. As far as I see, the only difference should be that the print dialogue box is opened rather than just printing directly. When I print to PDF using PDFCreator the resulting file is fine, but when I print to a printer, all the text is intact but the graphics and some of the borders don't print. Initially I though the colour cartidge had packed up on my printer as the ink is low, but the PDF prints fine. The form consists of data directly ...

contar celdas no vacias pero que no tengan determ caracter
Hola, Quiero saber como hago en excel para que me CUENTE las celdas no vacias sin que tome en cuenta a los que tienen determinado caracter (por ejemplo el signo +), tengo una columna llena de nombres y quiero saber la cantidad que suman !! desde ya muchas gracias. ...

Exch2k3 print listing of Public Folders
Is it possible to print a listing of Exchange 2003 public folders to a printer or the a text file, using ESM 2003 or via AD or via a windows tool or another utility? I have seen how to map a drive share in Exchange 2000 using IFS, as shown here-- ...yet I do not know if that can be readily done, since all I have is the database files within the MDBDATA folder. Thanks! ~Terry using ldp.exe, connect and bind to one of your GCs. Then click Browse, and change the filter to "(objectclass=publicFolder)" - without the quotes. Se...

how do you print a publisher file as a poster and smaller handout.
I am using Publisher 2003. I have a designed a document that is 11 x17. I need the same document as a smaller 8.5 x 11 or 8.5 x 14 document. Do I have to create another document? Or is there a way I can use the 11 x17 document. When I go to FILE - Page Set up - Paper layout. I can change the size of the documentment the only thing that changes is the paper size the design (text boxes and photos) remain the same size. They do not have the same proportions. The ratios are: 11 x 17 = 1:1.545 8� x 11 = 1:1.294 8�x 14 = 1:1.647 The best you can do is convert it to a .pdf file and then ...