Closed gwicke closed 7 years ago
Hmm, I wonder if this has anything to do with the target file being rendered is SVG. Also I haven't tested directly rendering image files. Wrapping it in some HTML could help?
Wrapping the image in HTML does indeed avoid the issue: https://pdf-electron.wmflabs.org/png?accessKey=secret&url=https://people.wikimedia.org/~gwicke/svg.html&browserHeight=102&browserWidth=102
This work-around should be good enough for our application.
Great, rendering is called when did-finish-load
event triggers. I actually didn't notice the ready-to-show
event in Electron docs, but looks like it is not much better than current event:
This is event is usually emitted after the did-finish-load event, but for pages with many remote resources, it may be emitted before the did-finish-load event.
PNG and JPG renders often seem to be taken too early, before electron has finished rendering.
Examples, produced by repeating this request with different browserHeight / browserWidth values:
Some also only show a transparent background & a scrollbar:
I experimented with triggering the call to
capturePage
in aready-to-show
event handler, or adding a static delay before this call. Neither eliminated the issue.