Results 1 to 6 of 6

Thread: print tiff file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    print tiff file

    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

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: print tiff file

    ok... do you have any specific questions about the code that YOU have already written and tried?
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: print tiff file

    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

  4. #4
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: print tiff file

    If you have the image loaded the you can send it to the printer using a PrintDocumentControl....

    vb Code:
    1. Dim img As Image
    2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3.  
    4.  
    5.         img = New Bitmap("c:\IMG_0425.jpg")
    6.         Dim pd As New PrintDocument()
    7.         AddHandler pd.PrintPage, New PrintPageEventHandler(AddressOf Me.pd_Print)
    8.         pd.Print()
    9.  
    10.  
    11.  
    12.     End Sub
    13.  
    14.     Private Sub pd_Print(ByVal sender As Object, ByVal e As PrintPageEventArgs)
    15.  
    16.         e.Graphics.DrawImage(img, 10, 10)
    17.  
    18.     End Sub
    I don't have any tiff images, so I tested it with a jpg. Not sure if it matters... I wouldn't think so.
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: print tiff file

    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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: print tiff file

    Thanks a bunch gurus ,I will try your approach

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width