Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, April 24, 2006 10:47:57 PM(UTC)

saidb  
saidb

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  

 

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, April 27, 2006 5:01:58 AM(UTC)
Maen Hasan

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)

saidb  
saidb

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

 

 

 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.060 seconds.