aspose file tools*
The moose likes Servlets and the fly likes Acrobat Plugin should first open, then I want to stream a PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Acrobat Plugin should first open, then I want to stream a PDF" Watch "Acrobat Plugin should first open, then I want to stream a PDF" New topic
Author

Acrobat Plugin should first open, then I want to stream a PDF

Chris Jackal
Greenhorn

Joined: Mar 18, 2005
Posts: 4
Hi,

when I stream a PDF (which is packaged in a ByteArrayOutputStream) to the Browser, the Acrobat Reader plugin opened not until the whole document
is loaded. Is there a header, or anything else I have to set in my servlet to make sure that first the Acrobat plugin open and then the streaming starts. I need this behaviour, because if my user have a slow internet connection, he should have the chance to see the first page of the document during the rest of the document is still loaded in the backround.

code:

//document = PDF as ByteArrayOutputStream

ServletOutputStream servletOut = response.getOutputStream();

response.setContentType("application/pdf");
response.setContentLength(document.size());

document.writeTo(servletOut);
response.flushBuffer();

servletOut.flush();
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

he should have the chance to see the first page of the document during the rest of the document is still loaded in the backround.


Do a google search on "Linearized PDF" or "Linear PDF".
The PDF itself has to be generated in a particular way to get this behaviour.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Chris Jackal
Greenhorn

Joined: Mar 18, 2005
Posts: 4
thank you now i have understood
It's a pity that iText not supported "Linearized PDF's", so I have to look for an alternative possibility to create a linearized PDF.
[ March 18, 2005: Message edited by: Chris Jackal ]
 
jQuery in Action, 2nd edition
 
subject: Acrobat Plugin should first open, then I want to stream a PDF