Everything I have done up to this point works perfect! However my client now wants to be able to "Dynamically" set the file name of the PDF document so they dont have to type in the document.
Little background of the process they are doing, the HTML to be rendered to PDF is generated on the background of a SQL Sproc, pretty much all the HTML is, is a report that just displays all report data to the client, but each report has a unique identifier, ie. the patient number.
Example: If they are pulling a report for patient XYZ then they want the report to be XYZ-DateOfService.pdf so... the code that is rendering the pdf is below, however everything i have tried to modify the name of the doc it gives me this is a read only file.
Is there any way to specify the name of the file when they use the save feature of adobe? Currently when you hit save it shows ViewWindow, which is the name of the asp page that is generating the pdf.
Code: C#
PdfDocument doc = new PdfDocument();
HtmlToPdf.Options.OutputArea = new RectangleF(0.5F, 0.4F, 7.5F, 10.6F);
HtmlToPdf.ConvertHtml(ReportData, doc);
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearHeaders();
response.ContentType = "application/pdf";
doc.Save(response.OutputStream);
response.End();