954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

print a tiff file from vb6 code

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

muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

you could use a picture box, and then load the picture with:

picture1.Picture = LoadPicture("c:\scans\101.tiff")


Then you have to get a little more complicated, and do something with the printer... so you can say:

const twipfactor = 1440
picture1.autoredraw = false
printer.paintpicture picture1.picture, 1400, 2040

Ok, paintpicture accepts the picture, and the upper left coordinate of where on the page to start printing.... you can also specify other options, such as hight and width of the picture, but for now, that should work.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Everytime i try to load a tiff file into the picbox, I am getting an INVALID PICTURE error. I try it with another bitmap file, and it works.

Also what if I have a multi page tiff file in the system, how would those be printed?

Thanks in advance.

MuthuIVS

muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

Hi. I'm new here, but struggling with the same problem - how to handle TIFFs in VB6. Has anyone come up with an answer?
How about some code to convert a TIFF to BMP or JPG? Anyone out there got any ideas?
Cheers
Stickerman

stickerman
Newbie Poster
2 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

Use Imageman VB ActiveX component (that costs around $500.) add that to VB project reference.

'sample code

Dim myimagecontrol As IMActX8.ImageControl

Set myimagecontrol = New IMActX8.ImageControl


myimagecontrol.Picture = Trim(C:\images\sample.tif)

Call myimagecontrol.ScaleImage(500, 500)

Picture1.Picture = myimagecontrol.VBPicture

' Picture1 is VB picturebox.

this is how I am displaying tif images in VB

raviks
Newbie Poster
1 post since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

Hi!

I'm trying to print my tiff files and put page number on it.
Just want to ask, if it is possible to do this in Microsoft excel using macro codes or in visual basic?

You can also send response in my email add: [email]histrionics_2007@yahoo.com.ph[/email]

Thank you.

NeoInTech08
Newbie Poster
1 post since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

Hi!

I'm trying to print my tiff files and put page number on it. Just want to ask, if it is possible to do this in Microsoft excel using macro codes or in visual basic?

You can also send response in my email add: [email]histrionics_2007@yahoo.com.ph[/email]

Thank you.

have you tried Windows Image Acquisition 2.0 (WIA 2.0).
It works great for me and I guess it is the one you need.
Best of all, it is free.

neosonic
Junior Poster
137 posts since Nov 2009
Reputation Points: 22
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You