Gradient fill not supported in export to SVG


#1

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

gradient-issue.zip (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?

Regards
Vittal


#2

@vittala

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.


#3

Hi

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) {
        vsd.setFontDirs(fonts);
    }
    int sheetIdx = 0;
    SVGSaveOptions saveOpts = new SVGSaveOptions();
    saveOpts.setQuality(100);
    if (line.hasOption("page")) {
        int optSheetIdx = Integer.parseInt(line.getOptionValue("page", "1")) - 1;
        if (optSheetIdx < vsd.getPages().getCount()) {
            saveOpts.setPageIndex(optSheetIdx);
            sheetIdx = optSheetIdx;
        }
    }
    saveOpts.setSaveFormat(com.aspose.diagram.SaveFileFormat.SVG);
    vsd.save(outfile, saveOpts);

Regards
Vittal


#4

@vittala

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.


#5

Hi

gradient-issue-code.zip (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/TestConvert.java
java -cp .:<PATH-TO-DIAGRAM-19.8.jar> com.cognidox.TestConvert

Regards
Vittal


#6

@vittala

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.