Class ImageExport

Creates a new image export instance to be used with an export canvas.

Here is an example that uses this class to create an image via a backend using XmlCanvas2D.

const xmlDoc = xmlUtils.createXmlDocument();
const root = xmlDoc.createElement('output');
xmlDoc.appendChild(root);

const xmlCanvas = new XmlCanvas2D(root);
const imageExport = new ImageExport();

imageExport.drawState(graph.getView().getState(graph.model.root), xmlCanvas);
const xml = xmlUtils.getXml(root);

const bounds = graph.getGraphBounds();
const w = Math.ceil(bounds.x + bounds.width);
const h = Math.ceil(bounds.y + bounds.height);

new MaxXmlRequest('export', 'format=png&w=' + w +
'&h=' + h + '&bg=#F9F7ED&xml=' + encodeURIComponent(xml))
.simulate(document, '_blank');

Constructors

Properties

includeOverlays: boolean = false

Specifies if overlays should be included in the export.

false

Methods