Package org.apache.fop.apps
Class FOUserAgent
- java.lang.Object
-
- org.apache.fop.apps.FOUserAgent
-
public class FOUserAgent extends java.lang.Object
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
Fields Modifier and Type Field Description static float
DEFAULT_TARGET_RESOLUTION
Defines the default target resolution (72dpi) for FOP
-
Constructor Summary
Constructors Constructor Description FOUserAgent(FopFactory factory)
Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getAuthor()
Returns the author of the documentjava.lang.String
getBaseURL()
Returns the base URL.java.util.Date
getCreationDate()
Returns the creation date of the documentjava.lang.String
getCreator()
Returns the creator of the documentorg.apache.fop.render.intermediate.IFDocumentHandler
getDocumentHandlerOverride()
Returns the overridingIFDocumentHandler
instance, if any.org.apache.fop.events.EventBroadcaster
getEventBroadcaster()
Returns the event broadcaster that control events sent inside a processing run.FopFactory
getFactory()
org.apache.fop.fo.FOEventHandler
getFOEventHandlerOverride()
Returns the overriding FOEventHandler instance, if any.java.lang.String
getFontBaseURL()
Deprecated.UseFontManager.getFontBaseURL()
instead.org.apache.xmlgraphics.image.loader.ImageSessionContext
getImageSessionContext()
Returns the image session context for the image package.java.lang.String
getKeywords()
Returns the keywords for the documentjava.io.File
getOutputFile()
Gets the output File.java.lang.String
getPageHeight()
Gets the default page-height to use as fallback, in case page-height="auto"java.lang.String
getPageWidth()
Gets the default page-width to use as fallback, in case page-width="auto"java.lang.String
getProducer()
Returns the producer of the documentorg.apache.fop.render.RendererFactory
getRendererFactory()
java.util.Map
getRendererOptions()
Returns the renderer optionsorg.apache.fop.render.Renderer
getRendererOverride()
Returns the overriding Renderer instance, if any.float
getSourcePixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters.float
getSourceResolution()
org.apache.fop.accessibility.StructureTree
getStructureTree()
Returns the document's structure tree, for use by accessible output formats.java.lang.String
getSubject()
Returns the subject of the documentfloat
getTargetPixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters.float
getTargetResolution()
java.lang.String
getTitle()
Returns the title of the documentjavax.xml.transform.URIResolver
getURIResolver()
Returns the URI Resolver.org.apache.fop.render.XMLHandlerRegistry
getXMLHandlerRegistry()
boolean
isAccessibilityEnabled()
Check if accessibility is enabled.boolean
isBreakIndentInheritanceOnReferenceAreaBoundary()
boolean
isConserveMemoryPolicyEnabled()
Check whether memory-conservation is enabled.boolean
isLocatorEnabled()
Checks if the use of Locators is enabledjavax.xml.transform.Source
resolveURI(java.lang.String uri)
Attempts to resolve the given URI.javax.xml.transform.Source
resolveURI(java.lang.String href, java.lang.String base)
Attempts to resolve the given URI.void
setAccessibility(boolean accessibility)
Activates accessibility (for output formats that support it).void
setAuthor(java.lang.String author)
Sets the author of the document.void
setBaseURL(java.lang.String baseUrl)
Sets the base URL.void
setConserveMemoryPolicy(boolean conserveMemoryPolicy)
Control whether memory-conservation should be enabledvoid
setCreationDate(java.util.Date creationDate)
Sets the creation date of the document.void
setCreator(java.lang.String creator)
Sets the creator of the document.void
setDocumentHandlerOverride(org.apache.fop.render.intermediate.IFDocumentHandler documentHandler)
Sets an explicit document handler to use which overrides the one that would be selected by default.void
setFOEventHandlerOverride(org.apache.fop.fo.FOEventHandler handler)
Sets an explicit FOEventHandler instance which overrides the one defined by the render type setting.void
setFontBaseURL(java.lang.String fontBaseUrl)
Deprecated.UseFontManager.setFontBaseURL(String)
instead.void
setKeywords(java.lang.String keywords)
Sets the keywords for the document.void
setLocatorEnabled(boolean enableLocator)
Controls the use of SAXLocators to provide location information in error messages.void
setOutputFile(java.io.File f)
Sets the output File.void
setProducer(java.lang.String producer)
Sets the producer of the document.void
setRendererOverride(org.apache.fop.render.Renderer renderer)
Sets an explicit renderer to use which overrides the one defined by the render type setting.void
setStructureTree(org.apache.fop.accessibility.StructureTree structureTree)
Sets the document's structure tree, for use by accessible output formats.void
setSubject(java.lang.String subject)
Sets the subject of the document.void
setTargetResolution(float dpi)
Sets the target resolution in dpi.void
setTargetResolution(int dpi)
Sets the target resolution in dpi.void
setTitle(java.lang.String title)
Sets the title of the document.void
setURIResolver(javax.xml.transform.URIResolver resolver)
Sets the URI Resolver.boolean
validateStrictly()
Returns whether FOP is strictly validating input XSL
-
-
-
Field Detail
-
DEFAULT_TARGET_RESOLUTION
public static final float DEFAULT_TARGET_RESOLUTION
Defines the default target resolution (72dpi) for FOP- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FOUserAgent
public FOUserAgent(FopFactory factory)
Main constructor. This constructor should not be called directly. Please use the methods from FopFactory to construct FOUserAgent instances!- Parameters:
factory
- the factory that provides environment-level information- See Also:
FopFactory
-
-
Method Detail
-
getFactory
public FopFactory getFactory()
- Returns:
- the associated FopFactory instance
-
setDocumentHandlerOverride
public void setDocumentHandlerOverride(org.apache.fop.render.intermediate.IFDocumentHandler documentHandler)
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
public org.apache.fop.render.intermediate.IFDocumentHandler getDocumentHandlerOverride()
Returns the overridingIFDocumentHandler
instance, if any.- Returns:
- the overriding document handler or null
-
setRendererOverride
public void setRendererOverride(org.apache.fop.render.Renderer renderer)
Sets an explicit renderer to use which overrides the one defined by the render type setting.- Parameters:
renderer
- the Renderer instance to use
-
getRendererOverride
public org.apache.fop.render.Renderer getRendererOverride()
Returns the overriding Renderer instance, if any.- Returns:
- the overriding Renderer or null
-
setFOEventHandlerOverride
public void setFOEventHandlerOverride(org.apache.fop.fo.FOEventHandler handler)
Sets an explicit FOEventHandler instance which overrides the one defined by the render type setting.- Parameters:
handler
- the FOEventHandler instance
-
getFOEventHandlerOverride
public org.apache.fop.fo.FOEventHandler getFOEventHandlerOverride()
Returns the overriding FOEventHandler instance, if any.- Returns:
- the overriding FOEventHandler or null
-
setProducer
public void setProducer(java.lang.String producer)
Sets the producer of the document.- Parameters:
producer
- source of document
-
getProducer
public java.lang.String getProducer()
Returns the producer of the document- Returns:
- producer name
-
setCreator
public void setCreator(java.lang.String creator)
Sets the creator of the document.- Parameters:
creator
- of document
-
getCreator
public java.lang.String getCreator()
Returns the creator of the document- Returns:
- creator name
-
setCreationDate
public void setCreationDate(java.util.Date creationDate)
Sets the creation date of the document.- Parameters:
creationDate
- date of document
-
getCreationDate
public java.util.Date getCreationDate()
Returns the creation date of the document- Returns:
- creation date of document
-
setAuthor
public void setAuthor(java.lang.String author)
Sets the author of the document.- Parameters:
author
- of document
-
getAuthor
public java.lang.String getAuthor()
Returns the author of the document- Returns:
- author name
-
setTitle
public void setTitle(java.lang.String title)
Sets the title of the document. This will override any title coming from an fo:title element.- Parameters:
title
- of document
-
getTitle
public java.lang.String getTitle()
Returns the title of the document- Returns:
- title name
-
setSubject
public void setSubject(java.lang.String subject)
Sets the subject of the document.- Parameters:
subject
- of document
-
getSubject
public java.lang.String getSubject()
Returns the subject of the document- Returns:
- the subject
-
setKeywords
public void setKeywords(java.lang.String keywords)
Sets the keywords for the document.- Parameters:
keywords
- for the document
-
getKeywords
public java.lang.String getKeywords()
Returns the keywords for the document- Returns:
- the keywords
-
getRendererOptions
public java.util.Map getRendererOptions()
Returns the renderer options- Returns:
- renderer options
-
setBaseURL
public void setBaseURL(java.lang.String baseUrl)
Sets the base URL.- Parameters:
baseUrl
- base URL
-
setFontBaseURL
public void setFontBaseURL(java.lang.String fontBaseUrl)
Deprecated.UseFontManager.setFontBaseURL(String)
instead.Sets font base URL.- Parameters:
fontBaseUrl
- font base URL
-
getBaseURL
public java.lang.String getBaseURL()
Returns the base URL.- Returns:
- the base URL
-
setURIResolver
public void setURIResolver(javax.xml.transform.URIResolver resolver)
Sets the URI Resolver.- Parameters:
resolver
- the new URI resolver
-
getURIResolver
public javax.xml.transform.URIResolver getURIResolver()
Returns the URI Resolver.- Returns:
- the URI Resolver
-
resolveURI
public javax.xml.transform.Source resolveURI(java.lang.String uri)
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
Source
object, or null if the URI cannot be resolved. - See Also:
FOURIResolver
-
resolveURI
public javax.xml.transform.Source resolveURI(java.lang.String href, java.lang.String base)
Attempts to resolve the given URI. Will use the configured resolver and if not successful fall back to the default resolver.- Parameters:
href
- URI to accessbase
- the base URI to resolve against- Returns:
- A
Source
object, or null if the URI cannot be resolved. - See Also:
FOURIResolver
-
setOutputFile
public void setOutputFile(java.io.File f)
Sets the output File.- Parameters:
f
- the output File
-
getOutputFile
public java.io.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()
-
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
-
getFontBaseURL
public java.lang.String getFontBaseURL()
Deprecated.UseFontManager.getFontBaseURL()
instead. This method is not used by FOP.Returns the font base URL.- Returns:
- the font base URL
-
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()
-
getSourceResolution
public float getSourceResolution()
- Returns:
- the resolution for resolution-dependant input
-
getPageHeight
public java.lang.String getPageHeight()
Gets the default page-height to use as fallback, in case page-height="auto"- Returns:
- the page-height, as a String
- See Also:
FopFactory.getPageHeight()
-
getPageWidth
public java.lang.String getPageWidth()
Gets the default page-width to use as fallback, in case page-width="auto"- Returns:
- the page-width, as a String
- See Also:
FopFactory.getPageWidth()
-
validateStrictly
public boolean validateStrictly()
Returns whether FOP is strictly validating input XSL- Returns:
- true of strict validation turned on, false otherwise
- See Also:
FopFactory.validateStrictly()
-
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:
FopFactory.isBreakIndentInheritanceOnReferenceAreaBoundary()
-
getRendererFactory
public org.apache.fop.render.RendererFactory getRendererFactory()
- Returns:
- the RendererFactory
-
getXMLHandlerRegistry
public org.apache.fop.render.XMLHandlerRegistry 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
-false
if 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 org.apache.fop.events.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.
-
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
-
setAccessibility
public void setAccessibility(boolean accessibility)
Activates accessibility (for output formats that support it).- Parameters:
accessibility
-true
to enable accessibility support
-
isAccessibilityEnabled
public boolean isAccessibilityEnabled()
Check if accessibility is enabled.- Returns:
- true if accessibility is enabled
-
setStructureTree
public void setStructureTree(org.apache.fop.accessibility.StructureTree structureTree)
Sets the document's structure tree, for use by accessible output formats.- Parameters:
structureTree
- a simplified version of the FO tree, retaining only its logical structure
-
getStructureTree
public org.apache.fop.accessibility.StructureTree getStructureTree()
Returns the document's structure tree, for use by accessible output formats.- Returns:
- a simplified version of the FO tree, retaining only its logical structure
-
-