Run barcode.fo Example in fop-2.0-bin.zip

Q

How to run the "barcode.fo" example in fop-2.0-bin.zip to generated a PDF file?

✍: FYIcenter.com

A

fop-2.0-bin.zip comes with an example XSL-FO file, barcode.fo, which shows how to generate barcode images in PDF. You can use the "fop" command to convert it into a PDF file:

\fyicenter>cd \local\fop-2.0

\local\fop-2.0>echo %java_home%
   \Program Files\Java\jdk1.8.0_45\

\local\fop-2.0>fop -c examples\fo\advanced\bar.conf.xml 
   examples\fo\advanced\barcode.fo \temp\carcode.pdf
... 
... org.apache.fop.apps.FopConfParser configure
INFO: Default page-height set to: 11in
... org.apache.fop.apps.FopConfParser configure
INFO: Default page-width set to: 8.26in
... 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.
... org.apache.fop.events.LoggingEventListener processEvent
INFO: Rendered page #2.

The output PDF file is located at \temp\carcode.pdf. Open it with a PDF viewer, you will see something like this:

Note that the K3.xml and K3.ttf path names need to be modified in the FOP configuration file bar.conf.xml. Also the K3.xml needs to be regenerated.

Back to FAQ on FOP (Formatting Objects Processor).

2016-07-03, 1398👍, 0💬