Link to home
Create AccountLog in
Avatar of raviraghu

asked on

Binary to PDF display on the browser

I have a web service returning a pdf as a byte array ... I have to put that response to the browser as a pdf which user can see and if needed can save. How to acheive this ?

Avatar of felipevidaurri
Flag of Mexico image

Check this Link...
Avatar of raviraghu


I do not develop the web service, we use the web services, I need how to acheive this in java that I can convert the binary into a pdf and present it to the user.
In this page explains how to develop the web Service  and Server part, in the example in this page uses the web service to write an .png file, but also apply for an .pdf file...
Avatar of CEHJ
Needless to say, a browser is not a candidate client for a webservice, so you need something for which a browser IS a candidate client, such as a servlet. That servlet needs to act as the webservice client and then write pdf to the outputstream of the servlet, the byte[] having been turned into a pdf stream with a suitable pdf api
Yes I want to handle the service return in the servlet, and write to the output stream of the servlet, can you please put the exact code of how to acheive that.
Avatar of CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account