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

Second print Empty #25

Open
pedrozasantaigo opened this issue Jul 11, 2024 · 4 comments
Open

Second print Empty #25

pedrozasantaigo opened this issue Jul 11, 2024 · 4 comments

Comments

@pedrozasantaigo
Copy link

First printd.print works, but the second time doesn't and after.

  • Version: "printd": "^1.6.0",
    -Vue 2
  • Chrome version: v 126.0.6478.127
@jonek
Copy link

jonek commented Jul 15, 2024

In Chrome every print attempt after the first one shows an empty page in the print dialog and logs this to the console:

[Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
print @ printd.umd.min.js:1
print @ pen.js:55
n @ vue.min.js:6
t @ vue.min.js:6

The beforeprint and afterprint events, that where logged for the first attempt, are not logged to the console anymore for the failing print attempts.

@pedrozasantaigo
Copy link
Author

i resolved it creating a new instance each print time.

@jonek
Copy link

jonek commented Jul 16, 2024

@pedrozasantaigo Surprisingly, creating a new printd instance seems to be indeed a successful workaround. I applied that workaround as well.

My first guess was that the usage of document.write() (as used here: /src/index.ts#L110 ) was the actual problem. But I was not able to confirm that with a locally patched version of printd.

For reference:

@joseluisq
Copy link
Owner

Feel free to submit a patch if any.

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

3 participants