IRONSOFTWAREHOME
USE CASES

How to Export ASP.NET Web Forms to PDF

Curtis Chau
Curtis Chau
Updated: July 5, 2026

Plenty of organizations still run ASP.NET Web Forms behind banking portals, accounting systems, and internal dashboards. The apps are stable, but they rarely offer a clean way to hand a user a downloadable document. Adding PDF export gets framed as a reason to re-platform onto MVC or Blazor, an expensive move for software that otherwise runs fine. IronPDF takes the cheaper route: it turns the ASPX page a user is already viewing into a PDF with one line of code.

Where the Gap Shows Up

A Web Forms page usually renders its invoice, statement, or report as styled HTML already. Staff and customers then want that same view as a portable file they can save, email, or print. A separate PDF template means a second layout that drifts from the first. The browser print dialog yields different results on every machine. What teams need is a server-side PDF that mirrors the page on screen.

Rendering the Page in Place

IronPDF converts the live ASPX page from inside the Page_Load event. The AspxToPdf.RenderThisPageAsPdf method reuses the page already built for the web view, so styling, links, and form fields carry over.

using IronPdf;

public partial class Invoice : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.Attachment, "Invoice.pdf");
    }
}

FileBehavior.Attachment triggers a download with a chosen filename. FileBehavior.InBrowser displays the document inline instead.

Controlling the Output

Rendering options cover the details that make output fit for distribution: headers, footers, page numbering, and a print stylesheet that strips screen-only navigation.

var options = new ChromePdfRenderOptions
{
    CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print,
    TextFooter = new TextHeaderFooter
    {
        LeftText = "{date} - {time}",
        RightText = "Page {page} of {total-pages}"
    }
};
AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.Attachment, "Invoice.pdf", options);

Settings That Decide a Clean Conversion

A handful of choices determine whether conversion holds up under load:

  • Dynamic content: Pages using Ajax or client-side charts need EnableJavaScript along with a WaitFor rule so rendering captures the finished page. See the WaitFor guide.
  • Print styling: Setting CssMediaType to Print applies a dedicated stylesheet, which keeps buttons and menus out of the document.
  • Throughput: Chromium rendering is resource intensive, so async processing keeps high-traffic endpoints responsive.

One line, no rewrite

That single call inside an existing page gives a Web Forms application invoice downloads, printable statements, and exportable reports, no migration required. Full method reference and configuration options live in the ASPX to PDF guide.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.10

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.10

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999