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

Free Support Forum - aspose.com

SVG Rendering issue to word format

Hi,
We too are facing SVG rendering issue while DocumentBuilder.insertImage(byte[] imageDataArray).
I have update Aspose.words to 18.2 but still facing the same issue.
Find the attached SVG data which i converted to byte array and passed to insertImage() of Document builder.

Getting the below error:-
Caused by: java.lang.IllegalArgumentException: Parameter is not valid. FileFormat=0
at asposewobfuscated.zzYD.(Unknown Source)
at asposewobfuscated.zzYD.(Unknown Source)
at com.aspose.words.zzZOA.zzZk(Unknown Source)
at com.aspose.words.zzZOA.zzn(Unknown Source)svgData.zip (2.9 KB)

at com.aspose.words.zzZOA.setImageBytes(Unknown Source)
at com.aspose.words.ImageData.setImageBytes(Unknown Source)
at com.aspose.words.DocumentBuilder.insertImage(Unknown Source)
at com.aspose.words.DocumentBuilder.insertImage(Unknown Source)
at com.aspose.words.DocumentBuilder.insertImage(Unknown Source)

@joychak

Thanks for your inquiry. Perhaps, you are not using the SVG string correctly in your code. Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing. Thanks for your cooperation.

Hi,

Please find the attached simple Java application without any errors( as requested). Its giving the same error.

The XML formed is correct, attaching XML . Let us know if we are missing on something.SVG Test.zip (15.7 KB)
svgData.zip (1.6 KB)

Let me know if any other information is needed, this is urgent to us. Early response would be highly appreciated.

Thanks,
Joydeep

@joychak

Thanks for sharing the detail. You are facing this issue due to decodeBase64 method. Please use the following code snippet to insert SVG string into document.

byte[] imageByteArray;

String imageData="<svg .....";
imageByteArray = imageData.getBytes();

shape = builder.insertImage(imageByteArray);