linkedinfacebooktwittermenuarrow-up

GemBox Support Forum

SVG Image background color issue

Hi,
I am using GemBox.Document for creating docx file which contains svg image with base64 background images.
I am facing one issue regarding SVG background image, for example actual svg image background colors are red and white but while generating docx it become black.
mentioning the code for the reference

var paragraph = new Paragraph(document);
var byteArray   = Encoding.UTF8.GetBytes(SvgText);
var imgMemoryStream = new MemoryStream(byteArray);
picture = new Picture(document, imgMemoryStream);
paragraph.Inlines.Add(picture);

please find the screen shot

Thanks,
Nikhil

Hi Nikhil,

Please send us your SVG so that we can reproduce this issue and investigate it.

Regards,
Mario

Hi Mario,

I attached svg file and sent via email.
please check your email.

Thanks,
Nikhil

After some investigation, we concluded that the problem is with Microsoft Word, the same issue can be reproduced when we directly add this SVG into a document using Microsoft Word.

The problem seems to be that Microsoft Word doesn’t support the :not() css selector, it doesn’t render the following:

:not(text).knee-part-checked { fill: #f80202 !important; opacity: 0.6 !important; }

The only suggestion I have is to adjust the SVG to Microsoft Word’s limitations.

Hi Mario,

Thank you for your time and investigation.
As you mentioned I did adjustment on SVG file and its worked.

Regards,
Nikhil