We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export SVG to fill the graphics

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();

        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.

            // set page size
            PageSize pgSize = new PageSize(PaperSizeFormat.CUSTOM);
            diagram.save(dataDir + "test-" + i + ".svg", options);

aspose.zip (243.7 KB)


Thanks for contacting support.

Would you please also share an expected output SVG for our reference so that we can test the scenario accordingly and proceed further to assist you.

thanks for your reply. As shown in the attachment
aspose-svg.zip (30.0 KB)


Thanks for sharing requested files.

We have logged an issue as DIAGRAMJAVA-50675 in our issue tracking system. We will further investigate the feasibility of you requirements and let you know as soon as the ticket is resolved. Please be patient and spare us little time.

We are sorry for the inconvenience.