HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › pd4ml https image urls
- This topic has 10 replies, 2 voices, and was last updated Oct 18, 2012
11:17:00 by Anonymous.
-
AuthorPosts
-
August 5, 2010 at 09:50#26434
Hi,
we are using the pd4ml to convert htmls to pdf files and we have got the images located in a url:
https://www.xxx.xxx.com/xxxx/images/xaxis.gifWe are seeing in our logs the following error…
image not yet in cache: https://www.xxx.xxx/ecomp/images/xxxxxx.gif
not yet in cache: https://www.xxx.xxx/ecomp/images/xxxxxxxx.gif
image size: 2733
image not yet in cache: https://www.xxx.xxx/ecomp/images/xxxxx.gif
not yet in cache: https://www.xxx.xxx/ecomp/images/xxxxx.gif
image size: 164
image not yet in cache: https://www.xxx.xxx/product/dlwimages/mail.gif
not yet in cache: https://www.xxx.xxx/product/dlwimages/mail.gif
image size: 248
image not yet in cache: https://www.xxx.xxx/ecomp/images/xaxis.gif
not yet in cache: https://www.xxx.xxx/ecomp/images/yaxis.gif
image size: 155
image size: 43
image not yet in cache: https://www.xxx.xxx/product/dlwimages/printer1.gif
not yet in cache: https://www.xxx.xxx/product/dlwimages/printer1.gif
image not yet in cache: https://www.xxx.xxx/ecomp/images/xxx_print.gif
not yet in cache: https://www.xxx.xxx/ecomp/images/xxx_print.gifIs there any issue with the https urls?
Thanks
ChandraAugust 5, 2010 at 10:14#28157I forgot to say that, the images are getting displayed in the generated PDF file. But the console output says that the image is “not yet in cache”.
What is the reson for this and how to eliminate this in our logs?
August 5, 2010 at 11:45#28158The log messages seems to be confusing.
As long as there is nothing like “cannot load image” in the log – it loads the images and places them to the cache successfully.
You can suppress the output if you switch PD4ML debug mode off.
August 5, 2010 at 12:02#28159Thanks for the reply.
Ya, I commneted “pd4ml.enableDebugInfo();” in my code; And the log is clean.
My question – the images are seen in the PDF but the log says not yet in cache when I enable debugging…?
August 5, 2010 at 12:10#28160It is not a warning, it is not an error. It simply tells that the images are not in cache, so PD4ML loads them from the given URLs and saves to the cache.
You may create a simple HTML with a non-existent image URL and you’ll see how it reports problems with an image loading.
August 5, 2010 at 16:28#28161I have given a non-existent url and I still get that those comments that ‘image not yet in cache’, ‘not yet in cache’.
However, it clearly says that it cannot load the image and the reource/image not found.Log output:
image not yet in cache: https://www.xxx1.com/xxxxxx/dlwimages/mail.gif
not yet in cache: https://www.xxx1.com/xxxxxx/dlwimages/mail.gif
resource https://www.xxx1.com/xxxxxx/dlwimages/mail.gif not found.
image https://www.xxx1.com/xxxxxx/dlwimages/mail.gif not found.
can not load image: /xxxxxx/dlwimages/mail.gif
image not yet in cache: https://www.xxx1.com/xxxxxx/dlwimages/spacer.gif
not yet in cache: https://www.xxx1.com/xxxxxx/dlwimages/spacer.gif
resource https://www.xxx1.com/xxxxxx/dlwimages/spacer.gif not found.
image https://www.xxx1.com/xxxxxx/dlwimages/spacer.gif not found.
can not load image: /xxxxxx/dlwimages/spacer.gifThanks
ChandraAugust 5, 2010 at 17:03#28162I am getting confused by this log output.
If I convert the html for the first tiime, according to your previous reply, PD4ML is just saying that “the image is not yet in cache” and it will load the image. I am not getting the “cannot load the image” error. This is fine. I assume that the image is now loaded into the cache.
But when I run the converter again to convert the same HTML with same images, I am still getting the same output in the log that the image is not in cache… 🙁
This is what my concern is – Whether PD4ML is loading the image and caching it for the first time if I enable the property::::: “pd4ml.cache.enable=true”???
Whether caching is properly getting implemented here???Thanks
ChandraAugust 5, 2010 at 17:09August 6, 2010 at 08:59#28164I am just executing the compiled java class again…
September 19, 2010 at 10:34#28165PD4ML cache is a static hash table with soft references to loaded objects. After JVM is stopped, the cache, of course, disappears. Also a shortage or heap space may cause a cache reset.
I would recommend you to ignore the debug output and to focus on the resulting documents. If there are no missing images and external styles are applied correctly – there are no reasons for a panic.
October 18, 2012 at 11:17#28166Hi,
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,
-
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.