Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
barcode.fo Example Errors in FOP
What are those errors when using "barcode.fo" example in FOP to generated a PDF file?
✍: FYIcenter.com
FOP comes with an example XSL-FO file, barcode.fo, which shows how to generate barcodes in PDF. But it has a number errors, if you use the "fop" command to convert it into a PDF file:
fyicenter> cd \local\fop-2.x\fop fyicenter> fop examples\fo\advanced\barcode.fo \temp\barcode.pdf ... ... org.apache.fop.events.LoggingEventListener processEvent WARNING: Font "Barcode,normal,400" not found. Substituting with "any,normal,400". ...
This is not really a warning. It is an error. FOP could not find the "Barcode" font. We need to provide the FOP configuration file that specify where the font file is:
fyicenter> fop -c examples\fo\advanced\bar.conf.xml examples\fo\advanced\barcode.fo \temp\carcode.pdf ... java.lang.RuntimeException: java.io.FileNotFoundException: \local\fop-2.x\examples\fo\advanced\examples\fo\advanced\K3.xml (The system cannot find the path specified) at org.apache.fop.fonts.LazyFont.load(LazyFont.java:130) at org.apache.fop.fonts.LazyFont.getAscender(LazyFont.java:233) at org.apache.fop.fonts.Font.getAscender(Font.java:118) at org.apache.fop.layoutmgr.BlockLayoutManager.initialize (BlockLayoutManager.java:82) at org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM (AbstractLayoutManager.java:118) at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements (FlowLayoutManager.java:128) at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements (FlowLayoutManager.java:69) at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements (PageBreaker.java:252) at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList (AbstractBreaker.java:643) at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList (PageBreaker.java:178) at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList (PageBreaker.java:158) at org.apache.fop.layoutmgr.AbstractBreaker.doLayout (AbstractBreaker.java:384) at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:112) ...
Now the path name of metrics file, \local\fop-2.x\examples\fo\advanced\examples\fo\advanced\K3.xml, is wrong. We need to modify the FOP configuration file and try it again:
fyicenter> copy examples\fo\advanced\bar.conf.xml examples\fo\advanced\bar-original.conf.xml fyicenter> edit examples\fo\advanced\bar.conf.xml ... <fonts> <font metrics-url="K3.xml" kerning="no" embed-url="K3.ttf"> ... fyicenter> fop -c examples\fo\advanced\bar.conf.xml examples\fo\advanced\barcode.fo \temp\carcode.pdf ... java.lang.RuntimeException: org.apache.fop.apps.FOPException: Missing metrics-version attribute - please regenerate the font metrics file with a more recent version of FOP. org.xml.sax.SAXException: Missing metrics-version attribute - please regenerate the font metrics file with a more recent version of FOP. at org.apache.fop.fonts.LazyFont.load(LazyFont.java:125) at org.apache.fop.fonts.LazyFont.getAscender(LazyFont.java:233) at org.apache.fop.fonts.Font.getAscender(Font.java:118) at org.apache.fop.layoutmgr.BlockLayoutManager.initialize (BlockLayoutManager.java:82) at org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM (AbstractLayoutManager.java:118) at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements (FlowLayoutManager.java:128) at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements (FlowLayoutManager.java:69) ...
The metrics file located properly now. But it is outdated. See the next tutorial on how to regenerate the metrics file.
⇒ Generate K3.xml Metrics File in FOP
2016-07-02, 3905🔥, 0💬
Popular Posts:
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was develo...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
What Is ojdbc7.jar for Oracle 12c R1? ojdbc7.jar for Oracle 12c R1 is the JAR files of ojdbc.jar, JD...