Transform XML to FO and Generate PDF with FOP

Q

How to transform XML to FO and generate PDF with FOP?

✍: FYIcenter.com

A

FOP allows you to transform XML to FO and generate PDF output with a single command. Here is how to do this:

\fyicenter>cd \local\fop-2.2\fop

\local\fop-2.2\fop>fop -xml examples\embedding\xml\xml\projectteam.xml 
   -xsl examples\embedding\xml\xslt\projectteam2fo.xsl 
   -pdf \temp\projectteam.pdf
org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".
org.apache.fop.events.LoggingEventListener processEvent
INFO: Rendered page #1.

The output PDF file is located at \temp\projectteam.pdf. Open it with a PDF viewer, you will see something like this:
FOP Example - Convert XML to FO to PDF

The same example is provided in FOP 2.2, 2.1, and 2.0.

 

Run fop.jar in FOP as Executable

"FOP -awt" - Generate Output on Screen

FOP Commands and Examples

⇑⇑ FAQ for FOP (Formatting Object Processor)

2018-04-28, 225👍, 0💬