Skip to main content

Support internal and external CSS in HTML - Community / GemBox.Document Feature Request - GemBox Support Center

I am looking for feature in GemBox document dll which could support the css inline and external both and the output in pdf should look exactly as in the html

Comments (10)

Mario - GemBox
Hi,

GemBox.Document currently only supports inline styling (style attribute in HTML elements).
This feature request is for adding a support for internal styling ([style] tags) and external styling (external CSS files).

Regards,

Mario
GemBox d.o.o.
Sunilkumar
I am eagerly waiting for this feature as it is very much mandatory for my existing project. Please incorporate this in your upcoming version as soon as possible.
Scott Percy
Is there any update on this? I'm interested in it for a project that is going live in a few weeks. I wasn't aware that GemBox would ignore CSS styling when we selected the product.
Mario - GemBox
Hi,

This will be implemented sometime in the future, but unfortunately it is not in our current roadmap.
However as a workaround for now you could convert the internal and external CSS into an inline styling.
There are some available .NET utility libraries that can achieve this conversion:
https://stackoverflow.com/questions/5066667/net-convert-external-css-to-inline-css
I hope this helps.

Regards,

Mario
GemBox d.o.o.
Andy An
I am eagerly waiting for this feature as it is very much mandatory for my existing project. Please incorporate this in your upcoming version as soon as possible.

As I am using it to save a html document to docx and pdf.


Andy AN
Jabil Circuit
Mario - GemBox
Hi,

This feature request has been implemented and is available in latest versions of GemBox.Document.


Regards,

Mario
GemBox Ltd.
Wagner Christoph
Hi
Do you have an example how to use this feature in the latest version of GemBox.Document?
Thanks.

Regards
Chris
Mario - GemBox
Hi,

The CSS is supported by default, in other words there is no option that you need to set to enable this.
By using the "DocumentModel.Load(string, HtmlLoadOptions)" method GemBox.Document will read the HTML content and any linked CSS content.
I hope this helps.

Regards,

Mario
GemBox d.o.o.
jadhav
It is possible to adding extenal css file or load all css at a time int to DocumentModel.
Mario - GemBox
Hi,

Yes, this is done by default.
All linked CSS files (e.g. "[link href="style.css" rel="stylesheet"]") are loaded when loading HTML file.

Regards,

Mario
GemBox d.o.o.