File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display byte[] in browser

 
Subha Rangu
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java program which retrieves a TIFF Document/Image in byte[] format. Can anybody tell what has to be used inorder to see my image on the browser from a jsp/Java code.
Thanks
 
Julian Kennedy
Ranch Hand
Posts: 823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing now, but have you tried setting the contentType to "image/tiff" and just writing the byte[] to the response?

Jules
 
Tony Morris
Ranch Hand
Posts: 1608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
response.setContentType("image/tiff");
OutputStream out = response.getOutputStream();
// write the byte[] to 'out'
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may also have to set the Content-length to make the browser happy.
Bill
 
Subha Rangu
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony and Julian,
Thank you very much for all the help. I got stuck up with this problem the whole day yesterday. I could solve it now. I will be really thankful to you guys...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic