Home All Groups Group Topic Archive Search About

PrinterSettings.PrintRange, print only selected pages.

Author
13 Jun 2006 10:37 AM
Coen
Hi, can anyone help me with the printrange functionality?

The problem is: whatever I try allways all the pages are print (directly to
the printer or via a preview control).

The VS-Build in help suggests checking the Printdocument.PrintPage event
during printing. And indeed I can check if the current page in the Printpage
event should be printed or not. But HOW to cancel the current page, if the
page should not be printed, rather than the printjob? I don't want blanc
pages.

Regards Coen.

Author
13 Jun 2006 1:07 PM
Ron Allen
Coen,
    Try putting some logic in the PrintPage event that will advance to the
next page if the page # is not in range before starting to draw the page.
And, of course, make sure to exit when no more pages are available.  This is
how I do partial page range printing (although my exclusions are based on
page type normally).  I just have a PrintPage event that manages the page
selection and doesn't do any drawing and then farms out the drawing to a
seperate method in the class.

Ron Allen
Show quoteHide quote
"Coen" <cbus***@newsgroups.microsoft.com> wrote in message
news:3DDAD735-D9F4-47F3-9A7D-BA27844C61AD@microsoft.com...
> Hi, can anyone help me with the printrange functionality?
>
> The problem is: whatever I try allways all the pages are print (directly
> to
> the printer or via a preview control).
>
> The VS-Build in help suggests checking the Printdocument.PrintPage event
> during printing. And indeed I can check if the current page in the
> Printpage
> event should be printed or not. But HOW to cancel the current page, if the
> page should not be printed, rather than the printjob? I don't want blanc
> pages.
>
> Regards Coen.
Author
13 Jun 2006 1:45 PM
Coen
Hi Ron, thanks for response.
The thing I don't understand is:

'  Try putting some logic in the PrintPage event that will advance to the
   next page if the page # is not in range before starting to draw the page.'

Not drawing the current page still causes a blank page. How to take care
that some pages (the not selected pages) are not created?

Coen


Show quoteHide quote
"Ron Allen" wrote:

> Coen,
>     Try putting some logic in the PrintPage event that will advance to the
> next page if the page # is not in range before starting to draw the page.
> And, of course, make sure to exit when no more pages are available.  This is
> how I do partial page range printing (although my exclusions are based on
> page type normally).  I just have a PrintPage event that manages the page
> selection and doesn't do any drawing and then farms out the drawing to a
> seperate method in the class.
>
> Ron Allen
> "Coen" <cbus***@newsgroups.microsoft.com> wrote in message
> news:3DDAD735-D9F4-47F3-9A7D-BA27844C61AD@microsoft.com...
> > Hi, can anyone help me with the printrange functionality?
> >
> > The problem is: whatever I try allways all the pages are print (directly
> > to
> > the printer or via a preview control).
> >
> > The VS-Build in help suggests checking the Printdocument.PrintPage event
> > during printing. And indeed I can check if the current page in the
> > Printpage
> > event should be printed or not. But HOW to cancel the current page, if the
> > page should not be printed, rather than the printjob? I don't want blanc
> > pages.
> >
> > Regards Coen.
>
>
>