AspxToPdfRenderThisPageAsPdf Method (AspxToPdfFileBehavior, String, PdfPrintOptions)

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: 2020.10.3
Syntax
public static void RenderThisPageAsPdf(
	AspxToPdfFileBehavior behavior,
	string pdfFileName = null,
	PdfPrintOptions printOptions = null
)

Parameters

behavior
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