crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.32k stars 674 forks source link

Printing PDF file : Impossible with Safari 14.1 on OSX #561

Open manuhook opened 3 years ago

manuhook commented 3 years ago

It was working fine on previous version. Now the preview is always blank on Safari 14.1 on OSX, and it's printing a blank page. Thank you,

ZacharySeebeckWork commented 3 years ago

Has anyone found an alternative/fix to this issue?

Also, this doesn't seem to just be the most recent version, all versions are causing this plank printout to happen in my testing.

NielsLeenheer commented 3 years ago

I've encountered the same issue with our custom print library, which isn't based on print.js, but uses similar techniques. What solved it for us is setting a 500ms timeout between the iframe onload handler and calling the iframe contentWindow.print() function.

ZacharySeebeckWork commented 3 years ago

I've encountered the same issue with our custom print library, which isn't based on print.js, but uses similar techniques. What solved it for us is setting a 500ms timeout between the iframe onload handler and calling the iframe contentWindow.print() function.

Would you be able to provide an example @NielsLeenheer? I've given up using this library as it just won't work on safari, and I am running into the same issue when trying to do it custom.

MatthewHerbst commented 3 years ago

@NielsLeenheer would love to know as well. I'm the maintainer of react-to-print which is running into the same issue as of Safari 14.1, and we already have a 500ms timeout in place that is no longer working.