BPMN.io generates SVGs where some SVG-Path-Elements use a ‘z’ in between.
The SVG-path-content after the ‘z’ starts at the “old” position so the picture is broken (see screenshot below).
When splitting this paths into two separate ones Aspose is able to interpret the SVG well.
Instead of the orginial SVG-Path
<path d="m 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z l 9.450000000000001,5.4 l 9.450000000000001,-5.4"
style="fill: rgb(250, 250, 250); stroke-width: 1px; stroke: rgb(64, 64, 64);"/>
we now use two SVG-Paths
<path d="m 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z"
style="fill: rgb(250, 250, 250); stroke-width: 1px; stroke: rgb(64, 64, 64);"/>
<path d="m 8.459999999999999,11.34 l 9.450000000000001,5.4 l 9.450000000000001,-5.4 z"
style="fill: rgb(250, 250, 250); stroke-width: 1px; stroke: rgb(64, 64, 64);"/>
and Aspose 19.8 creates a nice PDF.
The code to insert the SVG to the Document:
public void convertSvgToPdf() throws Exception {
String pathname = "zInPath.svg";
final InputStream svgFile = FileUtils.openInputStream(new File(pathname));
final FileOutputStream fileOutputStream = new FileOutputStream(new File(pathname + ".pdf"));
Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
documentBuilder.insertImage(svgFile);
doc.save(fileOutputStream, new PdfSaveOptions());
fileOutputStream.close();
fileOutputStream.close();
}
source SVG.zip (19.3 KB)