title: Render draw.io diagram to png
body: <p>I'm trying to render <a href="http://draw.io" rel="noreferrer">draw.io</a> saved (SaveAs->Device) .xml diagrams.</p>
  
  <p>Saved diagram using as input example: </p>
  
  <pre><code>&lt;mxGraphModel dx="1426" dy="720" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="#ffffff" math="0" shadow="0"&gt;
    &lt;root&gt;
      &lt;mxCell id="0"/&gt;
      &lt;mxCell id="1" parent="0"/&gt;
      &lt;mxCell id="2" value="" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;" vertex="1" parent="1"&gt;
        &lt;mxGeometry x="180" y="200" width="120" height="60" as="geometry"/&gt;
      &lt;/mxCell&gt;
      &lt;mxCell id="3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1"&gt;
        &lt;mxGeometry x="360" y="180" width="80" height="80" as="geometry"/&gt;
      &lt;/mxCell&gt;
      &lt;mxCell id="4" value="" style="endArrow=classic;html=1;exitX=0.025;exitY=0.638;exitPerimeter=0;" edge="1" parent="1" source="3" target="2"&gt;
        &lt;mxGeometry width="50" height="50" relative="1" as="geometry"&gt;
          &lt;mxPoint x="180" y="430" as="sourcePoint"/&gt;
          &lt;mxPoint x="230" y="380" as="targetPoint"/&gt;
        &lt;/mxGeometry&gt;
      &lt;/mxCell&gt;
    &lt;/root&gt;
  &lt;/mxGraphModel&gt;
  </code></pre>
  
  <p>And then i have to render it to png programmatically, so i writing c# code, using mxgraph library for this purpose:</p>
  
  <pre><code>using System;
  using System.Drawing;
  using com.mxgraph;
  
  namespace MxGraphRendering
  {
      class Program
      {
          static void Main(string[] args)
          {
              var file = mxUtils.ReadFile("../../../export.xml");
              var document = mxUtils.ParseXml(file);
              var codec = new mxCodec(document);
              var graph = new mxGraph();
              codec.Decode(document.DocumentElement, graph.Model);
  
              var image = mxCellRenderer.CreateImage(graph, null, 1, 
  Color.White, false, null);
              image.Save("../../../output.png");
              Console.ReadKey();
          }
      }
  }
  </code></pre>
  
  <p>After it's runned, i've got a certain output:</p>
  
  <p><a href="https://i.stack.imgur.com/dwN5o.png" rel="noreferrer">Source diagram</a></p>
  
  <p><a href="https://i.stack.imgur.com/ck9JC.png" rel="noreferrer">Output image</a></p>
  
  <p>Seems to <a href="https://stackoverflow.com/questions/44179673/drawio-mxgraph-using-xmltosvg-loses-shapes-information">this</a> question, problem is lack of draw.io stylesheets for expected output. There is a simple way to add it all in my c# mxGraph instance?</p>
  
  <p>Or, on the other side, is clear way to render png from xml with native javascript, used in draw.io? (Function, that produce rendering/exporting e.t.c)</p>
  
  <p>Any help is appreciated.</p>