0

I am working with the very good mxgraph library. I base my application on the GraphEditor example. I have used my own PNG icons. Everything works well. For a better rendering I want to use SVG images. I have tried to remplace PNG image by SVG image, it's working well in the javascript : I can drag and drop, then resize ... I can save and open correctly. But if I try to export in PNG or PDF, the SVG images or not exported (the rest of the diagram is OK). I tested SVG images on draw.io and it is correctly exported. Is there any option or parameter to fix that ?

I looked to another request : SVG shapes instead of stencils The solution might be with mxImage but I can't find how to use it.

Any help welcome.

Mikael
  • 1
  • 2
  • You will have to create your image in svg according to this link: `https://jgraph.github.io/mxgraph/docs/js-api/files/shape/mxStencil-js.html`. and then register your svg as `Stencil`, Thats all, `InsertVertex` with the shape name you just registered in `Stencil` – Shaybi May 17 '18 at 18:58
  • I tried this solution. I used https://github.com/jgraph/svg2xml to convert my svg images into xml then I used addStencilPalette (in Sidebar.js), to load it. It's not too bad but the conversion with svg2xml is not very good : shapes are reversed + not all svg parameters managed => some shapes are not correctly converted. I would prefer to use svg files directly like other image files, with createVertexTemplateEntry in Sidebar.js – Mikael May 24 '18 at 22:09

0 Answers0