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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can display TIF document w/in my HTML page?

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I am trying to render a page where user views a TIF document online. I have tried everything I can think of but the most I get is an attempt to download the document.

I want to simply display the TIF document like you would a JPG or PDF - In other words, open it on the browser itself.

I have tried JS code like
Code:
  window.open('mytifdoc.tif');
I have tried img tag
Code:
  <img src="mytifdoc.tif' />
I have even tried using iframe tag
Code:
  <iframe src='mytifdoc.tif'></iframe>

JS gives me the option to download the document and the other two options do nothing ...

Is there a solution to this?

Thank you all in advance for your assistance!


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
TIF files re not supported in Web Browsers so you can't expect them to know what to do with them.

The supported image formats are PNG, GIF and JPG.

Now if changing the format of the images to one of these is not an acceptable solution, you'll have to manipulate the images with some type of server side programming language and convert the images on the fly. Or use maybe a Flash Based image viewer to show the images.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
You can't. Browsers don't support the TIF format.

You *may* be able to place the TIF in some kind of wrapper such as a Flash movie or Java app but I'd say that's pretty much an outside shot.

Why does it need to be a TIF?
If you can't convert the file to a JPEG beforehand then you could use ImageMagick (assuming your server platform supports it) and convert the file 'on the fly' or when it is uploaded then display the JPEG version in the browser.

Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Thank you guys!

I suspected this to be the problem but was not sure!

It is TIF because the document is produced dynamically off a text based application on SCO UNIX using VISIFAX.

I spoke to my college and asked him to see if he could produce PDF in lieu of TIF documents.

I guess that I could look into converting the TIF to a compatible format - I use PHP, off to google ...

Thanks!


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
A PDF file will still need a helper application to display. PDF is not supported by most browsers.

TIF can display in a browser if the user happens to have QuickTime or something similar installed to interpret TIF files in a browser.

If we are talking about a fax, the TIF file is likely a 1-bit scan. This converts best to a 2 color GIF file.
 
Tried converting using
# convert mytifdoc.tif mypdfdoc.pdf and I get this warning/error

convert: warning, contents of file mytifdoc.tif not modified
[/code]

I chose to ignore this and tried to open the resulting pdf document and I get
Code:
Document does not begin with "%PDF-"
I click on OK and the status bar shows
an error has occurred while trying to use this document

Off to learn more about imagemagick ...





--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
to create a PDF you will also need Ghostscript (I think).

Why not convert to a GIF or JPEG? There is little point converting an image to a PDF since a PDF is just a wrapper containing the image which will most likely be a JPEG.

As stated before the PDF also won't open without a helper application so there's little point in turning it into a PDF.

Go with JPEG or GIF and you'll greatly simplify things.

Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
PDF is not supported by most browsers.
Not natively, but most will have the free Adobe reader plug-in installed.

Even if browsers could cope with them, TIF files tend to be enormous - you really don't want to be sending them across the net.

I suggest you either get the unix folks to convert the original text document to a PDF, or convert the TIF to a more suitable image format such as GIF. The PDF appraoch would be the better option, IMO, but may not be possible.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top