Flying-saucer 忽略大写的 css 标识符
我最近开始使用 Flying-saucer 库从 html 网页生成 pdf。一切正常,只是 CSS 规则(与下面的规则类似)被忽略了。
TD.standardActiv
{
FONT-SIZE: 10pt;
COLOR: #1a467a;
FONT-FAMILY: Arial;
BACKGROUND-COLOR: #6f9bce;
}
如果我将“TD”更改为“td”,则一切正常。有谁知道如何解决这个问题?我考虑过替换所有大写标识符,但这是一个丑陋的解决方案,因为需要更新的 css 文件数量很大。
I recently start using flying-saucer library to generate a pdf from html web page. Everything works fine, except that the CSS rules, that look similar with the one below, are ignored.
TD.standardActiv
{
FONT-SIZE: 10pt;
COLOR: #1a467a;
FONT-FAMILY: Arial;
BACKGROUND-COLOR: #6f9bce;
}
If I change the 'TD' to 'td', everything is working properly. Does anyone know how to solve this? I thought about replacing all upper case identifiers, but it's an ugly solution, because of the amount of css files that should be updated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有三个选择:
第三点是微不足道的,但可能行不通。第 1 种可能不太实用,我对飞碟不太熟悉。
我是#2 的忠实粉丝。您可能需要修改 iText 的 com.itextpdf/lowagie.text.html.simpleparsers.StyleSheet 类的源代码。主干已经将标签更改为小写,所以我猜#3 可能就是您所需要的。
You have three options:
Number 3 is trivial, but may not work. Number 1 may not be practical, I'm not that familiar with Flying Saucer.
I'm a big fan of #2. You'll probably have to modify the source to iText's
com.itextpdf/lowagie.text.html.simpleparsers.StyleSheet
class. The trunk already changes the tags to lower case, so I'm guessing #3 just might be all you need.