Click or drag to resize

AspxToPdfRenderThisPageAsPdf Method

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

Example:

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: 4.4.2.27556 (4.4.4.0)
Syntax
public static void RenderThisPageAsPdf(
	AspxToPdfFileBehavior PdfBehavior = AspxToPdfFileBehavior.InBrowser,
	string PdfFileName = null,
	PdfPrintOptions PrintOptions = null
)

Parameters

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