Flying-saucer ignores upper case css identifiers
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 sol开发者_开发技巧ve 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.
You have three options:
- Download all the CSS's yourself and run them through some case converter code
- The Powah of Open Source: Change the underlying code to be case insensitive.
- Update to a newer version of FS/iText. This may have already been fixed.
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.
精彩评论