Syncfusion AI Assistant

How can I help you?

Print a document in JavaScript PDF Viewer

16 Oct 20251 minute to read

Print a PDF document programmatically using the print method in the Print module.

The following steps are used to print the PDF document programmatically.

Step 1: Follow the steps in the Get started with JavaScript ES5 PDF Viewer guide to create a sample.

Step 2: Add the following code snippet to perform the print operation.

 <button id="print">Print</button>
document.getElementById('print').addEventListener('click', ()=> {
   //Print the loaded document.
   viewer.printModule.print();
});

Find the sample: Print the PDF document programmatically