Barcode4j 不工作(在 Unix 上)
对于我的项目,我需要为 PDF 生成条形码。
我已经能够在本地 Windows 服务器上成功生成条形码,但在生产 UNIX 服务器上生成失败。
我使用barcode4j并需要生成code39。
我的模板:
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:bc="http://barcode4j.krysalis.org/ns"
xmlns:barcode="org.krysalis.barcode4j.xalan.BarcodeExt"
extension-element-prefixes="barcode"
exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>
<xsl:param name="versionParam" select="'1.0'"/>
<xsl:template match="anforderung">
<xsl:call-template name="barcode">
<xsl:with-param name="code" select="barcode/code" />
<xsl:with-param name="codeoriginal" select="barcode/codeoriginal" />
</xsl:call-template>
</xsl:template>
<xsl:template name="barcode">
<xsl:param name="code" />
<xsl:param name="codeoriginal" />
<fo:block keep-together="always">
<!-- message für barcode -->
<xsl:variable name="barcode-cfg">
<barcode>
<code39>
<height>16mm</height>
<module-width>0.3mm</module-width>
<human-readable>
<placement>none</placement>
</human-readable>
</code39>
</barcode>
</xsl:variable>
<fo:block font-weight="bold" margin-left="0.3in">
<fo:table table-layout='fixed' width="100%">
<fo:table-column column-width="8.2cm" />
<fo:table-column column-width="12cm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:instream-foreign-object>
<xsl:variable name="bc" select="barcode:generate($barcode-cfg, barcode/code)" />
<xsl:copy-of select="$bc" />
<!--xsl:copy-of select="barcode:generate(barcode-cfg, msg)"/-->
</fo:instream-foreign-object>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="justify" font-size="32pt">
<xsl:value-of select="$codeoriginal" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:block>
</xsl:template>
我的库:
- barcode4j-fop-ext-complete-2.0
- xalan
- xercesImpl
- xml-apis
- xml-apis-ext
For my project, I need to generate a barcode for a PDF.
I have been able to successfully generate barcodes on my local Windows Server, on the production UNIX server, the generation fails though.
I use barcode4j and need to generated code39.
My template :
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:bc="http://barcode4j.krysalis.org/ns"
xmlns:barcode="org.krysalis.barcode4j.xalan.BarcodeExt"
extension-element-prefixes="barcode"
exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>
<xsl:param name="versionParam" select="'1.0'"/>
<xsl:template match="anforderung">
<xsl:call-template name="barcode">
<xsl:with-param name="code" select="barcode/code" />
<xsl:with-param name="codeoriginal" select="barcode/codeoriginal" />
</xsl:call-template>
</xsl:template>
<xsl:template name="barcode">
<xsl:param name="code" />
<xsl:param name="codeoriginal" />
<fo:block keep-together="always">
<!-- message für barcode -->
<xsl:variable name="barcode-cfg">
<barcode>
<code39>
<height>16mm</height>
<module-width>0.3mm</module-width>
<human-readable>
<placement>none</placement>
</human-readable>
</code39>
</barcode>
</xsl:variable>
<fo:block font-weight="bold" margin-left="0.3in">
<fo:table table-layout='fixed' width="100%">
<fo:table-column column-width="8.2cm" />
<fo:table-column column-width="12cm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:instream-foreign-object>
<xsl:variable name="bc" select="barcode:generate($barcode-cfg, barcode/code)" />
<xsl:copy-of select="$bc" />
<!--xsl:copy-of select="barcode:generate(barcode-cfg, msg)"/-->
</fo:instream-foreign-object>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="justify" font-size="32pt">
<xsl:value-of select="$codeoriginal" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:block>
</xsl:template>
My library:
- barcode4j-fop-ext-complete-2.0
- xalan
- xercesImpl
- xml-apis
- xml-apis-ext
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许检查您正在运行的 java 版本(java -version)。
例如,如果您使用 GJC,某些程序将无法正常运行。在这种情况下,获取 OpenJDK 或 Oracle JDK,然后重试。
Perhaps check what version of java you are running (java -version).
Some programs do not operate properly if you are using GJC for example. In that case get OpenJDK or the Oracle JDK and try again.
Avalon 框架类 DefaultConfiguration 中的 NoSuchMethodError 意味着类路径中可能有较旧的 Avalon 框架。请确保您有 Avalon Framework 4.2.0 或更高版本。您可以在 Barcode4J 的 lib 目录中找到它。
NoSuchMethodError in the Avalon Framework class DefaultConfiguration means you may have an older Avalon Framework in the classpath. Please make sure you have Avalon Framework 4.2.0 or later. You can find it in Barcode4J's lib directory.