Print document in EJ2 JavaScript Pdfviewer control

8 May 20231 minute to read

The PDF Viewer library allows you to print the PDF document programmatically using the print() method in the PrintModule.

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

Step 1: Follow the steps provided in the link to create a simple PDF Viewer 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, how to print the PDF document programmatically