0

I am using the ngx-extended-pdf-viewer in angular 8 for showing a pdf in a modal, it shows pdf properly but when I'm clicking on the print button it just opening the last page of pdf for print view.

this is my code:

<ngx-extended-pdf-viewer
   [showBookmarkButton]="false"
   [showDownloadButton]="false"
   [showOpenFileButton]="false"
   [src]="pdfUrl"
   [useBrowserLocale]="true"
   height="80vh"
></ngx-extended-pdf-viewer>
Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37

3 Answers3

1
#printContainer { position: absolute; }

Solved it for me on all browsers ...

rekna
  • 5,313
  • 7
  • 45
  • 54
0

Here's the developer of ngx-extended-pdf-viewer. It seems you're not the only one suffering from problems concerning modals.

In general, the problem is caused by the print algorithm of pdf.js. It simply hides everything, adds the PDF pages as images, and prints the result. For some reason, modals tends to interfere with this algorithm. For example, have a look at this issue: https://github.com/stephanrauh/ngx-extended-pdf-viewer/issues/152

However, in your case, only the last page is printed. That's something I'd like to investigate further. Can you send me a reproducer? I.e. a minimal, but fully functional demo showing the bug without requiring me to invest too much work?

Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37
-1

I was getting blank pages after every page on clicking print option.

Adding

#printContainer { 
  position: absolute; 
}

in main CSS file helped me resolve the issue.

Rana
  • 2,500
  • 2
  • 7
  • 28
Vinay
  • 1
  • 3
  • 1
    Don't copy other answers – Rana Oct 19 '21 at 17:53
  • 1
    This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30120671) – Rana Oct 19 '21 at 17:53