Class FORendererApacheFOP
java.lang.Object
org.docx4j.convert.out.fo.renderers.AbstractFORenderer
org.docx4j.convert.out.fo.renderers.FORendererApacheFOP
- All Implemented Interfaces:
FORenderer
The Apache FO Renderer uses Apache FOP to render the fo document
and is the default FO Renderer
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.docx4j.convert.out.FORenderer
FORenderer.SectionPageInformation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringstatic final Stringprotected static FORendererApacheFOPprotected static org.slf4j.Loggerprivate static StringFields inherited from class org.docx4j.convert.out.fo.renderers.AbstractFORenderer
TEXTBOX_POSTPROCESSING_REQUIRED, xslt_POSTPROCESSINGFields inherited from interface org.docx4j.convert.out.FORenderer
PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.fop.apps.FormattingResultscalcResults(org.apache.fop.apps.FopFactory fopFactory, String outputFormat, Source foDocumentSrc, PlaceholderReplacementHandler.PlaceholderLookup placeholderLookup) For first pass of two pass process, invoke org.apache.fop.apps.FormattingResults which can tell us the number of pages in each page sequence, and in the document as a whole.static org.apache.fop.apps.FopFactoryBuildergetFopFactoryBuilder(FOSettings settings) Get a FopFactoryBuilder, automagically preconfigured with font info.static org.apache.fop.apps.FopFactoryBuildergetFopFactoryBuilder(FOSettings settings, org.apache.xmlgraphics.io.ResourceResolver resourceResolver) Get a FopFactoryBuilder, automagically preconfigured with font info.static org.apache.fop.apps.FOUserAgentgetFOUserAgent(FOSettings settings, org.apache.fop.apps.FopFactory fopFactory) Allow user access to FOUserAgent, so they can setAccessibility(true).static FORenderervoidrender(String foDocument, FOSettings settings, boolean twoPass, List<FORenderer.SectionPageInformation> pageNumberInformation, OutputStream outputStream) Render the foDocument to the requested format, if needed do a 2 pass conversion.protected voidrender(org.apache.fop.apps.FopFactory fopFactory, org.apache.fop.apps.FOUserAgent foUserAgent, String outputFormat, Source foDocumentSrc, PlaceholderReplacementHandler.PlaceholderLookup placeholderLookup, OutputStream outputStream) private StringsetupApacheFopMime(FOSettings settings)
-
Field Details
-
log
protected static org.slf4j.Logger log -
instance
-
XSL_FO
-
FO_USER_AGENT
- See Also:
-
FOP_FACTORY
- See Also:
-
-
Constructor Details
-
FORendererApacheFOP
public FORendererApacheFOP()
-
-
Method Details
-
render
public void render(String foDocument, FOSettings settings, boolean twoPass, List<FORenderer.SectionPageInformation> pageNumberInformation, OutputStream outputStream) throws Docx4JException Description copied from interface:FORendererRender the foDocument to the requested format, if needed do a 2 pass conversion.- Parameters:
foDocument- the fo document to be rendered.settings- the conversion settings passed to the conversion processtwoPass- a two pass rendering might be needed, i.e. the body of some tags contain placeholder How the renderer calculates the corresponding values and replaces them is its responsabilitypageNumberInformation- This list contains an entry for each section in the document. It defines the IDs of the corresponding placeholders and the number format (as a fo format).
This List is only available if twoPass = true.outputStream- The output stream on which the output should be rendered- Throws:
Docx4JException
-
setupApacheFopMime
-
getInstance
-
render
protected void render(org.apache.fop.apps.FopFactory fopFactory, org.apache.fop.apps.FOUserAgent foUserAgent, String outputFormat, Source foDocumentSrc, PlaceholderReplacementHandler.PlaceholderLookup placeholderLookup, OutputStream outputStream) throws Docx4JException - Throws:
Docx4JException
-
calcResults
protected org.apache.fop.apps.FormattingResults calcResults(org.apache.fop.apps.FopFactory fopFactory, String outputFormat, Source foDocumentSrc, PlaceholderReplacementHandler.PlaceholderLookup placeholderLookup) throws Docx4JException For first pass of two pass process, invoke org.apache.fop.apps.FormattingResults which can tell us the number of pages in each page sequence, and in the document as a whole.- Parameters:
fopFactory-outputFormat-foDocumentSrc-placeholderLookup-- Returns:
- Throws:
Docx4JException
-
getFOUserAgent
public static org.apache.fop.apps.FOUserAgent getFOUserAgent(FOSettings settings, org.apache.fop.apps.FopFactory fopFactory) throws Docx4JException, org.apache.fop.apps.FOPException Allow user access to FOUserAgent, so they can setAccessibility(true). Access to other settings is possible but unsupported.- Parameters:
wmlPackage-- Returns:
- Throws:
org.apache.fop.apps.FOPExceptionDocx4JException
-
getFopFactoryBuilder
public static org.apache.fop.apps.FopFactoryBuilder getFopFactoryBuilder(FOSettings settings) throws org.apache.fop.apps.FOPException Get a FopFactoryBuilder, automagically preconfigured with font info. Uses default ResourceResolver. defaultBaseURI can be set at property "docx4j.Convert.Out.fop.FopConfParser.defaultBaseURI"- Parameters:
settings-- Returns:
- Throws:
org.apache.fop.apps.FOPException
-
getFopFactoryBuilder
public static org.apache.fop.apps.FopFactoryBuilder getFopFactoryBuilder(FOSettings settings, org.apache.xmlgraphics.io.ResourceResolver resourceResolver) throws org.apache.fop.apps.FOPException Get a FopFactoryBuilder, automagically preconfigured with font info. Uses the specified ResourceResolver. defaultBaseURI can be set at property "docx4j.Convert.Out.fop.FopConfParser.defaultBaseURI"- Parameters:
settings-resourceResolver- your custom resourceResolver- Returns:
- Throws:
org.apache.fop.apps.FOPException
-