Can I capture screenshot of a hidden window?

Comments

  • try to temporarily hide and then show after rendering
    https://snippet.webix.com/p823q0ou

  • thank you so so much !!!!

  • Follow up question, is there a way to achieve desired resolution of said screenshot? Cause after 3rd party messenger compress it's almost blurry. I've been through the documentation but didn't seem be having the option to do so.

  • Hey @Human, the only way to fix this seems to be changing the default scale at which the image gets rendered. By default, html2canvas (the library we are using to convert data to all of types of images) is using 96 dpi, setting scale appropriately will scale this value. For example, setting scale to 2 would mean rendering an image at 192 dpi (https://stackoverflow.com/a/50736279).

    The issue here is actually changing the specified value, as you can't gain access to these settings easily. You will either have to modify the toPNG method in the source code, and add the scale: 2 (for example) to settings:

    window.html2canvas(node, {
              background: "#fff",
              logging: false,
              useCORS: true,
              scale: 2
            }).then(...)
    

    Or you will need to download the package with cdn files responsible for the export (https://docs.webix.com/desktop__export_png.html#exportingdataoffline) and modify the correct file (html2canvas-1.0.min.js in this case) using the same settings. Afterwards, you will need to provide a path for your new cdn-package as described in the article above.

  • Thank you so much @Dzmitry , alittle weird can't scale from the front but it works~

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!