Thanks for sharing, @Kevin553. This is actually super interesting! The short answer is that it works as expected when leaving the customHTMLPDF
iframe visible.
It's more difficult to figure out exactly why that is the case, though. One observation is that toggling the "Hidden" attribute actually wraps the iframe
in an InvisibleWidgetWrapper
component.
Another thing that is super odd is that, even when the iframe
is hidden, I can get everything to function correctly by manually inspecting its contents via the browser's dev tools.
In conclusion, I'm guessing that hidden components are being treated differently (maybe lazily loaded?) when wrapped in the InvisibleWidgetWrapper
component. I'll reach out to our internal teams to see if this is intended behavior and provide an update here when I can. In the meantime, does it work for you to leave the iframe
visible? You should still be able to give it a height of 0px
via custom CSS in order to effectively hide it while allowing your script to still run correctly.