[EMAIL PROTECTED] wrote:
Bruno
I successfully generated a pdf document using itext with my own servlet. However, can i default the name of the pdf file based on some external parameters like
myName.pdf when I try to save it in acrobat?
There are different approaches to do this.
As you can read here: http://itext.sourceforge.net/tutorial/general/webapp/index.html#HelloWorld you can map the servlet to an url-pattern. In the example, we took /servlet/simple.pdf You could use this pattern instead: /servlet/*.pdf and choose your own filename (in your anchor or with a redirect).
Another possibility is to set the 'Content-disposition'.
This is a header you can set like this:
response.setHeader("Content-Disposition", "attachment;filename=hello.pdf");
(This will open a dialogbox and ask you if you want to open or save the file)
or
response.setHeader("Content-Disposition", "inline;filename=hello.pdf")
(This should open the file in your browser without asking)
I'm answering from memory here, so don't shoot me if it doesn't work.
I know there were some MSIE troubles with Content-Disposition in the past.
br, Bruno
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
