简体   繁体   中英

ItextSharp support for HTML and CSS

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM