Hi All,
I'm having a strange case of 'File does not begin with %pdf' issue
with a servlet I'm using.
The servlet basically merges PDF (roughly based on the sample itext
code), and then feed it back to the browser:
Flow goes like this: When the servlet is called it spawns a thread
(called pj here), that handles merging, and returns a
ByteArrayOutputStream which is then fed to the browser like this :
--
response.setBufferSize(2048);
response.setContentType("application/x-pdf");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0,
pre-check=0");
response.setHeader("Pragma", "public");
response.setContentLength(pj.getBaosSize());
response.setHeader("Content-disposition", " inline; filename=Test.pdf");
ServletOutputStream sos;
try {
sos = response.getOutputStream();
pj.getBaos().writeTo(sos);
sos.flush();
} catch (IOException e) {
e.printStackTrace();
}
--
now most of the time this works, but occasionnaly, on browser using
acrobat 5 or 6, it shows a 'File does not begin with %pdf' message' .
Usually, reloading the page seems to display it correctly, but
sometimes it just won't work, typically under load.
Note that I'm aware that adobe recommends somewhere not using the
plugin and using the reader instead, but I need PDFs to be displayed
in a frame as part of my application, so it is not an option for me.
Any idea or help would be appreciated.
--
m o t d i e m
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions