vue-pdf
vue-pdf copied to clipboard
Bug when printing a PDF (convert from html to pdf)
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:
In Firefox: Blank sheet
Have you tried either #130 or #156?
@FranckFreiburger hello, thanks for vue-pdf, any news? 🤔
Same issue in Chrome using Iron PDF to generate PDF from html string. Any hack workarounds?
hello, any news?
I have the same problem with a local pdf file.
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:
- document.createElement("canvas");
- iframe.contentWindow.document.createElement("img")
- img src based on the canvas contents
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.