Search results

Print the PDF document Programmatically in JavaScript PDF Viewer control

08 Dec 2021 / 1 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.

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

Find the Sample, how to print the PDF document programmatically