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, 3912🔥, 0💬
Popular Posts:
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
xml-commons Resolver Source Code Files are provided in the source package file, xml-commons-resolver...
What is the sax\Counter.java provided in the Apache Xerces package? I have Apache Xerces 2.11.0 inst...
Java Architecture for XML Binding (JAXB) is a Java API that allows Java developers to map Java class...
What Is js.jar in Rhino JavaScript 1.7R5? js.jar in Rhino JavaScript 1.7R5 is the JAR file for Rhino...