Search Results for

    Show / Hide Table of Contents

    Class PdfDocumentExtensions

    Extension methods for PdfDocument class

    Inheritance
    System.Object
    PdfDocumentExtensions
    Namespace: IronPdf
    Assembly: IronPdf.dll
    Syntax
    public static class PdfDocumentExtensions : Object

    Use PdfDocumentExtensions in IronPDF when a C# application works with PDF generation. It represents extension methods for PdfDocument class.

    PdfDocumentExtensions matters when an application needs to configure or invoke PDF generation 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 PdfDocumentExtensions, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key methods include ToDocument. Assign options or invoke methods on the instance to configure or perform the operation.

    using IronPdf;
    
    // Obtain PdfDocumentExtensions from the relevant entry point in the IronPDF API
    void Configure(PdfDocumentExtensions instance)
    {
        instance.ToDocument();
    }

    For the broader workflow, see the IronPDF C# documentation for related how-to guides and examples. For broader context, the PDF generation portion of the IronPDF C# API contains related types that work with PdfDocumentExtensions directly. PdfDocumentExtensions exposes additional members beyond those highlighted above; the reference tables on this page list the full set. In application code, treat PdfDocumentExtensions 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 PdfDocumentExtensions property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of PdfDocumentExtensions. Application code typically obtains or instantiates a single PdfDocumentExtensions and shares it across multiple IronPDF operations rather than recreating it per call. For multi-threaded scenarios, follow the threading guidance for the relevant IronPDF entry point; PdfDocumentExtensions instances are not assumed to be thread-safe unless documented.

    Methods

    ToDocument(IDocumentId, String, String)

    Convert a PdfDocument interface to a full PdfDocument

    Declaration
    public static PdfDocument ToDocument(this IDocumentId id, string Password = "", string OwnerPassword = "")
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Pdf.IDocumentId id

    DocumentId to convert

    System.String Password

    Pdf document password

    System.String OwnerPassword

    Pdf document owner password

    Returns
    Type Description
    PdfDocument

    Full PdfDocument

    Exceptions
    Type Condition
    System.InvalidCastException

    Failed to convert

    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget