Batch Bitmap Printing

TwentySixHundred

New member
Joined
Dec 20, 2004
Messages
3
Programming Experience
3-5
Curently I use a print document to print custom label BMPs. I need to
print a few hundred of these. The way Im doing it now is fine as far
as the printing goes, but it prints each BMP individually causing a
message box to appear for each print. 25 message boxes plastering the
screen is kind of ugly. How do I print them in a batch so that only one
message box is displayed? ("Now printing 1 of 357" etc)
 
Set the PrintDocument.PrinterSettings.Copies property to the number of labels you want to print.

You could also use a PrintDialog component to allow for changing of the number of copies.

If you are using VS2002, there is a known bug concerning the Copies property.
 
Wont that just print duplicates of the bmp? Maybe I need to be more clear. Each bitmap is different in that it contains different information. They are all packingslips but they are different.

thanks for your reply
 
I have been trying to accomplish this through the print document's PrintPage subroutine using e.HasMorePages strange results. Here is the code I am using now:

VB.NET:
[size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] PrintDocument1_PrintPage([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, _
[/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Drawing.Printing.PrintPageEventArgs) [/size][size=2][color=#0000ff]Handles [/color][/size][size=2]PrintDocument1.PrintPage
 
_currentbmp = _AllPrintJobs(0)
_currentbmp.SetResolution(203.0, 203.0)
 
[/size][size=2][color=#0000ff]Try[/color][/size][size=2]
 
[/size][size=2][color=#008000]' print out the current report bitmap
 
[/color][/size][size=2]e.Graphics.DrawImage(_currentbmp, 0, 0)
 
[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] SystemException
 
MessageBox.Show(ex.Message, "PrintPage Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Try
 
[/color][/size][size=2][color=#0000ff]If[/color][/size][size=2] _AllPrintJobs.Count > 0 Then[/size]
[size=2][color=#0000ff] 
   [/color][/size][size=2]e.HasMorePages = [/size][size=2][color=#0000ff]True
[/color][/size][size=2]  _AllPrintJobs.RemoveAt(0)
 
[/size][size=2][color=#0000ff]Else
[/color][/size][size=2]  e.HasMorePages = [/size][size=2][color=#0000ff]False
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
 
 
 
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub
 
[/color][/size]

What happens is the BMP image is somehow superimposed over another. For instance, If there are 3 items in the array, the first one comes out double printed, the next one comes out ok. Then a messagebox comes up stating that it is printing 1 of 2 pages (so one page short) then I get an index out of range error. Which doesnt make sense to me.

If I am printing 4 items, 2 pages come out with doubled images and one comes out blank and it tells me it is printing 3 pages instead of 4.

Suggestions?
 
Last edited:
Try this:

_currentbmp = new bitmap( _AllPrintJobs(0))

If _AllPrintJobs.Count-1 > 0 Then

TPM
 
Back
Top