Open tif from browser jspdsp

Hi Francine Pineau,
I am taking shots at this; Here are couple of suggestions:

You said you are going to imaging software, capturing the file and storing it on webM server;
can you locally open the file by just double clicking on it!!

Regarding the getFile and bytes, and converting to string, I guess you should try to encode the string, and decode it back in your dsp/jsp page for it to be displayed correctly.

I remember that I had similar issue once with displaying the pdf file and that was the one of the issues.

Also, search for setResponse (Esp this link [url=“”] and look at webM API for Service.setResponse;

The above link has some code I posted before which shows how to set content-type and content for such cases; use it at your own risk!


I don’t think you should convert the TIF to a string. If the user’s browser has a viewer registered to handle TIF documents should should just be able to allow them to click on a link to the file stored on the IS box to display it.

I’m not sure that moving the images to your IS server is the best approach. It may work, but will quickly consume the disk space on your server unless you create some scheduled tasks to remove files that are no longer needed. Seems like most imaging systems can serve up the file via an HTTP URL these days. If yours will do so, then you just need to derive the URL and give the user a link to pull it up.


As Mark points out, you definitely do not want to convert the bytes to a string

You don’t necessarily have to write the file to the local disk at all. If you only want to show the image within another view (and not within a containing web page), you’ll want to set the response yourself to set the response bytes and the response type (which will cause the default viewer to be launched when the user’s browser supports such an action). You’ll need to create a Java service to do this:

Service: setResponse – see the gets below to see the input parms

IDataCursor idc = pipeline.getCursor(); 
byte[] bytes = (byte [])IDataUtil.get(idc, "bytes"); 
String encoding = IDataUtil.getString(idc, "encoding"); 
String contentType = IDataUtil.getString(idc, "contentType"); 
String remoteFilename = IDataUtil.getString(idc, "remoteFilename"); 
idc.destroy(); httpheader = Service.getHttpResponseHeader();  
if(httpheader != null) 
    if(contentType!=null && !contentType.equals(""))  
        httpheader.addField("content-type", contentType);  
    if(encoding!=null && !encoding.equals(""))  
    if(remoteFilename!=null && !remoteFilename.equals(""))  
              "inline;filename= \""+ remoteFilename+ "\"");  

I’ve used this to successfully send a PDF (bytes which don’t exist on disk in any form) to a browser causing Reader to launch). Should work the same for tiff’s. Just retrieve the tiff bytes from your imaging server and pass them off to the browser using the code above.