Search code examples
angularangular7pdf.jsng2-pdfjs-viewer

Print preview using PDFJS and angular 7


I just started using ng2-pdfjs-viewer(https://www.npmjs.com/package/ng2-pdfjs-viewer) and trying to provide a print preview of a pdf document to the user using angular 7. I configured and was able to show the document, but couldn't show the print preview.

Here is the relevant code.

  <ng2-pdfjs-viewer #sampleViewer [externalWindow]="true" 
    [print]="true" [page]=2></ng2-pdfjs-viewer>

The viewer just shows pdf document, I expect it to invoke print functionality and show a print preview.


Solution

  • Have you tried to add [startPrint]="true"? The documentation says "Start print preview of document. This combined with externalWindow could mimic a print preview functionality just like the one in gmail."