Publishing Books Using XML Technologies
Dr. Herong Yang, Version 4.01

Formatting XSL-FO Files to PDF Files Using FOP

This section provides an example of formatting an XSL-FO file to a PDF file with FOP.

Let's format hello.fo into a PDF file with the following command:

fop -fo hello.fo -pdf hello.pdf

You should see the following on the screen:

[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5rc2
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[INFO] Parsing of document complete, stopping renderer

Now if you open the output file, hello.pdf, with Adobe Acrobat Reader, you should see the greeting message, "Hello world!", showing at the top left corner of the page. This is great. I am starting to like FOP now.

Sections in This Chapter

What Is XSL-FO (XSL Formatting Objects)

Example of XSL-FO Document - hello.fo

Installing Apache FOP - XSL-FO Processor

Formatting XSL-FO Files to Text Files Using FOP

Formatting XSL-FO Files to PDF Files Using FOP

Formatting XML Files to PDF Files with XSLT

Tranforming XML Files with XSLT Stylesheets

Dr. Herong Yang, updated in 2007
Formatting XSL-FO Files to PDF Files Using FOP