• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

opening a pdf file in portlet (browser) from webservice response that contains byte[]

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Our requirement is to open a pdf file in a browser though a portlet . The pdf file is soted in 3rd party repositary and vendor has provided a webservice. The webservice method gives us the pdf as steam of bytes i.e byte[].

We need to convert this byte[] into pdf and diplay in browser. We wrote the below java code to achieve this . We get the file opened in browser , but with junk characters in browser. Any help is greatly appreciated. Thanks!


dr = serviceMobility.getActivityDocument(sActivityID_arg, iDocumentType_arg, bBase64_arg);
byte decoded[] = dr.getPDFDocument();
getResponse().reset();
getResponse().setContentType("application/x-pdf");
getResponse().setHeader("Content-disposition", "attachment; filename=\"ServiceTicket.pdf\"");
ServletOutputStream output = getResponse().getOutputStream();
output.write(decoded);
output.flush();
output.close();
 
reply
    Bookmark Topic Watch Topic
  • New Topic