Package org.apache.fop.apps
Class FOUserAgent
java.lang.Object
org.apache.fop.apps.FOUserAgent
This is the user agent for FOP.
It is the entity through which you can interact with the XSL-FO processing and is
used by the processing to obtain user configurable options.
Renderer specific extensions (that do not produce normal areas on
the output) will be done like so:
The extension will create an area, custom if necessary
this area will be added to the user agent with a key
the renderer will know keys for particular extensions
eg. bookmarks will be held in a special hierarchical area representing
the title and bookmark structure
These areas may contain resolvable areas that will be processed
with other resolvable areas
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringAuthor of the content of the document.protected DateCreation Date: Override of the date the document was created.protected StringCreator: Metadata element for the user that created the document.protected StringSet of keywords applicable to this document.protected StringProducer: Metadata element for the system/software that produces the document.protected StringSubject of the document.protected StringTitle of the document. -
Method Summary
Modifier and TypeMethodDescriptionReturns the author of the documentReturns the creation date of the documentReturns the creator of the documentReturns the overridingIFDocumentHandlerinstance, if any.EventBroadcasterReturns the event broadcaster that control events sent inside a processing run.Returns the overriding FOEventHandler instance, if any.org.apache.xmlgraphics.image.loader.ImageManagerorg.apache.xmlgraphics.image.loader.ImageSessionContextReturns the image session context for the image package.Returns the keywords for the documentGets the output File.Gets the default page-height to use as fallback, in case page-height="auto"Gets the default page-width to use as fallback, in case page-width="auto"org.apache.xmlgraphics.image.loader.util.SoftMapCacheReturns the producer of the documentgetRendererConfig(String mimeType, RendererConfig.RendererConfigParser configCreator) Returns the renderer configuration object for a particular MIME type.getRendererConfiguration(String mimeType) Returns aConfigurationobject for which contains renderer configuration for a given MIME type.Gets the renderer options given an interface representing renderer configuration options.Returns the renderer optionsReturns the overriding Renderer instance, if any.Returns the resource resolver.floatReturns the conversion factor from pixel units to millimeters.floatReturns the document's structure tree event handler, for use by accessible output formats.Returns the subject of the documentfloatReturns the conversion factor from pixel units to millimeters.floatgetTitle()Returns the title of the documentGet the user configuration.booleanCheck if accessibility is enabled.booleanbooleanCheck whether complex script features are enabled.booleanCheck whether memory-conservation is enabled.booleanbooleanbooleanbooleanChecks if the use of Locators is enabledbooleanisNamespaceIgnored(String namespaceURI) Indicates whether a namespace URI is on the ignored list.booleanbooleanbooleanbooleanReturns a newFopinstance.newFop(String outputFormat, OutputStream stream) Returns a newFopinstance.resolveURI(String uri) Attempts to resolve the given URI.voidsetAccessibility(boolean accessibility) Activates accessibility (for output formats that support it).voidSets the author of the document.voidsetConserveMemoryPolicy(boolean conserveMemoryPolicy) Control whether memory-conservation should be enabledvoidsetCreationDate(Date creationDate) Sets the creation date of the document.voidsetCreator(String creator) Sets the creator of the document.voidsetDocumentHandlerOverride(IFDocumentHandler documentHandler) Sets an explicit document handler to use which overrides the one that would be selected by default.voidsetFOEventHandlerOverride(FOEventHandler handler) Sets an explicit FOEventHandler instance which overrides the one defined by the render type setting.voidsetKeepEmptyTags(boolean b) voidsetKeywords(String keywords) Sets the keywords for the document.voidsetLocatorEnabled(boolean enableLocator) Controls the use of SAXLocators to provide location information in error messages.voidSets the output File.voidsetPdfUAEnabled(boolean pdfUAEnabled) voidsetProducer(String producer) Sets the producer of the document.voidsetRendererOverride(Renderer renderer) Sets an explicit renderer to use which overrides the one defined by the render type setting.voidsetStructureTreeEventHandler(StructureTreeEventHandler structureTreeEventHandler) Sets the document's structure tree event handler, for use by accessible output formats.voidsetSubject(String subject) Sets the subject of the document.voidsetTargetResolution(float dpi) Sets the target resolution in dpi.voidsetTargetResolution(int dpi) Sets the target resolution in dpi.voidSets the title of the document.booleanReturns whether FOP is strictly validating input XSLbooleanIs the user configuration to be validated?
-
Field Details
-
producer
Producer: Metadata element for the system/software that produces the document. (Some renderers can store this in the document.) -
creator
Creator: Metadata element for the user that created the document. (Some renderers can store this in the document.) -
creationDate
Creation Date: Override of the date the document was created. (Some renderers can store this in the document.) -
author
Author of the content of the document. -
title
Title of the document. -
subject
Subject of the document. -
keywords
Set of keywords applicable to this document.
-
-
Method Details
-
newFop
Returns a newFopinstance. Use this factory method if your output type requires an output stream and you want to configure this very rendering run, i.e. if you want to set some metadata like the title and author of the document you want to render. In that case, create a newFOUserAgentinstance usingnewFOUserAgent().MIME types are used to select the output format (ex. "application/pdf" for PDF). You can use the constants defined in
MimeConstants.- Parameters:
outputFormat- the MIME type of the output format to use (ex. "application/pdf").stream- the output stream- Returns:
- the new Fop instance
- Throws:
FOPException- when the constructor fails
-
newFop
Returns a newFopinstance. Use this factory method if you want to configure this very rendering run, i.e. if you want to set some metadata like the title and author of the document you want to render. In that case, create a newFOUserAgentinstance usingnewFOUserAgent().MIME types are used to select the output format (ex. "application/pdf" for PDF). You can use the constants defined in
MimeConstants.- Parameters:
outputFormat- the MIME type of the output format to use (ex. "application/pdf").- Returns:
- the new Fop instance
- Throws:
FOPException- when the constructor fails
-
getResourceResolver
Returns the resource resolver.- Returns:
- the resource resolver
-
setDocumentHandlerOverride
Sets an explicit document handler to use which overrides the one that would be selected by default.- Parameters:
documentHandler- the document handler instance to use
-
getDocumentHandlerOverride
Returns the overridingIFDocumentHandlerinstance, if any.- Returns:
- the overriding document handler or null
-
setRendererOverride
Sets an explicit renderer to use which overrides the one defined by the render type setting.- Parameters:
renderer- the Renderer instance to use
-
getRendererOverride
Returns the overriding Renderer instance, if any.- Returns:
- the overriding Renderer or null
-
setFOEventHandlerOverride
Sets an explicit FOEventHandler instance which overrides the one defined by the render type setting.- Parameters:
handler- the FOEventHandler instance
-
getFOEventHandlerOverride
Returns the overriding FOEventHandler instance, if any.- Returns:
- the overriding FOEventHandler or null
-
setProducer
Sets the producer of the document.- Parameters:
producer- source of document
-
getProducer
Returns the producer of the document- Returns:
- producer name
-
setCreator
Sets the creator of the document.- Parameters:
creator- of document
-
getCreator
Returns the creator of the document- Returns:
- creator name
-
setCreationDate
Sets the creation date of the document.- Parameters:
creationDate- date of document
-
getCreationDate
Returns the creation date of the document- Returns:
- creation date of document
-
setAuthor
Sets the author of the document.- Parameters:
author- of document
-
getAuthor
Returns the author of the document- Returns:
- author name
-
setTitle
Sets the title of the document. This will override any title coming from an fo:title element.- Parameters:
title- of document
-
getTitle
Returns the title of the document- Returns:
- title name
-
setSubject
Sets the subject of the document.- Parameters:
subject- of document
-
getSubject
Returns the subject of the document- Returns:
- the subject
-
setKeywords
Sets the keywords for the document.- Parameters:
keywords- for the document
-
getKeywords
Returns the keywords for the document- Returns:
- the keywords
-
getRendererOptions
Returns the renderer options- Returns:
- renderer options
-
getRendererOption
Gets the renderer options given an interface representing renderer configuration options.- Parameters:
option- the renderer option- Returns:
- the value
-
resolveURI
Attempts to resolve the given URI. Will use the configured resolver and if not successful fall back to the default resolver.- Parameters:
uri- URI to access- Returns:
- A
Sourceobject, or null if the URI cannot be resolved.
-
setOutputFile
Sets the output File.- Parameters:
f- the output File
-
getOutputFile
Gets the output File.- Returns:
- the output File
-
getTargetPixelUnitToMillimeter
public float getTargetPixelUnitToMillimeter()Returns the conversion factor from pixel units to millimeters. This depends on the desired target resolution.- Returns:
- float conversion factor
- See Also:
-
getTargetResolution
public float getTargetResolution()- Returns:
- the resolution for resolution-dependant output
-
setTargetResolution
public void setTargetResolution(float dpi) Sets the target resolution in dpi. This value defines the target resolution of bitmap images generated by the bitmap renderers (such as the TIFF renderer) and of bitmap images generated by filter effects in Apache Batik.- Parameters:
dpi- resolution in dpi
-
setTargetResolution
public void setTargetResolution(int dpi) Sets the target resolution in dpi. This value defines the target resolution of bitmap images generated by the bitmap renderers (such as the TIFF renderer) and of bitmap images generated by filter effects in Apache Batik.- Parameters:
dpi- resolution in dpi
-
getImageSessionContext
public org.apache.xmlgraphics.image.loader.ImageSessionContext getImageSessionContext()Returns the image session context for the image package.- Returns:
- the ImageSessionContext instance for this rendering run
-
getSourcePixelUnitToMillimeter
public float getSourcePixelUnitToMillimeter()Returns the conversion factor from pixel units to millimeters. This depends on the desired source resolution.- Returns:
- float conversion factor
- See Also:
-
getSourceResolution
public float getSourceResolution()- Returns:
- the resolution for resolution-dependant input
-
getPageHeight
Gets the default page-height to use as fallback, in case page-height="auto"- Returns:
- the page-height, as a String
- See Also:
-
getPageWidth
Gets the default page-width to use as fallback, in case page-width="auto"- Returns:
- the page-width, as a String
- See Also:
-
validateStrictly
public boolean validateStrictly()Returns whether FOP is strictly validating input XSL- Returns:
- true of strict validation turned on, false otherwise
- See Also:
-
isBreakIndentInheritanceOnReferenceAreaBoundary
public boolean isBreakIndentInheritanceOnReferenceAreaBoundary()- Returns:
- true if the indent inheritance should be broken when crossing reference area boundaries (for more info, see the javadoc for the relative member variable)
- See Also:
-
getRendererFactory
- Returns:
- the RendererFactory
-
getXMLHandlerRegistry
- Returns:
- the XML handler registry
-
setLocatorEnabled
public void setLocatorEnabled(boolean enableLocator) Controls the use of SAXLocators to provide location information in error messages.- Parameters:
enableLocator-falseif SAX Locators should be disabled
-
isLocatorEnabled
public boolean isLocatorEnabled()Checks if the use of Locators is enabled- Returns:
- true if context information should be stored on each node in the FO tree.
-
getEventBroadcaster
public EventBroadcaster getEventBroadcaster()Returns the event broadcaster that control events sent inside a processing run. Clients can register event listeners with the event broadcaster to listen for events that occur while a document is being processed.- Returns:
- the event broadcaster.
-
isPdfUAEnabled
public boolean isPdfUAEnabled() -
setPdfUAEnabled
public void setPdfUAEnabled(boolean pdfUAEnabled) -
isConserveMemoryPolicyEnabled
public boolean isConserveMemoryPolicyEnabled()Check whether memory-conservation is enabled.- Returns:
- true if FOP is to conserve as much as possible
-
setConserveMemoryPolicy
public void setConserveMemoryPolicy(boolean conserveMemoryPolicy) Control whether memory-conservation should be enabled- Parameters:
conserveMemoryPolicy- the cachingEnabled to set
-
isComplexScriptFeaturesEnabled
public boolean isComplexScriptFeaturesEnabled()Check whether complex script features are enabled.- Returns:
- true if FOP is to use complex script features
-
getRendererConfig
public RendererConfig getRendererConfig(String mimeType, RendererConfig.RendererConfigParser configCreator) throws FOPException Returns the renderer configuration object for a particular MIME type.- Parameters:
mimeType- the config MIME typeconfigCreator- the parser for creating the config for the first run of parsing.- Returns:
- the renderer configuration object
- Throws:
FOPException- if an error occurs when creating the config object
-
getRendererConfiguration
Returns aConfigurationobject for which contains renderer configuration for a given MIME type.- Parameters:
mimeType- the renderer configuration MIME type- Returns:
- the configuration object
-
setAccessibility
public void setAccessibility(boolean accessibility) Activates accessibility (for output formats that support it).- Parameters:
accessibility-trueto enable accessibility support
-
isAccessibilityEnabled
public boolean isAccessibilityEnabled()Check if accessibility is enabled.- Returns:
- true if accessibility is enabled
-
setStructureTreeEventHandler
Sets the document's structure tree event handler, for use by accessible output formats.- Parameters:
structureTreeEventHandler- The structure tree event handler to set
-
getStructureTreeEventHandler
Returns the document's structure tree event handler, for use by accessible output formats.- Returns:
- The structure tree event handler
-
getLayoutManagerMakerOverride
- See Also:
-
getContentHandlerFactoryRegistry
- See Also:
-
getImageManager
public org.apache.xmlgraphics.image.loader.ImageManager getImageManager()- See Also:
-
getElementMappingRegistry
- See Also:
-
getFontManager
- See Also:
-
isNamespaceIgnored
Indicates whether a namespace URI is on the ignored list.- Parameters:
namespaceURI- the namespace URI- Returns:
- true if the namespace is ignored by FOP
-
validateUserConfigStrictly
public boolean validateUserConfigStrictly()Is the user configuration to be validated?- Returns:
- if the user configuration should be validated
-
getUserConfig
Get the user configuration.- Returns:
- the user configuration
-
getImageHandlerRegistry
- Returns:
- the image handler registry
-
getColorSpaceCache
- Returns:
- the color space cache
-
getHyphenationPatternNames
- See Also:
-
getHyphenationResourceResolver
-
getPDFObjectCache
public org.apache.xmlgraphics.image.loader.util.SoftMapCache getPDFObjectCache() -
getHyphenationTreeCache
-
setKeepEmptyTags
public void setKeepEmptyTags(boolean b) -
isKeepEmptyTags
public boolean isKeepEmptyTags() -
isTableBorderOverpaint
public boolean isTableBorderOverpaint() -
isSimpleLineBreaking
public boolean isSimpleLineBreaking() -
isSkipPagePositionOnlyAllowed
public boolean isSkipPagePositionOnlyAllowed() -
isLegacySkipPagePositionOnly
public boolean isLegacySkipPagePositionOnly() -
isLegacyLastPageChangeIPD
public boolean isLegacyLastPageChangeIPD()
-