Package org.opencms.pdftools
Class CmsPdfUserAgent
java.lang.Object
org.xhtmlrenderer.swing.NaiveUserAgent
org.opencms.pdftools.CmsPdfUserAgent
- All Implemented Interfaces:
org.xhtmlrenderer.event.DocumentListener
,org.xhtmlrenderer.extend.UserAgentCallback
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
Modifier and TypeFieldDescriptionstatic final Pattern
The regex to match image scaler parameters.Fields inherited from class org.xhtmlrenderer.swing.NaiveUserAgent
_imageCache
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getBinaryResource
(String uri) org.xhtmlrenderer.resource.CSSResource
getCSSResource
(String uri) org.xhtmlrenderer.resource.ImageResource
getImageResource
(String uri) org.xhtmlrenderer.layout.SharedContext
Gets the shared context.resolveURI
(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
-
Field Details
-
SCALE_PARAMS_PATTERN
The regex to match image scaler parameters.
-
-
Constructor Details
-
CmsPdfUserAgent
Creates a new instance.- Parameters:
cms
- the CMS context- Throws:
CmsException
- if something goes wrong
-
-
Method Details
-
getBinaryResource
- Specified by:
getBinaryResource
in interfaceorg.xhtmlrenderer.extend.UserAgentCallback
- Overrides:
getBinaryResource
in classorg.xhtmlrenderer.swing.NaiveUserAgent
- See Also:
-
NaiveUserAgent.getBinaryResource(java.lang.String)
-
getCSSResource
- Specified by:
getCSSResource
in interfaceorg.xhtmlrenderer.extend.UserAgentCallback
- Overrides:
getCSSResource
in classorg.xhtmlrenderer.swing.NaiveUserAgent
- See Also:
-
NaiveUserAgent.getCSSResource(java.lang.String)
-
getImageResource
- Specified by:
getImageResource
in interfaceorg.xhtmlrenderer.extend.UserAgentCallback
- Overrides:
getImageResource
in classorg.xhtmlrenderer.swing.NaiveUserAgent
- See Also:
-
NaiveUserAgent.getImageResource(java.lang.String)
-
resolveURI
- Specified by:
resolveURI
in interfaceorg.xhtmlrenderer.extend.UserAgentCallback
- Overrides:
resolveURI
in classorg.xhtmlrenderer.swing.NaiveUserAgent
- See Also:
-
NaiveUserAgent.resolveURI(java.lang.String)
-