2

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.

int-i
  • 661
  • 1
  • 12
  • 28
James
  • 169
  • 7
  • 1
    Are you missing the whole top bar that they are showing in screenshots on the link you provided or just the print icon? Did you try it without `[print]="true"` the documentation says it is set to true by default and should be unnecessary. – DanGo May 30 '19 at 16:03
  • 1
    Just tried without `[print]` - no luck – James May 30 '19 at 16:06
  • 1
    Are you missing the whole top bar that they are showing in screenshots on the link you provided or just the print icon? This is helpful information to help someone diagnose the problem. 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." – DanGo May 30 '19 at 16:19
  • 2
    @DanGorman You are right. This resolved the issue. Please post it as an answer and I will accept it. – James May 31 '19 at 15:57

1 Answers1

2

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."

DanGo
  • 391
  • 1
  • 13