Download as PDF a webform generated from itexsharp

0

I have a webform where starting from an image .jpg , the complete with data of the transaction in question using itextsharp and I open it with a windows.open .

The problem is that when I click on the download icon, the form is downloaded to me as .aspx and I would need it as .pdf . How could I achieve this?

    
asked by DavidC 31.07.2017 в 13:07
source

1 answer

0

You must return the file in the Response specifying the download name and the content type:

string rutaArchivo= "c:/archivos/reporte.pdf";
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", // especificando que lo descargue como pdf
   string.Format("attachment; filename={0}", System.IO.Path.GetFileName( nombreArchivo)));
Response.TransmitFile(rutaArchivo); 
Response.End();
    
answered by 31.07.2017 / 14:47
source