As part of a new collection of introspection nodes, I've created a screenshot node that creates an SVG of the current tab. The idea is one drags the node into the flow, double clicks on the node and the tray opens with the SVG code. With a download link in the tray, the SVG can be downloaded.
This is an editor-only node meaning there is no need to deploy this node but that also means it works in Node-RED read-only mode.
It improves on something like svgexport.io browser plugin:
Respects the 'hide' CSS class that is used to hide specific elements, this the svgexport plugin cannot know.
Compliments the setting of visibility on the 'g' element with opacity=0. The SVG Standard ignores visibility on 'g' elements but browsers don't seem to care, Inkscape does care.
Image data (i.e. icons) is inlined using data:image/XXXX;base64, - this is good for things such as Inkscape that can't resolve relative urls. PNG, JPEG and SVG are supported.
It also retrieves font details and includes them in the SVG. This makes the font italic, even if it's not the correct font family (because font might not be installed on system).
Why I did this? Because I find some flows simply artistically pleasing and wanted to scale them up! And also because svgexport did not give me what I wanted
Example is available online, resulting SVG image is shown below. Codebase is on github.
I'll have to install manually I think as the palette manager doesn't want to pick up the new version. I'll try to restart NR first, this is only my dev PC.
That's weird, if it fails there should be an exception in the console. Alternative would be that the image retrieval somehow failed or wasn't triggered. The code for that assumes that all images are retrieved, else the SVG isn't dumped into the editor window.
...or wasn't triggered --> fixed with 0.0.4 --> if you drag the screenshot node onto an empty flow there happens to be no images! Fixed it so that svg is dump into editor when no images are defined.
That circle is all the output I'm getting on any tab. I think it is the blue circle you get on a node in the editor if it needs deploying. But I get it even if nothing needs deploying. Tried on a couple of different tabs, restarted Node-RED and reloaded the editor, no difference I'm afraid.