• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to convert blob data to image and display

 
Ranch Hand
Posts: 258
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I have stored a pdf file in database as a blob data type. I am getting it through query. I have a search result page where
i want to provide a link to view the image of this pdf data. Please tell me how to convert the blob data to the image content
in servlet. and set it in response.

Sorry i dont know in which section my question will fit. Please move to the proper section if so.

Thanks in advance.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just get an InputStream of it using ResultSet#getBinaryStream() and then write it to the OutputStream of the HttpServletResponse.

Don“t forget to set the important response headers accordingly. At least the content-type, content-disposition and content-length.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic