Consider implementing headless exports to remove Electron dependency
LukeCarrier opened this issue · comments
We're currently using the Draw.io desktop application to perform exports. This Electron application also exposes a CLI that allows us to export specific pages to a range of formats.
Whilst the Electron app is an ideal target for installation on desktops, it's less ideal in headless setups as it requires a running display server in order to do anything, even when we don't want a window.
Some bugs on this:
- #12 covered our effort to get the plugin working in containers, working around the Electron sandbox and lack of a display server
- jgraph/drawio-desktop#127 has some other folks interested in headless operation
- jgraph/draw-image-export2#6 is about the CLI not being consistent with the Desktop app
- jgraph/draw-image-export2#2 talks about SVG exports
JGraph have a server-side implementation of exports used in browsers that aren't capable of doing the export locally, which uses Puppeteer. I'm thinking that we should write a client for this and have users run it in an additional container.
- Confirm
jgraph/draw-image-export2
supports all of the same formats as the Desktop app:-
pdf
-
png
-
jpg
-
svg
-
vsdx
-
- Containerise
jgraph/draw-image-export2
- Add an
export_mode
option with bothdrawio
andexport2
modes - Add an
export2_uri
option to specify the service's address - Write the code
I've been working on this today. The JGraph exporter seems both incomplete and a pain to debug, so I've started picking it apart and reimplementing it with less global state and some more approachable functions. The code's over here, and I'd really appreciate some eyes on it if anyone's got a vested interest in exports under Docker.
Basic JPG export is working for me in LukeCarrier/drawio-export-puppeteer#1, but there's work to be done to get to an MVP and quite a bit more to get to feature parity with the Electron app.