Run barcode.fo Example in FOP

Q

How to run the "barcode.fo" example in FOP to generated a PDF file?

✍: FYIcenter.com

A

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

fyicenter> 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:
FOP Example - barcode.fo

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.

 

Convert Image to PDF with FOP

Generate K3.xml Metrics File in FOP

FOP Commands and Examples

⇑⇑ FAQ for FOP (Formatting Object Processor)

2016-07-03, 4888🔥, 0💬