xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Cibulka <pavelcibu...@gmail.com>
Subject FOP 2.0 loading fonts from jar
Date Thu, 02 Jul 2015 10:22:35 GMT
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. :(

Mime
View raw message