Hi gurus
I just need to load and Tiff file and print all its pages, if its one then one if they are multiple well then print them all
Thanks a bunch for any help,its a legacy app.
Thanks again
Printable View
Hi gurus
I just need to load and Tiff file and print all its pages, if its one then one if they are multiple well then print them all
Thanks a bunch for any help,its a legacy app.
Thanks again
ok... do you have any specific questions about the code that YOU have already written and tried?
my question would be what would be my best approach to do this
I have tried the system.drawing.imaging but I cant find once the file is loaded how to print it, so I was looking for help on a better approach on this particular matter and how to get this done in a simple way.
Thanks
If you have the image loaded the you can send it to the printer using a PrintDocumentControl....
I don't have any tiff images, so I tested it with a jpg. Not sure if it matters... I wouldn't think so.vb Code:
Dim img As Image Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click img = New Bitmap("c:\IMG_0425.jpg") Dim pd As New PrintDocument() AddHandler pd.PrintPage, New PrintPageEventHandler(AddressOf Me.pd_Print) pd.Print() End Sub Private Sub pd_Print(ByVal sender As Object, ByVal e As PrintPageEventArgs) e.Graphics.DrawImage(img, 10, 10) End Sub
kevin
If you are doing a multi-page tiff, you need to do a little bit more on top of what kebo mentioned, as you need to print multiple pages:
Code:Dim img As Image
Dim pgnum As Integer = 0
Private Sub MyButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyButton1.Click
img = Image.FromFile("C:\Temp\0000000C.TIF")
Dim p As New PrintDocument
AddHandler p.PrintPage, New PrintPageEventHandler(AddressOf pd_Print)
p.Print()
End Sub
Private Sub pd_Print(ByVal sender As Object, ByVal e As PrintPageEventArgs)
If pgnum < (img.GetFrameCount(Imaging.FrameDimension.Page) - 1) Then
e.Graphics.DrawImage(img, 10, 10)
pgnum += 1
img.SelectActiveFrame(Imaging.FrameDimension.Page, pgnum)
e.HasMorePages = True
Else
e.Graphics.DrawImage(img, 10, 10)
e.HasMorePages = False
End If
End Sub
Thanks a bunch gurus ,I will try your approach
Thanks again