Welcome Guest Search | Active Topics | Sign In | Register

Problem in save as in ASPXToPDF1_AfterRender Options
ianblack
Posted: Monday, October 10, 2011 2:25:04 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2011
Posts: 1
How to save as pdf folder after downloading the file.
That is what I need to get saved.

Code: C#
protected void ASPXToPDF1_AfterRender(object sender, System.ComponentModel.CancelEventArgs e)
   {
       e.Cancel = true;

       string fileName = string.Format(
              "Reporte-{0:dd-mm-yyyy-hh-mm-ss}.pdf", now);

       string SaveLocation = string.Format("{0}\\{1}", Server.MapPath("~/HR_PDF/"),
                                               (String)fileName);

       //Cast the Result property to HtmlToPdfResult
       HtmlToPdfResult result = (HtmlToPdfResult)ASPXToPDF1.Result;

       //Get the result document
       PdfDocument doc = result.PdfDocument;

       result.PdfDocument.Save(SaveLocation);

   }

    protected void btnExportarPDF_Click(object sender, ImageClickEventArgs e)
    {

        btnExportarPDF.Visible = false;

        ASPXToPDF1.RenderAsPDF();
       

    }
eo_support
Posted: Monday, October 10, 2011 7:46:41 AM
Rank: Administration
Groups: Administration

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

You can call "RenderAsPDF(your_file_name)".

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.