draw-image-export2
draw-image-export2 copied to clipboard
Support export to svg
Would be useful support converting a diagram to SVG format.
It is possible to export to a raster (PNG or jpg) or a vector (pdf), but not a vector format that can be natively displayed within a webpage (like a PNG can).
This is possible if the diagram can be exported in svg+xml format.
Should be possible to achieve this in the section of export.js where the PNG/jpg image is extracted (albeit via a screenshot).
The diagram can be exported to svg in draw.io so should be possible to include this logic here, if not possible to retrieve the SVG data as it stands.
Could the desktop version command line not be used, instead?
@davidjgraph
Could the desktop version command line not be used, instead?
I'm trying to display a SVG image within a webpage, so wouldn't be possible without another service running somewhere.
Could the desktop version command line not be used, instead?
Is this possible ? Is the CLI described somewhere ? I'm looking to programmatically convert .drawio files to .svg (or even .png) ones. However I have found little to no document about how to do this.
draw.io --help Usage: draw [options] [input file/folder]
Options:
-V, --version output the version number
-c, --create creates a new empty file if no file is
passed
-k, --check does not overwrite existing files
-x, --export export the input file/folder based on the
given options
-r, --recursive for a folder input, recursively convert
all files in sub-folders also
-o, --output <output file/folder> specify the output file/folder. If
omitted, the input file name is used for
output with the specified format as
extension
-f, --format
Thank you. Is there a way do it using node only instead of the full electron build ?
FYI - I have built a docker container that exposes drawio Desktop (including the SVG export capability) as a RESTful API:
https://hub.docker.com/r/tomkludy/drawio-renderer
Hopefully this can be of help to others; it is already functioning in my own build pipeline.
Thanks for the suggestion. Unfortunately, we're not going to implement this. The problem we've been seeing with feature that we implement but don't actively use is the code just rots and breaks. @tomkludy 's solution looks like a good workaround.