Generate SVG from BPMN XML string

Hi,

I have a module that lists BPMN diagrams that are stored in a database, what I would like to do is when a selection is made, display the details and a small preview of the diagram.

Is it possible to generate SVG given an BPMN XML string? I noticed that there is a bpmn.saveSVG function but this needs it rendered to the canvas first.

I just wondered if it was possible, as my alternative solution is to save the SVG along with the XML.

Thanks

Hi there FWIW you can have diffrents aproach to this problem

a) save SVG alongside the XML to the database (that’s what I do in https://gitlab.com/dna2/origin)

b) you can do a offsite render thru http://phantomjs.org/ which is a headless browser (I used to do that for thumbnailing)

hope it helps, good luck!

@JuanitoMint Thanks I will take a look at phantomjs. For the time being I have stored it in the database alongside the XML.

You can also use canvg to render a picture of the SVG once it was imported for the first time. You can script the preview generation, too, i.e. using PhantomJS.