Hi All,I am trying to write a JAVA Web Script to display generated PDF in the browser. Here is the code :
public class MyPDFWebScript extends AbstractWebScript {
@Override
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException {
res.setContentType("application/pdf");
res.setContentEncoding(null);
res.addHeader("Content-Disposition", "inline;filename=12F002340.PDF");
res.addHeader("Content-Length", Integer.toString(content.length));
res.addHeader("Pragma", "no-cache");
res.getWriter().write(new String(content)); // Here I write my PDF content
}
}
When I write the content byte array into a file, I can correctly open and view the PDFWhen I write the same content in the WebScriptResponse I get an empty PDFI think something is missing into my code, but I don't know what.Somebody could help me ?Thanks,Eric