Apache™ FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF.

The Apache FOP processor is part of Axional Server core services an can be used for server applications for high performance PDF rendering

You can read more about how to configure Apache™ FOP at:

# 1 Command line processor

The FOP processor can be used for batch applications by using the following command line:

Copy
$bin/FOPProcessor.sh -xml {file} -pdf {file} -config {file} [-properties {file}] [-encoding {encoding}] Argument Description xml xml file with fo tree pdf output pdf file config FOP configuration file properties FOP UserAgent properties file encoding file encoding (default is utf-8) # 2 FOP server configuration The Apache™ FOP configuration file is an XML file containing a variety of settings that are useful for controlling FOP's behavior, and for helping it find resources that you wish it to use. Each server may contain it's own FOP configuration and must indicate where the file is located. This can be done in fopConfig entry in server config.xml file. In the following example, fopConfig points to conf/fop/userconfig.xml. Copy <?xml version="1.0" encoding="UTF-8"?> <server name="server1" engine="jetty"> <encoding info="Server encoding">UTF-8</encoding> ... <fopConfig>conf/fop/userconfig.xml</fopConfig> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="studioConfig"> ... </application> </server> ## 2.1 Fonts You can use the FOP configuration file to add custom fonts. To do that you should configure the renderer entry. Each Renderer has its own configuration section which is identified by the MIME type the Renderer is written for, ex. "application/pdf" for the PDF Renderer. You must tell FOP how to find and use the font files by registering them in the FOP Configuration. Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following: Copy sample fop configuration file <?xml version="1.0" encoding="UTF-8"?> <fop> <!-- Font Base URL for resolving relative font URLs --> <font-base>fonts</font-base> <renderers> <renderer mime="application/pdf"> <fonts> <font embed-url="FormataPro-Regular.ttf" embedding-mode="subset"> <font-triplet name="Formata Pro" style="normal" weight="400"/> </font> <font embed-url="FormataPro-Italic.ttf" embedding-mode="subset"> <font-triplet name="Formata Pro" style="italic" weight="400"/> </font> <font embed-url="FormataPro-Medium.ttf" embedding-mode="subset"> <font-triplet name="Formata Pro" style="normal" weight="700"/> </font> </fonts> </renderer> </renderers> </fop> ## 2.2 Encryption FOP supports encryption of PDF output. This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text from the document and doing annotations. It is also possible to ask the user for a password in order to view the contents. Note that there already exist third party applications which can decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the degree of protection is limited. For further information about features and restrictions regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical documentation on the Adobe web site. The following example sets a encryption prolicy for all pdf documents generated using the configuraation file. Copy <renderer mime="application/pdf"> <encryption-params> <encryption-length>128</encryption-length> <user-password>testuserpass</user-password> <owner-password>testownerpass</owner-password> <noprint/> <nocopy/> <noedit/> <noannotations/> <nofillinforms/> <noaccesscontent/> <noassembledoc/> <noprinthq/> </encryption-params> <fonts> ... </fonts> </renderer> # 3 FOUserAgent properties Before rendering a document a set of properties can be send to FOUserAgent instance. From command line processor properties can be set in a properties file set by argument -properties. The properties file is a standard java properies like title=the title author=the author creator=deister producer=deister keywords=key1, key2  Property Type title string author string creator string producer string keywords string You can setup encryption for a given document using the properties file parameters. Property Type encrypt boolean userPassword string ownerPassword string allowPrint boolean allowCopyContent boolean allowEditContent boolean allowEditAnnotations boolean encryptMetadata boolean allowFillInForms boolean allowAccessContent boolean allowAssembleDocument boolean All encryption parameters will be ignored if encrypt is set to false. # 4 List fonts You can display font (either system and configured) tables so you can check font names, weights and styles invoking the class using the following command: Copy $ bin/FOPListFonts.sh -config {file} [-pdf {file}]
If a pdf file name is specified, a sample document with all font names will be genetated on this file name.