Formatting Objects http apache roweboat netxmlfop What is

Formatting Objects http: //apache. roweboat. net/xml/fop/

What is it? Why would I use it? • FOP (Formatting Objects Processor) is the world's first print formatter driven by XSL formatting objects (XSL-FO) and the world's first 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, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT. The primary output target is PDF.

More about FOP • FOP (Formatting Objects Processor) is the world's first print formatter driven by XSL formatting objects (XSL-FO) and the world's first 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, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT. The primary output target is PDF.

downloads • You’ll have to download FOP from xml. apache. org/fop • FOP uses Xalan and Xerces parsers. • FOP includes java programs for which you’ll need J 2 SE

the batch file • The FOP download includes a batch file FOP. bat. • To run this, build a DOS prompt to point to the FOP directory (FOP-0. 20. 5 is the version number for the directory I downloaded on 8/12/05) • The FOP batch file expects the name of an fo file as the first (input) parameter and a pdf as the second (output) parameter.

OPTIONS • -d debug mode -x dump configuration settings -q quiet mode -c cfg. xml use additional configuration file cfg. xml -l lang the language to use for user information -s (-at output) omit tree below block areas -txt. encoding (-txt output encoding use the encoding for the output file. The encoding must be a valid java encoding. -o [password] pdf file will be encrypted with option owner password -u [password] pdf file will be encrypted with option user password -noprint pdf file will be encrypted without printing permission -nocopy pdf file will be encrypted without copy content permission -noedit pdf file will be encrypted without edit content permission -noannotations pdf file will be encrypted without edit annotation permission
![[INPUT] • infile XSLFO input file (the same as the next) -fo infile xsl: [INPUT] • infile XSLFO input file (the same as the next) -fo infile xsl:](http://slidetodoc.com/presentation_image_h/375d68bdd49e204e683e47c80fa4570e/image-7.jpg)
[INPUT] • infile XSLFO input file (the same as the next) -fo infile xsl: fo input file -xml infile xml input file, must be used together with -xsl stylesheet xslt stylesheet
![[OUTPUT] outfile input will be rendered as pdf file into outfile -pdf outfile input [OUTPUT] outfile input will be rendered as pdf file into outfile -pdf outfile input](http://slidetodoc.com/presentation_image_h/375d68bdd49e204e683e47c80fa4570e/image-8.jpg)
[OUTPUT] outfile input will be rendered as pdf file into outfile -pdf outfile input will be rendered as pdf file (outfile req'd) awt input will be displayed on screen -mif outfile input will be rendered as mif file (outfile req'd) pcl outfile input will be rendered as pcl file (outfile req'd) ps outfile input will be rendered as Post. Script file (outfile req'd) -txt outfile input will be rendered as text file (outfile req'd) svg outfile input will be rendered as an svg slides file (outfile req'd) -at outfile representation of area tree as XML (outfile req'd) -print input file will be rendered and sent to the printer see print specific options with "-print help"
![[Examples] • fop foo. fo foo. pdf • fop -fo foo. fo -pdf foo. [Examples] • fop foo. fo foo. pdf • fop -fo foo. fo -pdf foo.](http://slidetodoc.com/presentation_image_h/375d68bdd49e204e683e47c80fa4570e/image-9.jpg)
[Examples] • fop foo. fo foo. pdf • fop -fo foo. fo -pdf foo. pdf (does the same as the previous line) • fop -xsl foo. xsl -xml foo. xml -pdf foo. pdf fop foo. fo -mif foo. mif fop foo. fo -print (or) • fop -print foo. fo • fop foo. fo -awt

your own batch files • You may wish to make your own batch files (you’ll need to fix paths) to run xalan. This batch file requires 3 parameters, the xml file, the xsl file and a fo file: java -classpath C: xalan-j-current-binxalanj_2_6_0binxalan. jar; C: xalan-j-currentbinxalan-j_2_6_0binxerces. Impl. jar org. apache. xalan. xslt. Process -IN %1 XSL %2 -OUT %3

A batch file to run fop – you’ll need to fix paths. This batch file requires 2 parameters set LIBDIR=C: fop-0. 20. 5lib set LOCALCLASSPATH=C: fop-0. 20. 5buildfop. jar Set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%xml-apis. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%xerces. Impl 2. 2. 1. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%xalan-2. 4. 1. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%batik. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%avalonframework-cvs-20020806. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%jimi-1. 0. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%jai_core. jar set LOCALCLASSPATH=%LOCALCLASSPATH%; %LIBDIR%jai_codec. jar java -cp "%LOCALCLASSPATH%" org. apache. fop. apps. Fop %1 %2

running FOP

simple. pdf created from simple. fo

simple. fo • the file simple. fo is in the notes. • typically a formatted object file would be built with a special editing tool. • An fo file is an xml file, so it can have extension xml, xsl or fo (or whatever).

C: pathtofop>FOP readme. fo readme. pdf

fo file • Xalan parser can produce an fo from xml using a stylesheet.

Running fop (excerpt from readme. pdf)
![running fop on table. fo C: FITFOP-02~1. 5>fop table. fo table. pdf [INFO] Using running fop on table. fo C: FITFOP-02~1. 5>fop table. fo table. pdf [INFO] Using](http://slidetodoc.com/presentation_image_h/375d68bdd49e204e683e47c80fa4570e/image-18.jpg)
running fop on table. fo C: FITFOP-02~1. 5>fop table. fo table. pdf [INFO] Using org. apache. xerces. parsers. SAXParser as SAX 2 Parser [INFO] FOP 0. 20. 5 [INFO] Using org. apache. xerces. parsers. SAXParser as SAX 2 Parser [INFO] building formatting object tree [INFO] setting up fonts [INFO] [1] [INFO] [2] [INFO] [3] [INFO] [4] [INFO] [5] [INFO] [6] [INFO] [7] [INFO] Parsing of document complete, stopping renderer

an fo table <fo: block text-align="start">this is normal text. </fo: block> <!-- table start --> <fo: table-layout="fixed"> <fo: table-column column-width="50 mm"/> <fo: table-body> <fo: table-row> <fo: table-cell ><fo: block>good</fo: block></fo: table-cell> <fo: table-cell ><fo: block>bad</fo: block></fo: table-cell> <fo: table-cell ><fo: block>ugly</fo: block></fo: table-cell> </fo: table-row> <fo: table-cell ><fo: block>nice</fo: block></fo: table-cell> <fo: table-cell ><fo: block>dice</fo: block></fo: table-cell> <fo: table-cell ><fo: block>vice</fo: block></fo: table-cell> </fo: table-row> <fo: table-cell ><fo: block>literature</fo: block></fo: table-cell> <fo: table-cell ><fo: block>music</fo: block></fo: table-cell> <fo: table-cell ><fo: block>art</fo: block></fo: table-cell> </fo: table-row> <fo: table-cell ><fo: block>java</fo: block></fo: table-cell> <fo: table-cell ><fo: block>perl</fo: block></fo: table-cell> <fo: table-cell ><fo: block>python</fo: block></fo: table-cell> </fo: table-row> </fo: table-body> </fo: table> <!-- table end --> <!-- normal text --> <fo: block text-align="start">this is normal text. </ fo: block>

table. pdf

fonts. fo to fonts. pdf

more fop: fo file in notes

Text examples don’t seem to work Microsoft(R) Windows DOS (C)Copyright Microsoft Corp 1990 -2001. C: FOP-02~1. 5>fop topic_list. fo topics. pdf [INFO] Using org. apache. xerces. parsers. SAXParser as SAX 2 Parser [INFO] FOP 0. 20. 5 [INFO] Using org. apache. xerces. parsers. SAXParser as SAX 2 Parser [INFO] building formatting object tree [INFO] setting up fonts [WARNING] A 'flow-name' is required for fo: flow. This constraint will be enforce d in future versions of FOP [ERROR] file: /c: /fop/FOP-02~1. 5/topic_list. fo: 24: 42 master-reference '' for fo: p age-sequence matches no simple-page-master or page-sequence-master C: FOP-02~1. 5>
- Slides: 23