Skip to main content facebooktwittermenuarrow-up

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

49

Support internal and external CSS in HTML Completed

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

Official response

Mario at GemBox

Hi,

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

Regards,
Mario

Comments (9)

Mario at GemBox
Hi,

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

Regards,
Mario
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 at 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 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
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
Wagner Christoph
Hi
Do you have an example how to use this feature in the latest version of GemBox.Document?
Thanks.

Regards
Chris
Mario at 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
jadhav
It is possible to adding extenal css file or load all css at a time int to DocumentModel.
Mario at 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