Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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, ∼4743🔥, 0💬
Popular Posts:
JDK 17 jdk.jconsole.jmod is the JMOD file for JDK 17 JConsole tool, which can be invoked by the "jco...
JDK 11 java.security.jgss.jmod is the JMOD file for JDK 11 Security JGSS (Java Generic Security Serv...
JDK 17 jdk.internal.le.jmod is the JMOD file for JDK 17 Internal Line Editing module. JDK 17 Interna...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
What JAR files are required to run dom\Counter.java provided in the Apache Xerces package? You can f...