Set the content type as "application/pdf" when the file is written the stream in
the servlet. The browser will be able to open the file within it. We can as well
save the document if we want. I hope this works.
Ravi
Ian Thomas wrote:
> Greetings,
>
> I have a particularly thorny problem that I REALLY need help for. Anybody
> that even has a few vague ideas about a possible solution, PLEASE get in
> touch with me.
>
> Here's the problem:
>
> I have a servlet that generates a PDF file based on form data. The purpose
> is to display the PDF in the client browser and let the client use the
> browser print function to print the PDF. All of that works fine. Recently
> added functionality, tho, demands that the client be able to select multiple
> forms, generate one huge PDF with all the forms as a page in the PDF, and
> print that, without ever having to see the actual PDF. (ie ... client can
> choose one form, in which case the PDF pops up on his screen and he can then
> do what he likes with it ... OR client can choose multiple forms, in which
> case they just go straight to his printer). Now .. generating the PDF is no
> problem ... the problem is what to do with it THEN. The plan is to generate
> PDF files in batches of 100 pages each (so if they select ALL on a 2500 form
> database, they get 25 PDF file) .... a 100 page PDF file is approximately 1
> megabyte. I can write it out to a file on the server, or to any kind of
> stream.
>
> SO ... how do I get the PDF from the server to the client printer??? This
> is driving me nuts, I can't figure it out at ALL, PLEASE HELP!!!
>
> Another (much less satisfactory) option would be to send some sort of stream
> to the client browser such that they download the generated PDF files and
> then do what they want with them from there. Outside of just displaying it
> all in the browser, how do I do THAT???
>
> I'm trying to avoid having to save the generated PDF to the server, as this
> is expected to be a fairly high volume web site, and if I go saving 1 meg
> files all over the place, it'll chew through the hard drive in no time flat.
>
> SO ... ANY clues at all would be MUCH appreciated!!!! Thanks in advance.
>
> -Ian Thomas
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html