HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › pd4ml https image urls › Re: Re: pd4ml https image urls
Hi,
I’m having the same issue here and I’m not restarting the JVM.
Code is very simple, maybe cache is not reused if different PD4ML objects are created?
public static void convert(String html, ByteArrayOutputStream baos, ServletContext servletContext, String baseUrl)
throws InvalidParameterException, IOException {
try {
if (html != null && html.length() > 0) {
PD4ML pd4ml = new PD4ML();
pd4ml.enableDebugInfo();
pd4ml.setPageSize(LANDSCAPE_VALUE ? pd4ml.changePageOrientation(FORMAT) : FORMAT);
if (“mm”.equals(UNITS_VALUE)) {
pd4ml.setPageInsetsMM(new Insets(TOP_VALUE, LEFT_VALUE, BOTTOM_VALUE, RIGHT_VALUE));
} else {
pd4ml.setPageInsets(new Insets(TOP_VALUE, LEFT_VALUE, BOTTOM_VALUE, RIGHT_VALUE));
}
pd4ml.setHtmlWidth(USER_SPACE_WIDTH);
pd4ml.render(new StringReader(html), baos, new java.net.URL(baseUrl));
}
} catch (InvalidParameterException e) {
logger.error(“Error rendering PDF”, e);
} catch (IOException e) {
logger.error(“Error rendering PDF”, e);
}
}
Thanks,