FranckFreiburger / vue-pdf

vue.js pdf viewer
MIT License
2.23k stars 523 forks source link

Bug when printing a PDF (convert from html to pdf) #291

Open Marlight96 opened 3 years ago

Marlight96 commented 3 years ago

Hello, I noticed a bug when printing the PDF. But this only happens when I get the PDF from the backend. (There it is converted from HTML to PDF) He displays the PDF as normal and correctly only when these boxes are printed.

In Chrome: image

In Firefox: Blank sheet

hoon-dialog commented 3 years ago

Have you tried either #130 or #156?

bgrand-ch commented 3 years ago

@FranckFreiburger hello, thanks for vue-pdf, any news? 🤔

dallasbeek commented 3 years ago

Same issue in Chrome using Iron PDF to generate PDF from html string. Any hack workarounds?

solinad21 commented 3 years ago

hello, any news?

hulyak commented 2 years ago

I have the same problem with a local pdf file.

robrez commented 2 years ago

I think this is a problem that arises when rendering into a canvas from a different document (which is printing works here).

Note that pdfjs's own viewer implementation re-uses a single canvas instance from the same document, it then creates img elements from the re-used canvas element. I don't use this vue pdf library, but I was doing something similar implementation-wise and the problem resolved for me once I changed things up:

https://github.com/mozilla/pdf.js/blob/23b6fde9fc92b827f054e21978e32ce9c13dab82/web/pdf_print_service.js#L177

This does work for me, but I am also a bit worried that URL.createObjectURL (which as used for the img src on img elements created in the iframe's document) might have problems since there are two windows involved.