Welcome Guest Search | Active Topics | Sign In | Register

EO.pdf File Name Options
Posted: Wednesday, April 20, 2011 11:28:09 AM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
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();
eo_support
Posted: Wednesday, April 20, 2011 11:44:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The usual way to do that is to use "content-disposition" header. You can find more details from this MS article:

http://support.microsoft.com/kb/260519

Note this information is provided as is and the feature has nothing to do with the EO.Pdf product. So if you run into any problem we won't be able to troubleshoot it for you. In any case, you can test it with any file name, even without creating a PDF file.

Another alternative is to use our Downloader control. You can set the "SaveAs" file name on the downloader control. EO.Pdf Web Demo project already demonstrates how to use them together. However the Downloader is part of EO.Web Controls, so you will need to purchase it separately in order to use it.

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.