JavaScript library to print PDFs
You can use Nutrient’s rendering engine for high-fidelity PDF printing. It offers developers an API for programmatic printing, as well as a beautiful UI for viewing documents.
Quick start
Print an open PDF with a single API call:
// Print the current document.instance.print();Print without showing the viewer
Load the document with headless: true to print it without showing the viewer:
NutrientViewer.load({ document: "/path/to/document.pdf", headless: true}) .then((instance) => { instance.print(); }) .catch((error) => { console.error("Failed to load document:", error.message); });Key capabilities
- Auto print — Start printing when the PDF is opened
- Programmatic — Print without opening the PDF
- Input data types — Print from local file, Base64, blob, or URL
- Print with a watermark — Dynamically add when printing
- Annotations — Print with or without annotations
- Forms — Print form field values
- Extendable — Add form fill, annotation, editing, and more
Quick start
Trigger the browser print dialog with one API call:
const instance = await NutrientViewer.load({ container: "#pspdfkit", document: "document.pdf",});
// Print the entire document.await instance.print();
// Or print with options.await instance.print({ mode: NutrientViewer.PrintMode.EXPORT_PDF, excludeAnnotations: false,});This example requires installation.
By default, Nutrient uses NutrientViewer.PrintMode.DOM with printOptions.quality = NutrientViewer.PrintQuality.LOW. See print modes for the tradeoffs and when to prefer NutrientViewer.PrintMode.EXPORT_PDF.
Guides for printing
Auto print
How to print a PDF the moment it’s opened in the viewer
Print without opening the PDF
How to print a PDF without opening it in the viewer
Print from Base64
How to print a PDF from Base64 data
Print from a Blob
How to print a PDF from a blob
Print from a URL
How to print a PDF from a remote URL
Disable printing
How to disable printing in the PDF viewer
Print modes
Learn about the available print modes and how to configure them
Print without annotations
How to print a PDF without annotations
Programmatic printing
How to print a PDF programmatically using the API
Start your free trial for unlimited access and expert support.