Class PDFResourceResolver

  • All Implemented Interfaces:
    org.apache.xmlgraphics.io.ResourceResolver

    @Component(roles=PDFResourceResolver.class)
    @Singleton
    public class PDFResourceResolver
    extends Object
    implements org.apache.xmlgraphics.io.ResourceResolver
    Resolves URIs sent by Apache FOP to embed images in the exported PDF. The strategy is the following:
    • When an attachment is rendered during the export (specifically when pdf.vm is rendered), the PdfURLFactory is called and it saves the Attachment Entity Reference in a map in the XWiki Context
    • When Apache FOP embeds an image it calls this URI Resolver and we try to locate the Attachment Entity Reference from that map and return the attachment stream.
    • Attachment links do not call the Resolver and are thus exported correctly using a full URL to the XWiki server
    Since:
    7.4M2
    Version:
    $Id: d29c968036b75dd3a9795cef28a1f800593fddda $
    • Constructor Detail

      • PDFResourceResolver

        public PDFResourceResolver()
    • Method Detail

      • getResource

        public org.apache.xmlgraphics.io.Resource getResource​(URI uri)
                                                       throws IOException
        Specified by:
        getResource in interface org.apache.xmlgraphics.io.ResourceResolver
        Throws:
        IOException
      • getOutputStream

        public OutputStream getOutputStream​(URI uri)
                                     throws IOException
        Specified by:
        getOutputStream in interface org.apache.xmlgraphics.io.ResourceResolver
        Throws:
        IOException