Gradient fill not supported in export to SVG


When using SVG export of Diagram for Java, gradient fills are not applied to shapes.

Attached is a zip containing a test Visio file (testshape.vsdx). The Visio SVG output is testshape-from-visio.svg and the output from Aspose Diagram is testshape-from-aspose.svg (30.0 KB)

Visio exports the gradient as a radialGradient element and then associates it with the path through a CSS selector. Aspose appears to ignore the gradient completely.

Will gradient fills be supported by Diagram Java?




Would you please share sample code snippet which you are using at your side for conversion. We will test the scenario in our environment and address it accordingly.



Here’s the section of the code that saves the SVG:

    Diagram vsd = new Diagram(infile);
    // Set up any font directories
    String[] fonts = line.getOptionValues("fontdir");
    if (fonts != null && vsd != null) {
    int sheetIdx = 0;
    SVGSaveOptions saveOpts = new SVGSaveOptions();
    if (line.hasOption("page")) {
        int optSheetIdx = Integer.parseInt(line.getOptionValue("page", "1")) - 1;
        if (optSheetIdx < vsd.getPages().getCount()) {
            sheetIdx = optSheetIdx;
    saveOpts.setSaveFormat(com.aspose.diagram.SaveFileFormat.SVG);, saveOpts);




Thank you for sharing the code.

However, the code snippet can not be compiled because of undeclared variable line. Therefore, please share SSCCE code and the fonts, if necessary for reproducing your scenario, so that we may proceed to help you. Before sharing requested data, please ensure using Aspose.Diagram for Java 19.8.


Hi (28.0 KB)

Attached is a simple test which shows the issue when using version 19.8.

javac -cp .:<PATH-TO-DIAGRAM-19.8.jar> com/cognidox/
java -cp .:<PATH-TO-DIAGRAM-19.8.jar> com.cognidox.TestConvert




We have been able to notice the difference in our environment. A ticket with ID DIAGRAMJAVA-50664 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.