I want to create a pdf from html with external resources (jpg, css).
Here is the code used to generated the pdf File object, with Flying Saucer and 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();
Unfortunatly, all the resources linked with https are ignored, while http resources work well.
EDIT :
I extended ITextUserAgent to intercept the https call resources, and I got this error :
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
So I need to have a certificate to get those https resources.
Here is exactly the same problem than me.
Here is a link to a java-native way of loading data from HTTPS servers.
Right now, you're using Flying Saucer's implementation of XML parsing, which doesn't seem to reference much HTTPS support in its documentation. I would use the above workaround, and then pass the DOM to the Renderer directly.