Nirupama Yalavarti wrote:
> But I have programmed that the pdf is saved to
> specific file(that is the way I want it) ie teh pdf
> generated be saved as a specific file in the server.
> But that doesnt seem to happen.I was expecting it to
> be saved in tomcat/bin.
> Any idea of setting something else for that?
> Thanks
> Nirupama
>
> This what I have written:
>
> ByteArrayOutputStream xslOut = new
> ByteArrayOutputStream();
> byte[] pdfOutData = doRenderPDF(xslOut);
>
>
> response.setContentType("application/pdf");
>
> response.setContentType("application/pdf;
> name=\"test12.pdf\"");
> response.setHeader("Content-Disposition",
> "inline;filename=\"test12.pdf\"");
You should only set *one* of the above.
> response.setContentLength(pdfOutData.length);
>
> OutputStream resOut = response.getOutputStream();
> resOut.write(pdfOutData);
> resOut.close();
Apart from this, you are writing your PDF to the servlet's
output stream and therefore to the browser. The
content-disposition setting is a hint for the *browser* on
how to save the content if it chooses to.
If you want to write to a file on the server, use something
like
FileOutputStream fos=new FileOutputStream("test12.pdf");
fos.write(pdfOutData);
fos.close();
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]