Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
    Licensed to Plutext Pty Ltd under one or more contributor license agreements.  
  *  This file is part of docx4j.
     docx4j is licensed under the Apache License, Version 2.0 (the "License"); 
     you may not use this file except in compliance with the License. 
     You may obtain a copy of the License at 
    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License.
package org.docx4j.convert.out;
The pdf conversion process needs a fo renderer to convert the fo document into the requested format. The fo renderer is encapsulated in this interface.
The FORenderer can be: 1. The default ApacheFORenderer that gets used if no custom FORenderer has been passed. This renderer contains the functionality and replaces the classes FopFactoryUtil and FopResultUtils. The configuration and the result mime is passed via the FOSettings. 2. A custom implementation of the FORenderer interface that gets passed via the FOSettings to the conversion process. 3. The DummyFORenderer, that gets used if INTERNAL_FO_MIME has been selected as the output format in apacheFopMime. Passing the INTERNAL_FO_MIME as the result mime acts as a flag, it selects the DummyFORenderer and ensures that the rendering is done as a one pass process (in this case, the result might not be correct, since a two pass conversion may be necessary). The DummyFORenderer itself just passes the generated fo to the output stream. The conversion process might need a two pass conversion, if this is the case, then the body of some elements might contain a placeholder that needs to be replaced with the page count in the document or the page count in the section. A placeholder for the page count of the document is defined as
A placeholder for the page count of a section is defined as
The values need to be calculated by the renderer and the placeholder replaced. The format of the numbers is defined for the page count of the document by getDocumentPageCountFoFormat() and the one for the section by getSectionPageCountFoFormat();

public interface FORenderer {
	public static final String PLACEHOLDER_PREFIX = "${";
	public static final String PLACEHOLDER_SUFFIX = "}";

The definition for the IDs and formats for the page count of one Section.
	public interface SectionPageInformation {

Render the foDocument to the requested format, if needed do a 2 pass conversion.

foDocument the fo document to be rendered.
settings the conversion settings passed to the conversion process
twoPass 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 responsability
pageNumberInformation 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
	public void render(String foDocumentFOSettings settingsboolean twoPassList<SectionPageInformationpageNumberInformationOutputStream outputStreamthrows Docx4JException;
New to GrepCode? Check out our FAQ X