LEADTOOLS Support
General
General Questions
printing multiple images in the same job
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, April 24, 2006 10:47:57 PM(UTC)
Groups: Registered
Posts: 3
Is it possible to print an array of raster images in one single print job?
im using the RasterImagePrinter calss for printing.
Thanks
#2
Posted
:
Thursday, April 27, 2006 5:01:58 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
You might be able to do this if you change the IRasterImage that you pass to the RasterImagePrinter.Print Method in the PrintDocument_PrintPage event.
Also, to print the Multi-Page images, you will need to set the PrintPageEventArgs.HasMorePages Property to true while you have pages to print in the IRasterImage.
The code will be something as follows:
+------------------------------------+
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim codecs As RasterCodecs = New RasterCodecs
' intitialize a new PrintDocument object
Dim pd As New PrintDocument
RasterImageViewer1.Image = codecs.Load("c:\fax1.tif")
AddHandler pd.PrintPage, AddressOf PrintDocument_PrintPage
pd.Print()
End Sub
Private Sub PrintDocument_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
' initialize a new RasterImagePrinter object
Dim codecs As RasterCodecs = New RasterCodecs
' intitialize a new PrintDocument object
Dim printer As New RasterImagePrinter
Dim x As Integer
x = 0
' We want normal size (not zoomed) but centered
printer.SizeMode = RasterViewerSizeMode.Normal
printer.CenterMode = RasterViewerCenterMode.Both
' print the whole image
printer.ImageRectangle = Rectangle.Empty
' use maximum page
printer.PageRectangle = RectangleF.Empty
' use the image DPI, Win32 GDI printing and scale to gray
Dim props As RasterPaintProperties = RasterPaintProperties.Default
props.UseDpi = True
props.PaintEngine = RasterPaintEngine.Gdi
props.PaintDisplayMode = props.PaintDisplayMode Or RasterPaintDisplayModeFlags.ScaleToGray
printer.PaintProperties = props
' print the image
e.HasMorePages = True
If RasterImageViewer1.Image.Page >= RasterImageViewer1.Image.PageCount - 1 Then
RasterImageViewer1.Image = codecs.Load("c:\digital22.jpg")
ElseIf RasterImageViewer1.Image.PageCount > 1 Then
RasterImageViewer1.Image.Page += 1
Else
RasterImageViewer1.Image.Page = 1
End If
printer.Print(RasterImageViewer1.Image, RasterImageViewer1.Image.Page, e)
End Sub
+------------------------------------+
Please try the above code and let me know if this helps.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Thursday, April 27, 2006 11:52:54 PM(UTC)
Groups: Registered
Posts: 3
Great!
Thanks Maen. I managed to print using the following modified code - my images are in an arraylist and are not multi-paged:
Private Sub pdoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pdoc.PrintPage
Try
img = codec.Load(images(printIndex).path)
e.HasMorePages = (Me.printIndex <> Me.printToIndex)
Me.printer.Print(img, 1, e)
Me.printIndex += 1
Catch ex As Exception
End Try
End Sub
LEADTOOLS Support
General
General Questions
printing multiple images in the same job
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.