将 Visio 形状转换为图像
Contents
[
Hide
]
将 visio 形状转换为图像
公开的 ToImage 方法形状类可用于转换为图像。
下面的代码显示了如何:
- 加载示例 diagram。
- 获取特定页面。
- 得到一个特定的形状。
- 将形状转换为图像。
形状到图像
在您的 Java 应用程序中使用以下代码将 visio 形状转换为图像。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ShapeToImage.class); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "ShapeToImage.vsdx"); | |
// Get a particular page | |
Page page = diagram.getPages().get(0); | |
// Get a particular shape | |
Shape shape = page.getShapes().get(0); | |
// Shape to image | |
com.aspose.diagram.ImageSaveOptions option = new com.aspose.diagram.ImageSaveOptions(SaveFileFormat.PNG); | |
shape.toImage("out.png",option); |