Class CmsPdfUserAgent

  • All Implemented Interfaces:
    org.xhtmlrenderer.event.DocumentListener, org.xhtmlrenderer.extend.UserAgentCallback

    public class CmsPdfUserAgent
    extends org.xhtmlrenderer.swing.NaiveUserAgent
    This class is responsible for loading external resources while generating PDF from XHTML. Resources will be loaded from the VFS. Additionally, if there are image scaler parameters in an image URI, the scaled image data will be returned. Please note that this class just reads the data from the linked resources; it will not go through OpenCms's resource loaders, so you can't e.g. use a JSP as a dynamic stylesheet.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern SCALE_PARAMS_PATTERN
      The regex to match image scaler parameters.
      • Fields inherited from class org.xhtmlrenderer.swing.NaiveUserAgent

        _imageCache
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBinaryResource​(java.lang.String uri)  
      org.xhtmlrenderer.resource.CSSResource getCSSResource​(java.lang.String uri)  
      org.xhtmlrenderer.resource.ImageResource getImageResource​(java.lang.String uri)  
      org.xhtmlrenderer.layout.SharedContext getSharedContext()
      Gets the shared context.
      java.lang.String resolveURI​(java.lang.String uri)  
      void setSharedContext​(org.xhtmlrenderer.layout.SharedContext sharedContext)
      Sets the shared context.
      • Methods inherited from class org.xhtmlrenderer.swing.NaiveUserAgent

        clearImageCache, createImageResource, documentLoaded, documentStarted, getBaseURL, getXMLResource, isVisited, needsRedirect, onHttpConnection, onLayoutException, onRenderException, openConnection, openStream, resolveAndOpenStream, setBaseURL, shrinkImageCache
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SCALE_PARAMS_PATTERN

        public static final java.util.regex.Pattern SCALE_PARAMS_PATTERN
        The regex to match image scaler parameters.
    • Method Detail

      • getBinaryResource

        public byte[] getBinaryResource​(java.lang.String uri)
        Specified by:
        getBinaryResource in interface org.xhtmlrenderer.extend.UserAgentCallback
        Overrides:
        getBinaryResource in class org.xhtmlrenderer.swing.NaiveUserAgent
        See Also:
        NaiveUserAgent.getBinaryResource(java.lang.String)
      • getCSSResource

        public org.xhtmlrenderer.resource.CSSResource getCSSResource​(java.lang.String uri)
        Specified by:
        getCSSResource in interface org.xhtmlrenderer.extend.UserAgentCallback
        Overrides:
        getCSSResource in class org.xhtmlrenderer.swing.NaiveUserAgent
        See Also:
        NaiveUserAgent.getCSSResource(java.lang.String)
      • getImageResource

        public org.xhtmlrenderer.resource.ImageResource getImageResource​(java.lang.String uri)
        Specified by:
        getImageResource in interface org.xhtmlrenderer.extend.UserAgentCallback
        Overrides:
        getImageResource in class org.xhtmlrenderer.swing.NaiveUserAgent
        See Also:
        NaiveUserAgent.getImageResource(java.lang.String)
      • getSharedContext

        public org.xhtmlrenderer.layout.SharedContext getSharedContext()
        Gets the shared context.

        Returns:
        the shared context
      • resolveURI

        public java.lang.String resolveURI​(java.lang.String uri)
        Specified by:
        resolveURI in interface org.xhtmlrenderer.extend.UserAgentCallback
        Overrides:
        resolveURI in class org.xhtmlrenderer.swing.NaiveUserAgent
        See Also:
        NaiveUserAgent.resolveURI(java.lang.String)
      • setSharedContext

        public void setSharedContext​(org.xhtmlrenderer.layout.SharedContext sharedContext)
        Sets the shared context.

        Parameters:
        sharedContext - the shared context