Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用https资源生成pdf(使用飞碟/itext)_Java_Itext_Flying Saucer - Fatal编程技术网

Java 使用https资源生成pdf(使用飞碟/itext)

Java 使用https资源生成pdf(使用飞碟/itext),java,itext,flying-saucer,Java,Itext,Flying Saucer,我想用外部资源(jpg、css)从html创建pdf 以下是用于生成pdf文件对象的代码,其中包含飞碟和itext: ITextRenderer iTextRenderer = new ITextRenderer(); iTextRenderer.setDocumentFromString(xhtmlString); iTextRenderer.layout(); File file = new File("test.pdf"); FileOutputStream os =

我想用外部资源(jpg、css)从html创建pdf

以下是用于生成pdf文件对象的代码,其中包含飞碟和itext:

ITextRenderer iTextRenderer = new ITextRenderer();
iTextRenderer.setDocumentFromString(xhtmlString);
iTextRenderer.layout();

File file = new File("test.pdf");
FileOutputStream os = new FileOutputStream(file);
iTextRenderer.createPDF(os);
os.close();
不幸的是,所有与https链接的资源都被忽略,而http资源工作正常

编辑:

我扩展了iTextureAgent以拦截https调用资源,但出现以下错误:

sun.security.provider.certpath.SunCertPathBuilderException:无法 找到请求目标的有效证书路径

所以我需要有一个证书来获取这些https资源

与我的问题完全相同。

是指向从HTTPS服务器加载数据的java本机方式的链接

现在,您正在使用flyingdiscer的XML解析实现,它在文档中似乎没有引用太多的HTTPS支持。我将使用上述解决方法,然后将DOM直接传递给渲染器