I want to have a barcode (Code128) generated during the xsl fop translation. As it is said in the apache fop documentation (and barcode4j docs), if you want to use extension, put it on the classpath. This works fine for a desktop app and an applet running from the eclipse. But how to run it from a browser?
As a proof of concept, I extracted everything to so called 'fat-jar' - one jar, everything repacked from the eclipse as "Export to runnable jar" with "Extract required libs into generated JAR". Everything works as expected (translation and many other things) except the barcode generation. This is my only apache fop extension so I guess the problem is about the classpath mentioned as there is no such thing for an applet?
Here is my main part of the html:
<html lang="en-US">
<body>
<script src="http://www.java.com/js/deployJava.js"></script>
<script> var attributes = { codebase:'.', code:'com.signapplet.SignApplet.class', archive:'SignApplet.jar', width:1024, height:968};
var parameters = {jnlp_href: 'SignApplet.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
and jnlp:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Sign Applet</title>
<vendor>me</vendor>
</information>
<security><all-permissions/></security>
<resources>
<j2se version="1.6+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="SignApplet.jar" main="true" />
</resources>
<applet-desc
name="Sign Applet"
main-class="com.signapplet.SignApplet"
width="300"
height="300" >
</applet-desc>
<update check="background"/>
</jnlp>
I will add that on java console I have standard gibberish ("19:43:04,429 WARN FOUserAgent:97 - Unknown formatting object "{http://barcode4j.krysalis.org/ns}height" encountered (a child of code128}. (No context info available)") as I wound not include the proper complete barcode4j extension but I checked and everything is packed correctly in my jar file plus everything works correctly in the eclipse.
This is copy/paste example code from the barcode4j webpage:
<fo:block>
<fo:instream-foreign-object>
<barcode:barcode
xmlns:barcode="http://barcode4j.krysalis.org/ns"
message="my message" orientation="90">
<barcode:code128>
<barcode:height>8mm</barcode:height>
</barcode:code128>
</barcode:barcode>
</fo:instream-foreign-object>
</fo:block>
I am using latest barcode4j-fop-ext-complete.jar and apache-fop 1.1. What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…