facebooktwittermenuarrow-up

GemBox Support Forum

How much CSS does Gembox.Document support?

I am trying to convert an HTML document to PDF, but it completely ignores css rules like border-radius: 50%;

What level of CSS does the library support?
What HTML rendering engine is it using?
Is there a document somewhere that documents what is and isn’t supported?

Hi Robert,

Note that each document that is loaded with GemBox.Document is represented with DocumentModel object, that is its in-memory representation of the document’s content.

So, when loading an HTML file or any other file of supported input format, GemBox.Document will represent it with a DocumentModel object. This object’s structure resembles the best DOCX file’s structure, see the content model hierarchy:
https://www.gemboxsoftware.com/document/docs/content-model.html

So in a way you can think of this as if GemBox.Document is converting HTML to DOCX when loading it (not actually, but for simplicity let’s say that’s the case) and the problem here is that rounded corners on Table elements do not exist in Word files and thus there is no representation for it.

Regarding the CSS, at the moment we don’t have a document that lists all the supported options.
But in short, note that absolute positioning, changing display, and specifying size of block-level elements are not supported.

For the rest, we try to handle as much as possible, whatever can be translated to Word in a meaningful way. To get the most accurate PDF conversion, you should provide printer‑friendly HTML pages to GemBox.Document. In other words, your website’s content and structure should ideally be optimized for print.

I hope this helps.

Regards,
Mario