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!

Cannot load image in Microsoft Office Document Imaging 1

Status
Not open for further replies.

chrisjohns

Technical User
Mar 1, 2009
11
0
0
GB
Hi,

I was formerly using Kodak Image Viewer to view images in a form but im not on XP which doesnt use it so im trying to use Microsoft Office Document Imaging to view the image (.tif). However the code doesnt want to take the code i found on the MS website.

the code im trying is:

Form_frmsearch.DocImg1.Document = "C:\temp\Cliff.jpg"

Is it because im trying to allocate 'Document' to a file path? If so whats the alternative?

Thanks
 
I'v check through my controls and cannot find what you are referencing but the preview 1.0 type library(Right click toolbox, components, scroll way down, select, ok) I believe will display tiffs. (Once you add it to a test project you will notice it looks very familiar.)

Good Luck

 
Hi, thanks for the reply but i could never get preview class 1.0 to work, something about OLE connection (theres actually a topic about it on this forum XD)
 
Okay then... Have you searched via yahoo/google for free tiff viewer or controls to view tiffs on xp vista? Found many ocx's, but, some of the better ones are shareware and some are very reasonably priced. Found one that was good for 2k/xp/vista/2k3 for 35.00 I think it was and had pretty much the same capabilities as the wang image controls.

Good Luck

 
The Windows Image Acquisition Library (essentially the replacement for the Kodak Imager Viewer libraries, but not well advertised) which I have banged on about for years in this forum should do the trick (and mentioned in the other thread). And it'll work with tiffs, even multipage ones.

This example requires an Image control, set to stretch, on a form, and a button. Add a reference to the Microsoft Windows Image Acquisition Library, then chuck in this code:
Code:
[blue]Private Sub Command1_Click()
    Dim myImg As ImageFile
    Set myImg = New ImageFile
    myImg.LoadFile "c:\demo.tif" [green]' or whatever your file is[/green]
    Set Image1.Picture = myImg.FileData.Picture
End Sub[/blue]

A multipage tif is handled in almost exactly the same way:
Code:
[blue]Private Sub CommandButton1_Click()
    Dim myImg As ImageFile

    Set myImg = New ImageFile
    
    myImg.LoadFile "c:\demo.tif"
    myImg.ActiveFrame = Text1.Text [green]' the page you want to display
    ' FileData can only display first page of tif, so use ARGBData instead[/green]
    Set Image1.Picture = myImg.ARGBData.Picture(myImg.Width, myImg.Height) [green]' width and height not actually optional when using ARGBData[/green]
End Sub[/blue]



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top