|
For specifying a file name you need to
send the pdf as an ‘attachment’. The following code chunk might help –
[code] StringBuffer sbFilename = new StringBuffer(); sbFilename.append("PDFFILE"); sbFilename.append(".pdf"); StringBuffer sbContentDispValue = new StringBuffer(); sbContentDispValue.append("attachment"); sbContentDispValue.append(";
filename="); sbContentDispValue.append(sbFilename); response.setHeader("Content-disposition",
sbContentDispValue.toString()); Dayal -----Original Message----- Hi. I have to following code in a
SERVLET:
Document document = new Document();
document.open(); From the browser, I do get the
expected PDF results. However, when I click File | Save (and somehow Save
As is disabled) on the browser, the filename that comes up is a substring of
the URL currently showing in the browser, and appended with ".pdf".
How can I change this file name that keeps defaulting in the Save
dialog text field? For example, when I click the link
to execute the above code in the servlet, my browser would display the PDF
results. When I choose the File | Save option from the browser, the file name
that appears is start_src=test.pdf, where start_src=test was from my URL (which
was /start?src=""> Any help would be greatly
appreciated. Thanks. David O. |
