Nutrient Web SDK
    Preparing search index...

    Enumeration PrintMode

    Describes mode used to print a PDF document.

    Index

    Enumeration Members

    Enumeration Members

    DOM: "DOM"

    This method renders all pages of the PDF document into bitmaps before sending them to the printer.

    This works in all major browsers and avoids giving users direct access to the source PDF file. However, this method is CPU-bound and memory usage scales with PDF size. Memory usage might be as high as multiple gigabytes for PDFs with over 100 pages.

    Because of its reliability and cross-browser support, this method is the default print mode.

    Some caveats when using this method:

    • To achieve cross-browser support, we render the resulting images into the main window. We try to hide already existing HTML by applying display: none !important. If the printed page still contains other HTML elements, make sure to apply an appropriate print stylesheet to your web app.
    • This method can produce incorrect results when pages of the document have different sizes. Unfortunately, there's no way to work around this issue since it's a CSS limitation.
    • Print fidelity depends on NutrientViewer.PrintQuality. For best quality and lower resource usage, prefer NutrientViewer.PrintMode.EXPORT_PDF when exposing the PDF through the print flow is acceptable.
    EXPORT_PDF: "EXPORT_PDF"

    This method tries to pass a PDF directly to the printing system. This provides better print fidelity and lower memory usage, but gives users access to the PDF and may open the generated PDF in a new tab/window in some browsers.

    Depending on browser capabilities, this mode either:

    • loads a generated PDF in a hidden iframe and calls print() directly, or
    • falls back to opening the generated PDF in a new tab/window for printing. Users then need to use controls in the browser to print the document.

    This gives users access to the PDF, either from the fallback or if they use a ‘print to PDF’ feature in the browser.

    When using this print mode, we can not call the RenderPageCallback when printing pages.

    Note: If the PDF is password-protected, we always fall back to opening the PDF in a new tab.