The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Farabi on July 31, 2010, 02:09:28 AM

Title: Send multiple page to printer
Post by: Farabi on July 31, 2010, 02:09:28 AM
Anyone know how to send multiple page to a printer?
Title: Re: Send multiple page to printer
Post by: clive on July 31, 2010, 03:06:31 AM
Quote from: Farabi on July 31, 2010, 02:09:28 AM
Anyone know how to send multiple page to a printer?

Pretty much the same way you send one page, create a device context, paint to it, and send it out

PrintDlg
StartDoc
StartPage
EndPage ;1
EndPage ;2
EndPage ;3
..
EndPage ;n
EndDoc
DeleteDC
Title: Re: Send multiple page to printer
Post by: Farabi on July 31, 2010, 05:13:20 AM
Quote from: clive on July 31, 2010, 03:06:31 AM
Quote from: Farabi on July 31, 2010, 02:09:28 AM
Anyone know how to send multiple page to a printer?

Pretty much the same way you send one page, create a device context, paint to it, and send it out

PrintDlg
StartDoc
StartPage
EndPage ;1
EndPage ;2
EndPage ;3
..
EndPage ;n
EndDoc
DeleteDC

How to make the page selection enabled?
Title: Re: Send multiple page to printer
Post by: clive on July 31, 2010, 06:56:56 AM
Quote from: Farabi
How to make the page selection enabled?

Are you printing a single page now? What kind of content are you wanting to print text/drawing?

You'd need to enumerate the number of pages you need if you are going to offer a choice, or choices. As you build the PRINTDLG structure, set nMinPage, and nMaxPage, when you get it back from the PrintDlg() call you'll have to review the flags, and the nFromPage, nToPage entries, etc based on the options selected. Finally as you re-enumerate through your pages, you print the ones requested. How you achieve this depends a lot on your ability to render specific pages, and how you cache/store page specifics when you generated the original page count. For simple output of logs or diagrams that take only a few pages, you might not want to provide too many choices.

http://msdn.microsoft.com/en-us/library/ms646940%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms646964%28v=VS.85%29.aspx

http://www.stromcode.com/2008/03/02/cwin32-printing/
Title: Re: Send multiple page to printer
Post by: Farabi on July 31, 2010, 01:20:24 PM
Thanks, I'll try that.
Title: Re: Send multiple page to printer
Post by: jj2007 on July 31, 2010, 04:00:24 PM
See also http://www.masm32.com/board/index.php?topic=12767.msg98569#msg98569
It's RichEdit but some parts are valid for other purposes, too.