v0ld3m0rt
v0ld3m0rt

Reputation: 904

Send a file for the user to save it

Instead of quietly saving the pdf file generated through itext code to a specific location, i want it to show as a download to the user and than they may save it wherever they want. How can i accomplish this in itext?

Upvotes: 0

Views: 60

Answers (1)

Bruno Lowagie
Bruno Lowagie

Reputation: 77606

Please take a look at the CreatePdf servlet from my book. Assuming that you're talking about a web application (your question doesn't give us that info), you are serving the document inline. If you want the browser to open a "Save As" dialog, you need to change the content disposition to attachment.

In Java, it's done like this:

response.setHeader("Content-Disposition", "attachment; filename=" + filename);

In C#, it's done like this:

Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);

Upvotes: 1

Related Questions