Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to rename the outputted PDF file in the Response object?


Every report that I export in my servlet app will have the filename of the java class file plus the pdf extension, for example, the page "printreport" will generate "printreport.pdf", how can I rename the outputted file?

This is my code, which does not change the filename right now:

ReportClientDocument reportClientDoc = new ReportClientDocument();, OpenReportOptions._openAsReadOnly);
Object reportSource = reportClientDoc.getReportSource();
response.addHeader("content-disposition", "inline; filename=MyCustomReportName.pdf");
response.addHeader("Content-Disposition", "attachment;.filename=MyCustomReportName.pdf");
exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), null);

Thank you!


> response.addHeader("Content-Disposition", "attachment;.filename=MyCustomReportName.pdf");

What happens if you replace .filename with filename?


Ted Ueda

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question