469,909 Members | 1,767 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

Sometimes I want to skip a page - How to do that

In the handler QueryPageSettings I let the user select a "Skip This Page"
option.

But I don't know how to handle it if he does.

I can set a flag and in PrintPage skip printing the page but the page count
in Printer and Faxes still increments.

I can cancel the entire print job but can not find anything that will enable
me to skip one page.
Anyone know how?
Nov 20 '05 #1
4 1446
* " Just Me" <ne********@a-znet.com> scripsit:
In the handler QueryPageSettings I let the user select a "Skip This Page"
option.

But I don't know how to handle it if he does.

I can set a flag and in PrintPage skip printing the page but the page count
in Printer and Faxes still increments.

I can cancel the entire print job but can not find anything that will enable
me to skip one page.


Just don't print the page. How to prevent printing strongly depends on
how you handle printing of the pages.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j************@uni-berlin.de...
* " Just Me" <ne********@a-znet.com> scripsit:
In the handler QueryPageSettings I let the user select a "Skip This Page" option.

But I don't know how to handle it if he does.

I can set a flag and in PrintPage skip printing the page but the page count in Printer and Faxes still increments.

I can cancel the entire print job but can not find anything that will enable me to skip one page.
Just don't print the page. How to prevent printing strongly depends on
how you handle printing of the pages.


Not sure what you mean. I now in PrintPage only bump my page number variable
and exit.

But the system must consider the fact that PrintPage is entered its a page
(I guess a blank one, I never checked).

Unless someone knows how to tell the system not to add a page to the print
document I'll have to try do it all in QueryPageSettings (but that's not
without a problem). I wish I could in QueryPageSettings or in PrintPage tell
the system not to add this page to the output.

To illustrate the problem think of a 10 page document. For each page, in
QueryPageSettings I ask the user if he want to print the page. Say he does
for the first 9 pages but on page 10 he says not to print page 10. I don't
know what to do. As soon as I exit, PrintPage will get called and if I do
nothing in PrintPage a blank page gets added to the document.
Any ideas how avoid that?
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
* " Just Me" <ne********@a-znet.com> scripsit:
Just don't print the page. How to prevent printing strongly depends on
how you handle printing of the pages.


Not sure what you mean. I now in PrintPage only bump my page number variable
and exit.

But the system must consider the fact that PrintPage is entered its a page
(I guess a blank one, I never checked).

Unless someone knows how to tell the system not to add a page to the print
document I'll have to try do it all in QueryPageSettings (but that's not
without a problem). I wish I could in QueryPageSettings or in PrintPage tell
the system not to add this page to the output.

To illustrate the problem think of a 10 page document. For each page, in
QueryPageSettings I ask the user if he want to print the page. Say he does
for the first 9 pages but on page 10 he says not to print page 10. I don't
know what to do. As soon as I exit, PrintPage will get called and if I do
nothing in PrintPage a blank page gets added to the document.


In 'PrintPage', you can do something like that:

\\\
Private m_NextPageToPrint As Integer

Private Sub MyPrintDocument_PrintPage(...) Handles ...
Select Case m_NextPageToPrint
Case 1
e.Graphics.DrawString(...)
Case 2
e.Graphics.DrawString(...)
Case 3
...
Case 4
...
End Select
e.HasMorePages = ShouldNextPageBePrinted(...)
End Sub

Private Function ShouldNextPageBePrinted(...) As Boolean
If ... Then
...
m_NextPageToPrint = 4
...
Return True
Else
Return False
End If
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
That looks good. I'd also have to do something in case the first (few)
page(s) are not printed.

Thanks a lot

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j*************@uni-berlin.de...
* " Just Me" <ne********@a-znet.com> scripsit:
Just don't print the page. How to prevent printing strongly depends on
how you handle printing of the pages.


Not sure what you mean. I now in PrintPage only bump my page number variable and exit.

But the system must consider the fact that PrintPage is entered its a page (I guess a blank one, I never checked).

Unless someone knows how to tell the system not to add a page to the print document I'll have to try do it all in QueryPageSettings (but that's not
without a problem). I wish I could in QueryPageSettings or in PrintPage tell the system not to add this page to the output.

To illustrate the problem think of a 10 page document. For each page, in
QueryPageSettings I ask the user if he want to print the page. Say he does for the first 9 pages but on page 10 he says not to print page 10. I don't know what to do. As soon as I exit, PrintPage will get called and if I do nothing in PrintPage a blank page gets added to the document.


In 'PrintPage', you can do something like that:

\\\
Private m_NextPageToPrint As Integer

Private Sub MyPrintDocument_PrintPage(...) Handles ...
Select Case m_NextPageToPrint
Case 1
e.Graphics.DrawString(...)
Case 2
e.Graphics.DrawString(...)
Case 3
...
Case 4
...
End Select
e.HasMorePages = ShouldNextPageBePrinted(...)
End Sub

Private Function ShouldNextPageBePrinted(...) As Boolean
If ... Then
...
m_NextPageToPrint = 4
...
Return True
Else
Return False
End If
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by J.Bijleveld | last post: by
13 posts views Thread by Monty | last post: by
4 posts views Thread by Adam | last post: by
59 posts views Thread by AK | last post: by
24 posts views Thread by Robin Cole | last post: by
2 posts views Thread by magix | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.