Search results

Print the PDF document programmatically

18 May 2022 / 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