How to Flatten PDFs Before Printing in C#

IronPrint's PrintSettings class includes a Flatten property that merges all interactive form fields, annotations, and image layers into static content at print time. We set Flatten = true on our PrintSettings object, and IronPrint handles the rest — no separate PDF manipulation library or intermediate file save required.

This guide covers when and how to flatten PDFs before printing, with working C# code for synchronous, combined-settings, and async workflows.

Quickstart: Flatten PDFs Before Printing

  1. Install IronPrint via NuGet: Install-Package IronPrint
  2. Add using IronPrint; to the file
  3. Create a PrintSettings object
  4. Set Flatten to true
  5. Pass settings to Printer.Print() or Printer.PrintAsync()
  1. Install IronPrint with NuGet Package Manager

    PM > Install-Package IronPrint
  2. Copy and run this code snippet.

    using IronPrint;
    
    // Flatten and print a PDF with form fields
    Printer.Print("form-document.pdf", new PrintSettings
    {
        Flatten = true
    });
  3. Deploy to test on your live environment

    Start using IronPrint in your project today with a free trial

    arrow pointer

How Do I Flatten a PDF Before Printing in C#?

We flatten a PDF at print time by setting the Flatten property to true on a PrintSettings object. We then pass that object to any of IronPrint's print methods.

:path=/static-assets/print/content-code-examples/how-to/flatten-pdfs/flatten-basic.cs
using IronPrint;

// Configure print settings with flattening enabled
PrintSettings settings = new PrintSettings();
settings.Flatten = true;

// Send the flattened document to the default printer
Printer.Print("application-form.pdf", settings);
Imports IronPrint

' Configure print settings with flattening enabled
Dim settings As New PrintSettings()
settings.Flatten = True

' Send the flattened document to the default printer
Printer.Print("application-form.pdf", settings)
$vbLabelText   $csharpLabel

We first instantiate PrintSettings, which initializes with default values — including Flatten = false. We then set Flatten to true, which tells IronPrint to merge all interactive elements into the page content before sending the print job. When we call Printer.Print, the printer receives a fully static version of the document.

Flattening happens in memory during the print pipeline. The original PDF file remains interactive on disk, so end users can still fill out and resubmit the form. This is an essential distinction: we are flattening for the printer, not permanently altering the source file.

The Flatten property was introduced in IronPrint v2024.7.2 and is available in all subsequent versions.

When Should I Flatten a PDF Before Printing?

Flattening is most valuable when the PDF contains interactive elements that might not render correctly on paper. The most common scenarios include:

PDFs with fillable form fields. Text inputs, checkboxes, radio buttons, and dropdown menus are rendered by the PDF viewer — not embedded in the page content. Some printer drivers skip these layers entirely, resulting in blank fields on the printed page. Flattening forces the field values into the static page layer.

PDFs with annotations or overlays. Comments, sticky notes, stamps, and markup annotations exist on a separate layer. Flattening merges them into the visible content so they appear on the printed output.

PDFs with embedded images at different layers. Documents assembled from multiple sources can have images on different z-layers. Flattening composites everything into a single layer, preventing missing or misaligned images.

When the PDF contains only static text and images — such as a report generated from HTML or a scanned document — flattening has no effect. In those cases, we can leave Flatten at its default value of false to avoid unnecessary processing overhead.

How Do I Combine Flatten with Other Print Settings?

The PrintSettings class exposes several properties alongside Flatten. We can configure paper size, orientation, DPI, margins, and copy count alongside flattening — all in a single print job.

:path=/static-assets/print/content-code-examples/how-to/flatten-pdfs/combined-settings.cs
using IronPrint;

// Flatten and print with full configuration
PrintSettings settings = new PrintSettings
{
    Flatten = true,
    PaperSize = PaperSize.A4,
    PaperOrientation = PaperOrientation.Portrait,
    Dpi = 300,
    NumberOfCopies = 2,
    PaperMargins = new Margins(10, 10, 10, 10),
    Grayscale = false
};

// Print a filled-out insurance claim form
Printer.Print("insurance-claim.pdf", settings);
Imports IronPrint

' Flatten and print with full configuration
Dim settings As New PrintSettings With {
    .Flatten = True,
    .PaperSize = PaperSize.A4,
    .PaperOrientation = PaperOrientation.Portrait,
    .Dpi = 300,
    .NumberOfCopies = 2,
    .PaperMargins = New Margins(10, 10, 10, 10),
    .Grayscale = False
}

' Print a filled-out insurance claim form
Printer.Print("insurance-claim.pdf", settings)
$vbLabelText   $csharpLabel

We use object initializer syntax for clarity. Flatten = true ensures all form data appears on the printed page. PaperSize.A4 and PaperOrientation.Portrait match the standard format for business forms. Dpi at 300 produces sharp text on filled fields that were originally rendered at screen resolution. PaperMargins accepts four values in millimeters through the Margins constructor.

These properties do not conflict with each other. IronPrint applies the flatten operation first, then formats the resulting static document according to the remaining settings before sending the job to the printer. For more print settings options including printer selection and tray configuration, see the full configuration guide.

How Do I Flatten and Print Asynchronously?

For applications where blocking the main thread is not acceptable — such as WPF or WinForms apps — we use Printer.PrintAsync. The method accepts the same PrintSettings object and returns a Task.

:path=/static-assets/print/content-code-examples/how-to/flatten-pdfs/async-flatten.cs
using IronPrint;
using System.Threading.Tasks;

public class FormPrinter
{
    public async Task PrintFlattenedFormAsync(string pdfPath)
    {
        // Flatten form fields and print asynchronously
        PrintSettings settings = new PrintSettings
        {
            Flatten = true,
            PaperSize = PaperSize.Letter,
            Dpi = 300
        };

        // Non-blocking print — UI thread stays responsive
        await Printer.PrintAsync(pdfPath, settings);
    }
}
Imports IronPrint
Imports System.Threading.Tasks

Public Class FormPrinter
    Public Async Function PrintFlattenedFormAsync(pdfPath As String) As Task
        ' Flatten form fields and print asynchronously
        Dim settings As New PrintSettings With {
            .Flatten = True,
            .PaperSize = PaperSize.Letter,
            .Dpi = 300
        }

        ' Non-blocking print — UI thread stays responsive
        Await Printer.PrintAsync(pdfPath, settings)
    End Function
End Class
$vbLabelText   $csharpLabel

This class-based pattern is useful when print logic lives in a service layer. We configure Flatten = true alongside PaperSize.Letter for US-format forms. The await keyword releases the calling thread while IronPrint processes the flatten operation and sends the print job.

IronPrint's async methods — including PrintAsync and ShowPrintDialogAsync — all honor the Flatten setting identically to their synchronous counterparts. Whether we print silently or through a print dialog, the flattening behavior remains consistent.

What Are My Next Steps?

We covered how to flatten PDFs before printing in C# using IronPrint's PrintSettings.Flatten property. The key takeaway: set Flatten = true to merge interactive form fields, annotations, and image layers into static content at print time — without modifying the source file.

To continue building on this:

Start a free 30-day trial to test PDF flattening in your own print workflows, or view licensing options for production use.

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
Ready to Get Started?
Nuget Downloads 37,845 | Version: 2026.3 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronPrint
run a sample watch your document hit the printer.