[英]Barcode4j not working (on Unix)
對於我的項目,我需要為 PDF 生成條形碼。
我已經能夠在本地 Windows Server 上成功生成條形碼,但在生產 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>
我的圖書館:
也許檢查您正在運行的 java 版本(java -version)。
例如,如果您使用 GJC,某些程序將無法正常運行。 在這種情況下,獲取 OpenJDK 或 Oracle JDK 並重試。
Avalon Framework 類 DefaultConfiguration 中的 NoSuchMethodError 意味着您的類路徑中可能有一個較舊的 Avalon Framework。 請確保您擁有 Avalon Framework 4.2.0 或更高版本。 您可以在 Barcode4J 的 lib 目錄中找到它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.