Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Marlight96 opened this issue Feb 5, 2021 · 6 comments
Open

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

Marlight96 opened this issue Feb 5, 2021 · 6 comments

Comments

@Marlight96
Copy link

Marlight96 commented Feb 5, 2021

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
Copy link

Have you tried either #130 or #156?

@bgrand-ch
Copy link

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

@dallasbeek
Copy link

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

@solinad21
Copy link

hello, any news?

@hulyak
Copy link

hulyak commented Nov 25, 2021

I have the same problem with a local pdf file.

@robrez
Copy link

robrez commented Jan 20, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants