1
Reply

Print large Image (JPG) file to the printer

hai pham

hai pham

Dec 11 2008 12:14 AM
12.2k

I am trying to write a program to print an image (jpg file) dirrectly to the default printer.  Here is the code.

Imports System.Drawing
Imports System.Drawing.Printing

Module Module1
    Sub Main()
        Dim printer As PrintDocument = New PrintDocument
        AddHandler printer.PrintPage, AddressOf PrintImage
        printer.Print()
    End Sub

    Private Sub PrintImage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
        Dim img As Image = Image.FromFile("C:\...\MyImage.jpg")
        e.Graphics.DrawImage(img, 0, 0)
    End Sub

End Module

 

However, when I have a big image, resolution is very high (4000 x 6000 pixels).  I would like to resize the image first before I print.   Is there a way to resize the image?  Could some one help me?  Thanks


Answers (1)