ItextSharp support for HTML and CSS

12,000

The HTML parser is a moving target so the best way to figure out what is supported is to view the source. Here's the most recent versions of the HTMLTagProcessors.cs, HtmlTags.cs and StyleSheet.cs.

HtmlTags.cs defines valid HTML and CSS strings. The top part of the file will show you the supported HTML tags, the middle is HTML attributes followed by valid HTML attribute values and finally CSS declarations.

HTMLTagProcessors.cs will show you the processing rules.

StyleSheet.cs will show you how styles sheets are essentially converted to HTML rules. Specifically look at the ResolveStyleAttribute method around line 171.

I don't know why your app crashed upon encountering an <hr /> tag but hopefully you got some debug information that you can trace back to the source.

Share:
12,000
Jonathan
Author by

Jonathan

neverending student ;) https://es.linkedin.com/pub/jonathan-fernández-román/102/944/908

Updated on June 04, 2022

Comments

  • Jonathan
    Jonathan about 2 years

    I'm aware that ItextSharp have some importants limitations about HTML and CSS Parsing.

    I'm looking for some document or post that tell me this limitations, instead of test every posible feature and cross my fingers.

    What CSS styles can i use? How show I do it?

    The same applies to HTML. This morning mi app crash because I was using the <hr /> tag, that seems not to be supported by ItextSharp.

    I've been searching for such document, but I didn't found anything.

    Thanks.