Hello, I’m using the Java language and I can export SVG.
I want to use this SVG elsewhere.
But the exported SVG has a lot of white space.
I want the graphics in the exported SVG to be able to fill the whole SVG .
My code is as follows:
License aposeLic = new License();
aposeLic.setLicense(new FileInputStream(new File("D:\\tmp\\visio\\Aspose.Diagram.lic")));//license
boolean licenseSet = License.isLicenseSet();
System.out.println(licenseSet);
String dataDir = "D:\\tmp\\visio\\";
Diagram diagram = new Diagram(dataDir + "test.vsdx");
ShapeCollection shapesCollection = diagram.getPages().get(0).getShapes();
for (int i = 0; i < shapesCollection.getCount(); i++) {
SVGSaveOptions options = new SVGSaveOptions();
ShapeCollection shapes = options.getShapes();
Shape shape = shapesCollection.get(i);
// set export option of hidden Visio pages
// options.setExportHiddenPage(false);
// Set SVG fit to view port
// options.setSVGFitToViewPort(true);
// Set export element as Rectangle
// options.setExportElementAsRectTag(true);
options.setDefaultFont("MS Gothic");
// sets the 0-based index of the first page to render. Default is 0.
options.setPageIndex(0);
// set page size
PageSize pgSize = new PageSize(PaperSizeFormat.CUSTOM);
options.setPageSize(pgSize);
shapes.add(shape);
diagram.save(dataDir + "test-" + i + ".svg", options);
}
aspose.zip (243.7 KB)