Welcome Guest Search | Active Topics | Sign In | Register

Save as option Options
Ivan
Posted: Saturday, September 10, 2011 10:56:26 AM
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

eo_support
Posted: Saturday, September 10, 2011 11:07:50 AM
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!


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.