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();
}
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You can call "RenderAsPDF(your_file_name)".
Thanks
|