I wanted to render image on PDF which is going to generated by FOP. To render image I am using tag <fo:external-graphic>
As below :
<fo:external-graphic src="url('../offlinePaper/displayImage?disImg=4bec89f0-5b97-40c3-b7c9-ac555a664df8')" inline-progression-dimension.maximum="100%" content-height="scale-down-to-fit" content-width="scale-down-to-fit"> </fo:external-graphic>
I also tried by giving full URL as:
<fo:external-graphic src="http://10.2.10.79/Web/offlinePaper/displayImage?disImg=e391d672-ebf4-44d8-86cb-2cf987a50bf7" inline-progression-dimension.maximum="100%" content-height="scale-down-to-fit" content-width="scale-down-to-fit"> </fo:external-graphic>
In controller I am having an request mapping (../offlinePaper/displayImage)
which takes image name disImg
from getParameter
and decrypt the image and return in OutputStream
.
But when I generate PDF I found Error in log file as:
Image not available. URI: http://10.2.10.79:80/Web/offlinePaper/displayImage?disImg=4bec89f0-5b97-40c3-b7c9-ac555a664df8. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for http://10.2.10.79:80/Web/offlinePaper/displayImage?disImg=4bec89f0-5b97-40c3-b7c9-ac555a664df8 (No context info available)
But if I copy this URL and paste in URL then image get shown in browser and I also found that when I generate PDF the request mapping which is suppose to get call for image decryption is not getting called.
Update
Also a strange think I come to know that with same code PDF get successfully generated if web server is Tomcat
but if I deploy application on Glassfish
it's giving error.