Note that there are some explanatory texts on larger screens.

plurals
  1. POfop in glassfish fail to render external resources
    text
    copied!<p>I am generating a PDF file via fop 1.0 out of a java library. The unit tests are running fine and the PDF is rendered as expected, including an external graphic:</p> <pre><code>&lt;fo:external-graphic content-width="20mm" src="url('images/image.png')" /&gt; </code></pre> <p>If I render this within a Java EE application in glassfish 3.1, I always get the following error:</p> <pre><code>Image not found. URI: images/image.png. (No context info available) </code></pre> <p>I double-checked whether the image is available. It is available within the .jar file in the .ear file and should therfore be available by the ClasspathUriResolver. This is a code-snipplet of how I setup the fop-factory:</p> <pre><code>FopFactory fopFactory = FopFactory.newInstance(); URIResolver uriResolver = new ClasspathUriResolver(); fopFactory.setURIResolver(uriResolver); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); ... </code></pre> <p>I also assigned the URI resolver to the TransformerFactory and the Transformer with no success. Would be great if someone can help me out. </p> <p>-- Wintermute</p> <p>Btw: the ClasspathUriResolver() looks like this</p> <pre><code>public class ClasspathUriResolver implements URIResolver { @Override public Source resolve(String href, String base) throws TransformerException { Source source = null; InputStream inputStream = ClassLoader.getSystemResourceAsStream(href); if (inputStream != null) { source = new StreamSource(inputStream); } return source; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload