Search Results for

    Show / Hide Table of Contents

    Interface IPdfRenderOptions

    Defines the contract for all PDF rendering options - the blueprint for HTML to PDF conversion settings. Implemented by ChromePdfRenderOptions and other render option classes for consistent configuration.

    // All render option classes implement this interface:
    IPdfRenderOptions options = new ChromePdfRenderOptions {
        PaperSize = PdfPaperSize.A4,
        MarginTop = 20,
        MarginBottom = 20,
        PrintHtmlBackgrounds = true,
        EnableJavaScript = true
    };
    
    // Use interface for flexible option handling:
    public void ConfigurePdf(IPdfRenderOptions options) {
        options.PaperOrientation = PdfPaperOrientation.Landscape;
        options.DPI = 300;  // High quality
        options.GrayScale = false;  // Color output
    }
    
    // Clone options for variations:
    var draftOptions = (IPdfRenderOptions)options.Clone();
    draftOptions.JpegQuality = 60;  // Lower quality for drafts

    Use this interface for polymorphic option handling

    Not all options apply to every rendering context

    See: https://ironpdf.com/object-reference/api/IronPdf.IPdfRenderOptions.html

    Namespace: IronPdf
    Assembly: IronPdf.dll
    Syntax
    public interface IPdfRenderOptions

    IPdfRenderOptions is what IronPDF hands back when C# code reads PDF generation. It represents the contract for all PDF rendering options - the blueprint for HTML to PDF conversion settings, so code can work with PDF generation uniformly across implementors rather than binding to a concrete type.

    Concrete implementors include IronPDF concrete implementor, IronPDF concrete implementor. Code that accepts IPdfRenderOptions works uniformly across these implementors, so applications can read or configure C# PDF features without binding to a specific concrete type.

    Most of the usable surface is inherited. The members that carry everyday use of this contract are ApplyMarginToHeaderAndFooter, CreatePdfFormsFromHtml, CssMediaType, CustomCssUrl; consult these first when implementing or consuming IPdfRenderOptions. The color grayscale walks through typical use in the IronPDF C# documentation.

    using IronPdf;
    
    // IPdfRenderOptions is consumed as the API surface for the family of implementors
    void Consume(IPdfRenderOptions target)
    {
        // Use members defined on the interface; concrete behavior follows the implementor
    }

    For collection-wide operations and end-to-end examples, see the IronPDF C# documentation for related guides. For collection-wide operations on IPdfRenderOptions instances, the IronPDF C# documentation lists the relevant container types and their methods. Concrete behavior depends on which implementor of IPdfRenderOptions is returned at runtime; consult the specific class reference for type-specific members. Polymorphic access through IPdfRenderOptions lets code work uniformly across the family of implementors, with a cast required only when type-specific behavior is needed. The reference tables below list the full set of members defined on IPdfRenderOptions along with any inherited members exposed through the contract. In a typical IronPDF C# workflow, IPdfRenderOptions appears as a parameter or return type at the boundary between the application and the IronPDF API. See the methods table below for the complete set of members defined directly on IPdfRenderOptions.

    Properties

    ApplyMarginToHeaderAndFooter

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

    CreatePdfFormsFromHtml

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

    CssMediaType

    Declaration
    PdfCssMediaType CssMediaType { get; set; }
    Property Value
    Type Description
    PdfCssMediaType

    CustomCssUrl

    Declaration
    string CustomCssUrl { get; set; }
    Property Value
    Type Description
    System.String

    CustomPaperHeight

    Declaration
    double CustomPaperHeight { get; set; }
    Property Value
    Type Description
    System.Double

    CustomPaperWidth

    Custom paper width, in mm

    Declaration
    double CustomPaperWidth { get; set; }
    Property Value
    Type Description
    System.Double

    DPI

    Declaration
    int DPI { get; set; }
    Property Value
    Type Description
    System.Int32

    EnableJavaScript

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

    FirstPageNumber

    Declaration
    int FirstPageNumber { get; set; }
    Property Value
    Type Description
    System.Int32

    FitToPaperMode

    Declaration
    FitToPaperModes FitToPaperMode { get; set; }
    Property Value
    Type Description
    IronPdf.Engines.Chrome.FitToPaperModes

    FitToPaperWidth

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

    ForcePaperSize

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

    GrayScale

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

    HtmlFooter

    Declaration
    HtmlHeaderFooter HtmlFooter { get; set; }
    Property Value
    Type Description
    HtmlHeaderFooter

    HtmlHeader

    Declaration
    HtmlHeaderFooter HtmlHeader { get; set; }
    Property Value
    Type Description
    HtmlHeaderFooter

    InputEncoding

    Declaration
    Encoding InputEncoding { get; set; }
    Property Value
    Type Description
    System.Text.Encoding

    Javascript

    Declaration
    string Javascript { get; set; }
    Property Value
    Type Description
    System.String

    JavascriptMessageListener

    Declaration
    StringDelegate JavascriptMessageListener { get; set; }
    Property Value
    Type Description
    StringDelegate

    JpegQuality

    Declaration
    int JpegQuality { get; set; }
    Property Value
    Type Description
    System.Int32

    MarginBottom

    Declaration
    double MarginBottom { get; set; }
    Property Value
    Type Description
    System.Double

    MarginLeft

    Declaration
    double MarginLeft { get; set; }
    Property Value
    Type Description
    System.Double

    MarginRight

    Declaration
    double MarginRight { get; set; }
    Property Value
    Type Description
    System.Double

    MarginTop

    Declaration
    double MarginTop { get; set; }
    Property Value
    Type Description
    System.Double

    PaperOrientation

    Declaration
    PdfPaperOrientation PaperOrientation { get; set; }
    Property Value
    Type Description
    PdfPaperOrientation

    PaperSize

    Declaration
    PdfPaperSize PaperSize { get; set; }
    Property Value
    Type Description
    PdfPaperSize

    PrintHtmlBackgrounds

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

    RenderDelay

    Declaration
    int RenderDelay { get; set; }
    Property Value
    Type Description
    System.Int32

    RequestContext

    Declaration
    RequestContexts RequestContext { get; set; }
    Property Value
    Type Description
    RequestContexts

    TextFooter

    Declaration
    ITextHeaderFooter TextFooter { get; set; }
    Property Value
    Type Description
    IronPdf.ITextHeaderFooter

    TextHeader

    Declaration
    ITextHeaderFooter TextHeader { get; set; }
    Property Value
    Type Description
    IronPdf.ITextHeaderFooter

    Timeout

    Declaration
    int Timeout { get; set; }
    Property Value
    Type Description
    System.Int32

    Title

    Declaration
    string Title { get; set; }
    Property Value
    Type Description
    System.String

    UseMarginsOnHeaderAndFooter

    Declaration
    UseMargins UseMarginsOnHeaderAndFooter { get; set; }
    Property Value
    Type Description
    UseMargins

    ViewPortHeight

    Declaration
    int ViewPortHeight { get; set; }
    Property Value
    Type Description
    System.Int32

    ViewPortWidth

    Declaration
    int ViewPortWidth { get; set; }
    Property Value
    Type Description
    System.Int32

    WaitFor

    Declaration
    WaitFor WaitFor { get; set; }
    Property Value
    Type Description
    WaitFor

    Zoom

    Declaration
    int Zoom { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    Clone()

    Declaration
    object Clone()
    Returns
    Type Description
    System.Object

    SetCustomPaperSizeinCentimeters(Double, Double)

    Declaration
    void SetCustomPaperSizeinCentimeters(double width, double height)
    Parameters
    Type Name Description
    System.Double width
    System.Double height

    SetCustomPaperSizeInInches(Double, Double)

    Declaration
    void SetCustomPaperSizeInInches(double width, double height)
    Parameters
    Type Name Description
    System.Double width
    System.Double height

    SetCustomPaperSizeinMilimeters(Double, Double)

    Declaration
    void SetCustomPaperSizeinMilimeters(double width, double height)
    Parameters
    Type Name Description
    System.Double width
    System.Double height

    SetCustomPaperSizeinPixelsOrPoints(Double, Double, Int32)

    Declaration
    void SetCustomPaperSizeinPixelsOrPoints(double width, double height, int DPI = 96)
    Parameters
    Type Name Description
    System.Double width
    System.Double height
    System.Int32 DPI
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget