Search Results for

    Show / Hide Table of Contents

    Class PdfPrintDocument

    Provides advanced control over printing PDF documents to physical printers. Extends System.Drawing.Printing.PrintDocument for full Windows print integration.

    For simple printing, use or . Use this class when you need granular control over print settings, events, or preview.

    Example - Advanced printing with dialog:

    using System.Drawing.Printing;
    using System.Windows.Forms;
    

    var pdf = PdfDocument.FromFile("report.pdf"); var settings = new PdfPrintSettings(); var printerSettings = new PrinterSettings(); var controller = new StandardPrintController();

    var printDoc = new PdfPrintDocument(pdf, settings, printerSettings, controller);

    // Show print dialog: var dialog = new PrintDialog { Document = printDoc }; if (dialog.ShowDialog() == DialogResult.OK) { printDoc.Print(); }

    // Or print preview: var preview = new PrintPreviewDialog { Document = printDoc }; preview.ShowDialog();

    Inheritance
    System.Object
    PdfPrintDocument
    Namespace: IronPdf.PrintDoc
    Assembly: IronPdf.dll
    Syntax
    public class PdfPrintDocument : PrintDocument

    PDF printing in IronPDF is handled through PdfPrintDocument. It represents advanced control over printing PDF documents to physical printers.

    PdfPrintDocument matters when an application needs to configure or invoke PDF printing from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.

    To use PdfPrintDocument, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key properties include FlattenDocument. Assign options or invoke methods on the instance to configure or perform the operation. The create forms covers typical usage in C# end to end.

    using IronPdf;
    
    // Obtain PdfPrintDocument from the relevant entry point in the IronPDF API
    void Configure(PdfPrintDocument instance)
    {
        var current = instance.FlattenDocument;
        instance.OnBeforePrintPage();
    }

    For the broader workflow, see the edit forms guide in the IronPDF C# documentation. For broader context, the PDF printing portion of the IronPDF C# API contains related types that work with PdfPrintDocument directly. PdfPrintDocument instances inherit additional members from PrintDocument that may be relevant in advanced scenarios. In application code, treat PdfPrintDocument as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant PdfPrintDocument property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of PdfPrintDocument. Application code typically obtains or instantiates a single PdfPrintDocument and shares it across multiple IronPDF operations rather than recreating it per call.

    Constructors

    PdfPrintDocument(PdfDocument, PdfPrintSettings, PrinterSettings, PrintController)

    Initializes a new instance of the System.Drawing.Printing.PrintDocument class.

    Declaration
    public PdfPrintDocument(PdfDocument pdfDocument, PdfPrintSettings settings, PrinterSettings printerSettings, PrintController printController)
    Parameters
    Type Name Description
    PdfDocument pdfDocument

    An PdfDocument of document.

    PdfPrintSettings settings

    A PdfPrintSettings that configures the print document.

    System.Drawing.Printing.PrinterSettings printerSettings

    A System.Drawing.Printing.PrinterSettings that specifies where and how the document is printed.

    System.Drawing.Printing.PrintController printController

    The System.Drawing.Printing.PrintController that guides the printing process.

    Properties

    FlattenDocument

    Flatten document before rendering - useful for displaying form field values of a PDF

    Declaration
    public bool FlattenDocument { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    OnBeforePrintPage(PrintPageEventArgs)

    Represents the method that will handle the System.Drawing.Printing.PrintDocument.PrintPage

    event of a System.Drawing.Printing.PrintDocument.

    Declaration
    protected virtual void OnBeforePrintPage(PrintPageEventArgs e)
    Parameters
    Type Name Description
    System.Drawing.Printing.PrintPageEventArgs e

    System.Drawing.Printing.PrintPageEventArgs that contains the event data.

    OnBeforeQueryPageSettings(QueryPageSettingsEventArgs)

    Represents the method that handles the System.Drawing.Printing.PrintDocument.QueryPageSettings

    event of a System.Drawing.Printing.PrintDocument.

    Declaration
    protected virtual void OnBeforeQueryPageSettings(QueryPageSettingsEventArgs e)
    Parameters
    Type Name Description
    System.Drawing.Printing.QueryPageSettingsEventArgs e

    A System.Drawing.Printing.QueryPageSettingsEventArgs that contains the event data.

    OnBeginPrint(PrintEventArgs)

    Raises the System.Drawing.Printing.PrintDocument.BeginPrint event. It is called

    after the System.Drawing.Printing.PrintDocument.Print method is called and before

    the first page of the document prints.

    Declaration
    protected override void OnBeginPrint(PrintEventArgs e)
    Parameters
    Type Name Description
    System.Drawing.Printing.PrintEventArgs e

    A System.Drawing.Printing.PrintEventArgs that contains the event data.

    OnPrintPage(PrintPageEventArgs)

    Raises the System.Drawing.Printing.PrintDocument.PrintPage event. It is called

    before a page prints.

    Declaration
    protected override void OnPrintPage(PrintPageEventArgs e)
    Parameters
    Type Name Description
    System.Drawing.Printing.PrintPageEventArgs e

    A System.Drawing.Printing.PrintPageEventArgs that contains the event data.

    OnQueryPageSettings(QueryPageSettingsEventArgs)

    Raises the System.Drawing.Printing.PrintDocument.QueryPageSettings event. It

    is called immediately before each System.Drawing.Printing.PrintDocument.PrintPage

    event.

    Declaration
    protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e)
    Parameters
    Type Name Description
    System.Drawing.Printing.QueryPageSettingsEventArgs e

    A System.Drawing.Printing.QueryPageSettingsEventArgs that contains the event data.

    Events

    BeforePrintPage

    Represents the method that will handle the System.Drawing.Printing.PrintDocument.PrintPage

    event of a System.Drawing.Printing.PrintDocument.

    Declaration
    public event PrintPageEventHandler BeforePrintPage
    Event Type
    Type Description
    System.Drawing.Printing.PrintPageEventHandler

    BeforeQueryPageSettings

    Represents the method that handles the System.Drawing.Printing.PrintDocument.QueryPageSettings

    event of a System.Drawing.Printing.PrintDocument.

    Declaration
    public event QueryPageSettingsEventHandler BeforeQueryPageSettings
    Event Type
    Type Description
    System.Drawing.Printing.QueryPageSettingsEventHandler

    See Also

    PdfPrintSettings
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    IronPDF_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronPDF