Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing an exinsting tiff file from VB6

Status
Not open for further replies.

muthuivs

Technical User
Jan 30, 2006
36
0
0
CA

Hi Guys/Gals,

I am trying to print a tiff image using vb6, any Idea how to do this by using somekind of print function and calling the tiff file that needs to be printed. EG: I have 101.tiff saved in c:\Scans, and I need vb code to send this to the printer by clicking a button on my form. Any help would be deeply appreciated. Thanks

MuthuIVS
 
VB doesn't support TIFF images. You'd have to find a conversion, or else use another app to print it.

-David
2006 Microsoft Valueable Professional (MVP)
2006 Dell Certified System Professional (CSP)
 
As dglienna says, VB doesn't directly support TIFF. However, GDI+ does, and I've covered how to use GDI+ from VB to load TIFFs in the past. Just do a keyword search in this forum.
 
Thsnks for the feedback, I guess I will save the documents as bitmaps for dispaly and printing. Any Idea how to send it to the printer though?

MuthuIVS
 
>I will save the documents as bitmaps

Why? Is the GDI+ stuff more complicated than you want (GDI+ is part of Windows nowadays)?
 
Not really, I haven't had a chance to look at GDI+ functioanlity, I need to have a version 1 of this project done ASAP and since I am working with Twain controls that easily set it up as bmp and TIFF, i will use bmp for display and tiff for the actual purpose that will come later. After displaying the first scanned image I will clear the buffer off the bmp file so it will not take up too much space either.

Another thing I am leaning towards is buying a ActiveX control that will allow me to display and print tiff files, there are a few in-expensive ones out there. In summary, I need this ASAP that is why I have decided to go with a non-GDI+ route. Thanks for your help strongm.

MuthuIVS
 
Hi muthuivs,

I'm attempting to do this myself with bmp and jgp images.

I tried looking at references and adding a reference for MSPAINT but didn't see anything.

Did you have any luck?

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
You know, if you'd investigated my GDI+ suggestion and done a keyword search on it you'd have found that I also reference Microsoft's little advertised Windows Image Acquisition Library for XP (which leverages GDI+ features), the latest version of which is available here:
Once you've got that then loading and displaying a tif (or a jpg or a png) becomes as easy as setting a reference to the library, and then some pretry simple code such as:
Code:
[blue]    Dim myImg As ImageFile
    Set myImg = New ImageFile
    myImg.LoadFile "c:\demo.tif"
    Set Picture1.Picture = myImg.FileData.Picture[/blue]
 
Hi AccessGuruCarl,

What I did was buy a twain contro lfrom the web that supports multipage tiff's and used the pic box to display the picture. The Twain control was only about $100 bucks (I didn't want to program a huge program since I was short for time). It worked well.

MuthuIVS
 
Strongm,

Will the Windows Image Acquisition Library allow you to save a file in the other formats? TIFF, JPEG?
 
Multipage tif would be something like as follows:
Code:
[[blue]Dim myImg As ImageFile
    Dim lp As Long
    
    Set myImg = New ImageFile
    myImg.LoadFile "c:\sample.tif"
    For lp = 1 To myImg.FrameCount
        myImg.ActiveFrame = lp
        Set Picture1.Picture = myImg.ARGBData.Picture(myImg.Width, myImg.Height)
    Next[/blue][
 
Ypu can even do things like taking three bmp files and saving them as a single, multipage tiff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top