我正在尝试使用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.9
maven依赖项将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,这对我来说很有效。