HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › Images cannot be loaded
- This topic has 4 replies, 2 voices, and was last updated Jul 02, 2009
11:19:09 byatih.
-
AuthorPosts
-
July 1, 2009 at 12:14#26217
Hi,
Everytime my HTML source code contains an image I get the following error:
image not yet in cache: file:../images/barrreMenu_bleu.jpg
not yet in cache: file:../images/barrreMenu_bleu.jpg
..imagesbarrreMenu_bleu.jpg (Le chemin d’accès spécifié est introuvable)
image file:../images/barrreMenu_bleu.jpg has zero length.
can not load image: ../images/barrreMenu_bleu.jpg“barrreMenu_bleu.jpg” is the name of my image file. It’s a static image. I’ve same problem for every images.
I’ve same problem with dynamical image cretaed by JFreeChart.
Can you help me please ?
July 2, 2009 at 08:16#27350Obviously PD4ML has no info about URL base of the document and it cannot resolve the relative path to an absolute one.
A possible reason – you render the HTML to PDF with
[language=java:3s3k01xg]render(java.io.StringReader isr, java.io.OutputStream os)[/language:3s3k01xg]
and the document has notag. A solution is to use
[language=java:3s3k01xg]render(java.io.StringReader isr, java.io.OutputStream os, java.net.URL base)[/language:3s3k01xg]
instead.
If the explanation does not match your PD4ML usage scenario, please provide more info.
July 2, 2009 at 09:53#27351Thank you for your response.
I can now load all my statics images, but I can’t load dynamical images created by JFreeChart.
I include those images in my JSP by a call to the DisplayChart servlet provided by the JFreechart library. The syntax of this call is :
request.getContextPath() + “/servlet/DisplayChart?filename=” + filename
thanks for your help
July 2, 2009 at 10:26#27352In that case PD4ML cannot resolve the web app context (request.getContextPath()) to anything “loadable” – to an absolute path or full URL.
Try to pass servet context to PD4ML – it should help to load the dynamic resource:
[language=java:lrhox354]useServletContext(ServletContext ctx)[/language:lrhox354]
July 2, 2009 at 11:19#27353Thanks.
I’ve already added this piece of code.
But I’ve found the problem: it comes from the DisplayChart code of JFreechart.
It needs some little changes to work with pd4ml.Since I find this, my company (service from french government) can buy a licence of your product.
regards,
-
AuthorPosts
The forum ‘Troubleshooting’ is closed to new topics and replies.
