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



我正在尝试使用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.的错误我正在尝试使用iText7.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);

我找不到任何完美的解决方案,但我通过删除不需要的资源更新了我的HTML,这对我很有用。

最新更新