Hi Michael,
You might be able to run some JS before the print. Looking at this article, it does seem possible : https://stackoverflow.com/questions/11138939/how-to-trigger-javascript-on-print-event
@steveush please can you chime in here with some code to force FooGallery to load all images as if the visitor had scrolled down to the gallery
Hi @mnelson4,
I’ve taken a look at this and it is not something I think is possible. A solution could be cobbled together but it would not work 100% across all browsers or even 100% of the time in the same browser. The answer to this Stack Overflow question lists the reasons why but to summarize them:
1. Hooking into the onbeforeprint event and forcibly loading the images will not guarantee that they have actually loaded before the browser takes the snapshot to print. Images are loaded asynchronously so once the load is triggered the browser will immediately snapshot the page and print what is available without waiting for the images to finish.
2. You can’t stop/stall the print request from the browser. We do not have this kind of control over the browser when working with client side scripts other wise the web would be a lot more dangerous to navigate. There are ways to try and stall it but they all involve JavaScript that is not recommended as it basically hangs the browser to perform the stall.
I’ll add a story for this to our backlog that we can keep checking in on in the future but at present I don’t believe a viable option that could be added into the core code exists. All solutions I have seen require custom Print buttons within the page which kind of defeats the whole point as most people will use the browsers print feature.
Thanks
Thanks for looking into it @steveush, that sounds reasonable. Is there at least a way to tell foo gallery to load all the images immediately (rather than delay)? Eg on certain pages I know users will want to print, I could override the dynamic gallery’s default behavior of lazy-loading the images.