developer
developer

Reputation: 1673

FOP fails to load image from url

I have a web api which returns an image. I am trying to integrate this to my FO template.

<fo:block font-weight="normal" text-align="left">
     <fo:external-graphic src="url({$URL})">
     </fo:external-graphic>
</fo:block>

where $URL is "http://{servername}/images/{id}".

I am getting the following error:

HTTP Status 500 – Internal Server Error Type Exception Report

Message Servlet execution threw an exception

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) Root Cause

java.lang.NoClassDefFoundError: com/sun/media/jai/codec/FileCacheSeekableStream

I am able to access the image directly using http://{servername}/images/{id} url so the url is correct.

Upvotes: 1

Views: 1010

Answers (1)

developer
developer

Reputation: 1673

The root cause was FOP was not able to load PNG image for PDF file. It worked fine with JPEG/BMP/GIF.

https://xmlgraphics.apache.org/fop/2.0/graphics.html

Upvotes: 2

Related Questions