Export active diagram as image via Open API
Visual Paradigm’s Open API is a powerful tool which allow user to extend the functionalities of Visual Paradigm software. With Open API you not just allow to access the model information, but also allow to export diagram into images. To export active diagram as image:
- Obtain the active diagram. We can use DiagramManager().getActiveDiagram() method to achieve this.
IDiagramUIModel diagram = ApplicationManager.instance().getDiagramManager().getActiveDiagram();
- Specify the image type we would like to export via ExportDiagramAsImageOption (suppose export to PNG).
ExportDiagramAsImageOption option = new ExportDiagramAsImageOption(ExportDiagramAsImageOption.IMAGE_TYPE_PNG);
- Perform the export
ApplicationManager.instance().getModelConvertionManager().exportDiagramAsImage(diagram, file, option);
Sample Plugin
The sample plugin attached in this article demonstrate how you can export active opened diagram into a PNG image. After you deploy the plugin into Visual Paradigm, you can then click the plugin button in the application toolbar to trigger it.
Download Sample Plugin
You can click this link to download the sample plugin.
Related Know-how |
Related Links |
Leave a Reply
Want to join the discussion?Feel free to contribute!