Converti Visio in formati Immagini
Esportazione di diagrammi in formati di file immagine
Questo articolo spiega come esportare un Microsoft Visio diagram in un’immagine utilizzandoAspose.Diagram for Java API.
Utilizzare ilDiagram class' constructor to read the diagram files and the Save method to export the diagram to any supported image format.The image below shows a VSD file about to be saved to PNG format. You can use other diagram formats (VSS, VSSX, VSSM, VDX, VST, VSTX, VSTM, VDX, VTX or VSX) as well. Il file sorgente. Si noti che le etichette Freccia e Triangolo sono in grassetto.
Per esportare un diagram in un’immagine:
- Creare un’istanza della classe Diagram.
- Chiama il metodo Save della classe Diagram e imposta il formato dell’immagine in cui desideri esportare. Il file dell’immagine di output ha l’aspetto del file originale.
Il file di output PNG.
Esempio di programmazione dell’esportazione in un file immagine
// 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(ExportToImage.class); | |
// Call the diagram constructor to load diagram from a VSD file | |
Diagram diagram = new Diagram(dataDir + "ExportToImage.vsd"); | |
// Save as PNG | |
diagram.save(dataDir+ "ExportToImage_Out.png", SaveFileFormat.PNG); |
È anche possibile salvare una pagina particolare come immagine, invece dell’intero documento:
// 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(ExportPageToImage.class); | |
// load diagram | |
Diagram diagram = new Diagram(dataDir + "ExportPageToImage.vsd"); | |
//Save diagram as PNG | |
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG); | |
// Save one page only, by page index | |
options.setPageIndex(0); | |
//Save resultant Image file | |
diagram.save(dataDir + "ExportPageToImage_Out.png", options); |