Warm tip: This article is reproduced from serverfault.com, please click

java-iText pdf转换中CSS不支持的关键问题

(java - CSS unsupported key issue in iText pdf conversion)

发布于 2020-12-04 08:55:07

我正在尝试使用Java中的iText创建pdf文件。我的HTML包含CSS bootsrap版本v4.3.1在转换期间,我遇到这样的错误,ERROR c.i.s.c.p.s.CssParserStateController - The rule @-webkit-keyframes is unsupported. All selectors in this rule will be ignored. 我正在尝试使用iText 7.1.9maven依赖项将Java HTML转换为pdf 如何避免这些错误或包含此CSS标记?由于它是从引导程序加载的,因此我无法更改它。我的代码:

ConverterProperties props = new ConverterProperties();
props.setMediaDeviceDescription(new MediaDeviceDescription(MediaType.PRINT));
props.setCssApplierFactory(new DefaultCssApplierFactory());
HtmlConverter.convertToPdf("input.html", new FileOutputStream("output.pdf"), props);
Questioner
Sonu
Viewed
22
Sonu 2021-03-06 16:44:51

我找不到上述解决方案的完美解决方案,但是我通过删除不需要的资源来更新了HTML,这对我来说很有效。