0

私のプロジェクトでは、PDFのバーコードを生成する必要があります。

ローカルのWindowsServerでバーコードを正常に生成できましたが、実稼働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>

私の図書館:

  • バーコード4j-fop-ext-complete-2.0
  • xalan
  • xercesImpl
  • xml-apis
  • xml-apis-ext
4

2 に答える 2

1

Avalon Framework クラス DefaultConfiguration の NoSuchMethodError は、クラスパスに古い Avalon Framework がある可能性があることを意味します。Avalon Framework 4.2.0 以降を使用していることを確認してください。Barcode4J の lib ディレクトリにあります。

于 2011-10-22T20:26:40.537 に答える
1

おそらく、実行している Java のバージョン (java -version) を確認してください。

たとえば、GJC を使用している場合、一部のプログラムは正しく動作しません。その場合は、OpenJDK または Oracle JDK を入手して、再試行してください。

于 2011-10-18T17:31:15.483 に答える