473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Printing a multi-page document

Hi all,

I have an application that needs to print numerous
documents of different styles (either to the printer
or print preview dialog).

I have selected which document type to print by
using a select statement in the the

PrintDocument.PrintPage

event handler. This appears to work very well until
I try and print a document with multiple pages.

When I set

e.HasMorePages = TRUE,

the event fires the PrintPage event but the subroutine
that handles the actual rendering is not called a second time.

If I move the rendering code into the PrintPage event
handler (so only one format of page can be printed) then
everything seems to work OK.

Here is all of the code that is containted in the

PrintDocument.PrintPage event handler

nThisLabel = 0
' LabelType is an enum.
Select Case LabelType
Case LabelTypes.AlphaSnap
PrintOutlets(e)
Case LabelTypes.AlphaSnap12Port
PrintAlphaSnap12Port(e)
Case LabelTypes.AlphaSnap16Port
PrintAlphaSnap16Port(e)
Case LabelTypes.AlphaSnap24Port
PrintAlphaSnap24Port(e)
End Select
Is there a better way to decide which document to render
that will not cause this unwanted functionality in my
program and multi-page documents will be printed correctly?

Many thanks,

Jason.
Nov 20 '05 #1
3 1463
* Jason James <ja***@jamesjl.demon.co.uk> scripsit:
I have an application that needs to print numerous
documents of different styles (either to the printer
or print preview dialog).

I have selected which document type to print by
using a select statement in the the

PrintDocument.PrintPage

event handler. This appears to work very well until
I try and print a document with multiple pages.

When I set

e.HasMorePages = TRUE,

the event fires the PrintPage event but the subroutine
that handles the actual rendering is not called a second time.

If I move the rendering code into the PrintPage event
handler (so only one format of page can be printed) then
everything seems to work OK.

Here is all of the code that is containted in the

PrintDocument.PrintPage event handler

nThisLabel = 0
' LabelType is an enum.
Select Case LabelType
Case LabelTypes.AlphaSnap
PrintOutlets(e)
Case LabelTypes.AlphaSnap12Port
PrintAlphaSnap12Port(e)
Case LabelTypes.AlphaSnap16Port
PrintAlphaSnap16Port(e)
Case LabelTypes.AlphaSnap24Port
PrintAlphaSnap24Port(e)
End Select
Is there a better way to decide which document to render
that will not cause this unwanted functionality in my
program and multi-page documents will be printed correctly?


Are you sure 'LabelType' is set corretly? How/where do you set the
label type?

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

LabelType is a public variable of type LabelTypes, which is an
enumerated type. It is set through the users' interaction with
the GUI. When I step through the code the select statement
appears to work fine, it just doe not call the appropriate
subroutine.

Hope this helps,

Jason

On 22 Jan 2004 22:58:39 +0100, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* Jason James <ja***@jamesjl.demon.co.uk> scripsit:
I have an application that needs to print numerous
documents of different styles (either to the printer
or print preview dialog).

I have selected which document type to print by
using a select statement in the the

PrintDocument.PrintPage

event handler. This appears to work very well until
I try and print a document with multiple pages.

When I set

e.HasMorePages = TRUE,

the event fires the PrintPage event but the subroutine
that handles the actual rendering is not called a second time.

If I move the rendering code into the PrintPage event
handler (so only one format of page can be printed) then
everything seems to work OK.

Here is all of the code that is containted in the

PrintDocument.PrintPage event handler

nThisLabel = 0
' LabelType is an enum.
Select Case LabelType
Case LabelTypes.AlphaSnap
PrintOutlets(e)
Case LabelTypes.AlphaSnap12Port
PrintAlphaSnap12Port(e)
Case LabelTypes.AlphaSnap16Port
PrintAlphaSnap16Port(e)
Case LabelTypes.AlphaSnap24Port
PrintAlphaSnap24Port(e)
End Select
Is there a better way to decide which document to render
that will not cause this unwanted functionality in my
program and multi-page documents will be printed correctly?


Are you sure 'LabelType' is set corretly? How/where do you set the
label type?


Nov 20 '05 #3
JJ
The problem is sorted. The variable nThisLabel was being
reset in the PrintPage event handler and it shouldn't have
been. This counter keeps track of the number of elements
printed and should only have been reset once all of the pages
of the document were printed.

Thanks for your help,

Jason.

On Thu, 22 Jan 2004 22:48:00 +0000, JJ <ja***@nospam.divemaster.org>
wrote:
Hi Herfried ,

LabelType is a public variable of type LabelTypes, which is an
enumerated type. It is set through the users' interaction with
the GUI. When I step through the code the select statement
appears to work fine, it just doe not call the appropriate
subroutine.

Hope this helps,

Jason

On 22 Jan 2004 22:58:39 +0100, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* Jason James <ja***@jamesjl.demon.co.uk> scripsit:
I have an application that needs to print numerous
documents of different styles (either to the printer
or print preview dialog).

I have selected which document type to print by
using a select statement in the the

PrintDocument.PrintPage

event handler. This appears to work very well until
I try and print a document with multiple pages.

When I set

e.HasMorePages = TRUE,

the event fires the PrintPage event but the subroutine
that handles the actual rendering is not called a second time.

If I move the rendering code into the PrintPage event
handler (so only one format of page can be printed) then
everything seems to work OK.

Here is all of the code that is containted in the

PrintDocument.PrintPage event handler

nThisLabel = 0
' LabelType is an enum.
Select Case LabelType
Case LabelTypes.AlphaSnap
PrintOutlets(e)
Case LabelTypes.AlphaSnap12Port
PrintAlphaSnap12Port(e)
Case LabelTypes.AlphaSnap16Port
PrintAlphaSnap16Port(e)
Case LabelTypes.AlphaSnap24Port
PrintAlphaSnap24Port(e)
End Select
Is there a better way to decide which document to render
that will not cause this unwanted functionality in my
program and multi-page documents will be printed correctly?


Are you sure 'LabelType' is set corretly? How/where do you set the
label type?


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Roger Binns | last post by:
My program has a random smattering of print statements scattered throughout that are mainly a debugging aid. They are typically things like this: print "entering key mode" The code is...
11
by: Marian Aldenhövel | last post by:
Hi, I am very new to Python and have run into the following problem. If I do something like dir = os.listdir(somepath) for d in dir: print d The program fails for filenames that contain...
9
by: Gary | last post by:
I need to read a table from MySQL into a Perl script (already working) and then be able to print fields from the table selectively using a print button which is part of the HTML/CGI. Can someone...
16
by: gb | last post by:
Hi All, Ive created a popup page using 'var openWindow = window.open("new","pop")' And added content using openWindow.document.write(" "); statements. But now I would like to be able to print...
0
by: Justin | last post by:
I am trying to print multiple copies of an invoice. (rather than the tractor feed multi part forms that keep causing problems) I need to print two invoices at one location so that there are two...
5
by: Paul | last post by:
I have a simple database - 3 fields (Parent,Component,Qty) and I link this table to itself using Master File Parent and Link File Component. This creates a multi-indented table which I would...
1
by: John | last post by:
Hi I am looking into Oki ML 590 and ML 591 printers to see if any of these will work with multi-part (multiple copies) continuous stationery for printing invoices from access. Has anyone had any...
4
by: DS | last post by:
Anyway to build a form to preview a report and also either print or cancel from that form? I need to do this without the use of menu bars. Thanks DS
2
by: woodensails | last post by:
I have a table with multi objects among which are surname and spouse. This is part of a membership list, I would like to print membership cards for member and spouse. No problem doing separate...
1
by: Anish G | last post by:
Hi, I am trying to print multiple label images in case of ups multi label implementaion. The response i get in XML schema and from that i parsedout the label images and stored in an array and from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.