ItextSharp支持HTML和CSS [英] ItextSharp support for HTML and CSS

查看:155
本文介绍了ItextSharp支持HTML和CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道ItextSharp对HTML和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.

我可以使用哪些CSS样式?怎么显示我这样做?

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

这同样适用于HTML。今天早上mi应用程序崩溃,因为我使用的是< hr /> 标记,ItextSharp似乎不支持。

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.

谢谢。

推荐答案

HTML解析器是一个移动目标,因此找出所支持内容的最佳方法是查看源。这是 HTMLTagProcessors.cs HtmlTags.cs StyleSheet.cs

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 定义有效的HTML和CSS字符串。文件的顶部将显示支持的HTML标记,中间是HTML属性,后跟有效的HTML属性值,最后是CSS声明。

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 将显示处理规则。

StyleSheet.cs 将向您展示样式表如何实质上转换为HTML规则。具体来看第171行的 ResolveStyleAttribute 方法。

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

我不知道为什么你的应用程序在遇到一个崩溃时崩溃了< hr /> 标记,但希望您获得一些可以追溯到源的调试信息。

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.

这篇关于ItextSharp支持HTML和CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆