AspxToPdfRenderThisPageAsPdf Method

Automatically renders any ASPX page into PDF instead of Html. Use it in the Page_Load Event.


protected void Page_Load(object sender, EventArgs e){ 
                   IronPdf.AspxToPdf.RenderThisPageAsPdf(FileBehavior.Attachment, "MyPdf.pdf", new  PdfPrintOptions(){ Dpi = 300 });

Namespace:  IronPdf
Assembly:  IronPdf (in IronPdf.dll) Version: 2020.7.1
public static void RenderThisPageAsPdf(
	AspxToPdfFileBehavior PdfBehavior = AspxToPdfFileBehavior.InBrowser,
	string PdfFileName = null,
	PdfPrintOptions PrintOptions = null


PdfBehavior (Optional)
Type: IronPdfAspxToPdfFileBehavior
Specifies if the PDF file should be downloaded as an attachment, or displayed directly in the browser of users.
PdfFileName (Optional)
Type: SystemString
The file-name of the PDF. If no name is set, a suitable name will be automatically assigned chosen based on the Html title, PrintOptions or name of the ASPX page.
PrintOptions (Optional)
Type: IronPdfPdfPrintOptions
Sets PDF output options such as PDF Title, paper-size, DPI, headers and footers.
See Also
Download DLL or Install with Nuget