-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
screenshot action hangs while pdf works fine #809
Comments
Check this out #761 |
@daniel3d is right: Setting that aside, and this is kind of offtopic: I'm not certain Nightmare is the best tool for converting SVGs to PNGs. Have you considered using something like ImageMagick? |
@rosshinkley unfortunately not for SVGs :) |
Since the initial implementation of `FrameManager`, Electron added an API for Chromium's remote debugging protocol. One of the debugger's capabilities is to visually highlight a portion of the page. This change uses that functionality to force a new frame to be rendered. This is much more reliable than the way Nightmare currently tries to force new frames to render by fiddling around with the DOM (see issues segment-boneyard#555, segment-boneyard#736, segment-boneyard#809). It also has the benefit of not doing anything page content can observe, ensuring that any JS or CSS won't modify the page in response to Nightmare's attempt to take a screenshot. In future versions of the protocol, it will be possible to directly capture an image of the page, but that feature is still experimental (so it could be removed) and Electron does not yet support it anyhow. Something to keep in mind for future changes, though. This is an alternative solution to the one in 53dee8a (currently on the `screenshot-with-offscreen-rendering` branch). That method (using Electron's new "offscreen" rendering mode) is *much* faster than this and vastly simplifies the code, but has more ways it can fail.
Sometime mid-year, Electron added support for "offscreen" rendering (it still shows a window, but the whole rendering pipeline is a bit different). When this mode is enabled, the rendered view can be explicitly invalidated, which is *much* better and more reliable than the way Nightmare currently tries to force new frames to render by fiddling around with the DOM (see issues segment-boneyard#555, segment-boneyard#736, segment-boneyard#809). This isn't without its downsides; it doesn't work with forced device scale factors and it renders differently than with native system rendering (e.g. text rendering will be slightly different).
Anyone here experiencing timeouts may want to give the #927 a try. There’s also second approach to solving this over on https://github.com/mr0grog/nightmare/tree/screenshot-with-offscreen-rendering that you might give a try. |
Considering this fixed with #927. Closing. |
Hi guys,
Trying to leverage
nightmare
in order to be able to convert an svg to a png.For some reason the following gets stuck on the
screenshot
action:Logs:
using
pdf
instead ofscreenshot
does not get stuck. Any idea what may be causing this?The text was updated successfully, but these errors were encountered: