Skip to main content

png

Description

Exports a diagram to a PNG file

note

To avoid problems during export, all images for Diagram shapes must be set either in base64 format or via an absolute URL.

Usage

png(config?: object): void;

Parameters

  • config - (optional) an object with export settings. You can specify the following settings for export to PNG:
    • url?: string - the url of the service that executes export and returns an exported file. This setting is optional, you should use it only if you need to specify the path to your local export service. The default value is https://export.dhtmlx.com/diagram/png/5.0.0
    • name?: string - the name of the exported file

Example

const diagram = new dhx.Diagram("diagram_container", {
// config options
});
diagram.data.parse(data);

// default export
diagram.export.png();

// export with config settings
diagram.export.png({
name: "result_png"
});

Related articles: Exporting Diagram

Related samples: Diagram. Export. Export diagram