Hi,
You can you resource resolver: static class MyResourceResolver implements ResourceResolver { public Resource getResource(URI uri) throws IOException { return new Resource(xxx); } public OutputStream getOutputStream(URI uri) throws IOException { throw new RuntimeException(uri.toString()); } } public static void main(String[] args) throws TransformerException, SAXException, IOException { String fopxconf = "<fop version=\"1.0\"></fop>"; ResourceResolver cloudResourceResolver = new MyResourceResolver(); FopFactoryBuilder confBuilder = new FopConfParser(new ByteArrayInputStream(fopxconf.getBytes()), EnvironmentalProfileFactory.createRestrictedIO(new File(".").toURI(), cloudResourceResolver)).getFopFactoryBuilder(); FopFactory fopFactory = confBuilder.build(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); FileOutputStream fos = new FileOutputStream("out.png"); Fop fop = fopFactory.newFop("image/png", foUserAgent, fos); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes())); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); fos.close(); } Thanks From: Pavel Cibulka [mailto:pavelcibu...@gmail.com] Sent: 02 July 2015 11:23 To: fop-users@xmlgraphics.apache.org Subject: FOP 2.0 loading fonts from jar How can I load fonts from .jar in FOP 2.0? In 1.1 it was possible though URI resolver: public final class FopClasspathUriResolver extends FOURIResolver implements URIResolver { @Override public Source resolve(String href, String base) throws TransformerException { InputStream inputStream = FopClasspathUriResolver.class.getClassLoader().getResourceAsStream(href); if (inputStream != null) { return new StreamSource(inputStream); } return super.resolve(href, base); } } FopFactory fopFactory = FopFactory.newInstance(); FOURIResolver uriResolver = (FOURIResolver) fopFactory.getURIResolver(); uriResolver.setCustomURIResolver(new FopClasspathUriResolver()); In https://xmlgraphics.apache.org/fop/2.0/servlets.html#uriresolver Accessing resources in your web application this.fopFactory.setURIResolver(this.uriResolver); - Function setURIResolver is not in 2.0. - Also in 1.1 this was possible without Servlets API. I would be grateful for any help. Working with 2.0 has been really frustrating experience so far for me. :(