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

Free Support Forum - aspose.com

Size of SVG images are not displayed correctly

Hi,
I have noticed problems displaying SVG images.

Failure Effect:
The size of the SVG image in the document is incorrect.

Steps to reproduce:
Using Aspose.Words for Java 19.7 (failure occurs since version 19.2).
Using the following sample SVG image:
skull.svg
svg_images.zip (3.9 KB)

Using the following code:

DocumentBuilder documentBuilder = new DocumentBuilder();
Shape shape = documentBuilder.insertImage(“src/main/resources/skull.svg”);
documentBuilder.getDocument().save(“test.docx”);

Expected Behaviour
The SVG image should be displayed in the correct size in the document. With version 19.1 the SVG image was displayed in the correct size.

Regards
Ingo Gutzeit

@gutzeit,

We tested the scenario and have managed to reproduce the same problem (with skull.svg only) on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-18902. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

However, the sample.svg image is inserted correctly by the following code (see awjava-19.7-sample.zip (10.6 KB)).

Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
Shape shape = documentBuilder.insertImage("E:\\svg_images\\sample.svg");
doc.save("E:\\svg_images\\awjava-19.7-sample.docx");

Hi @awais.hafeez,

thank you very much for your quick answer.
The size of the sample.svg image is displayed correctly, but another error occurs.
The colors of the sample.svg image are not displayed correctly.
In the different Aspose.Words versions, sometimes more and sometimes less colors are displayed, but I have not found a version in which all colors are displayed correctly.

Regards
Ingo Gutzeit

@gutzeit,

Thanks for the additional information. We have logged this issue with Colors in SVG as WORDSNET-18910. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-18910) have been fixed in this Aspose.Words for Java 21.10 update.

The issues you have found earlier (filed as WORDSNET-18902) have been fixed in this Aspose.Words for Java 21.12 update.