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.x\fop

fyicenter> 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

 

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, 1347🔥, 0💬