IRONSOFTWAREHOME
Custom PDF Size
using IronPdf;

const string html = @"<p>Lorem ipsum dolor sit amet...";

var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.Custom;
renderer.RenderingOptions.SetCustomPaperSizeInInches(5f, 5f);

var pdf = renderer.RenderHtmlAsPdf(html);

pdf.SaveAs("CustomPaperSize.pdf");
Imports IronPdf

Const html As String = "<p>Lorem ipsum dolor sit amet..."

Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.Custom
renderer.RenderingOptions.SetCustomPaperSizeInInches(5.0F, 5.0F)

Dim pdf = renderer.RenderHtmlAsPdf(html)

pdf.SaveAs("CustomPaperSize.pdf")
NuGet Download
PM > Install-Package IronPdf
Custom PDF Size

Custom PDF Size

One important aspect to note when creating your PDF documents in IronPDF is to ensure they can be viewed or printed well. This means you need to define the target virtual paper size of the PDF and its related real-world paper size.

In this example, we show you how to add custom paper sizes to your PDF projects.

IronPDF supports close to 50 preset paper sizes and unlimited custom paper sizes that should fit every scenario or situation where you'd like your PDF to fit. You can render PDFs in different paper sizes measured in inches or millimeters.

The enum PdfPaperSize class defines the target virtual paper size of the PDF and its related real-world paper size.

You can use the following methods to create PDFs of custom size in inches or millimeters:

  • Renderer.RenderingOptions.SetCustomPaperSizeInInches
  • Renderer.RenderingOptions.SetCustomPaperSizeInMillimeters

You can also use Renderer.RenderingOptions.PaperSize, which is our custom preset paper size, now accurate to 1 micron.

For more detailed information on how to utilize IronPDF's custom paper size functionality and other advanced features, visit the IronPDF Documentation.

Explore Custom PDF Paper Size Guide with IronPDF
View on GitHub

Ready to Get Started?

Nuget Downloads 21,105,021Version:2026.9just released

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.

OR
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 Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
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.9

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.9

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