Rank: Newbie Groups: Member
Joined: 9/10/2011 Posts: 1
|
Have used the RenderAsPDF in the ASPXToPDF to convert a dynamic aspx page (used for invoices) into a pdf, however I would like to save the pdf on the server when I click on a button so I can send the url by email to the customer.
Appreciate if anyone can provide me with some hints on saving the dynamic file as pdf on the server instead of using the RenderAsPDF
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You would handle the ASPXToPDF's AfterRender event. Inside that event handler you would do something like this:
Code: C#
//Uncomment the following line if you do not wish to send the PDF
//to the client side (which triggers the browser's Save As dialog)
//e.Cancel = true;
//Cast the Result property to HtmlToPdfResult
HtmlToPdfResult result = (HtmlToPdfResult)ASPXToPDF1.Result;
//Get the PdfDocument object
PdfDocument doc = result.PdfDocument;
//Save the document
doc.Save(pdf_file_name);
Hope this helps. Please feel free to let us know if you have any more questions. Thanks!
|