在 .xsl 中生成二维码?

Generate QR codes in .xsl?

如何从 XSL 生成二维码?

我在 .xsl 文件中有以下信息,我需要在具有相同数据的同一文件中生成二维码。

            <!-- Inicio PDF417 -->
            <xsl:if test="string-length(normalize-space($PDF417))!=0">
                <fo:block-container absolute-position="absolute" left="13.1cm" top="24.5cm" width="6.2cm" height="2.2cm" border="0pt solid" text-align="center">
                    <fo:block>
                        <fo:instream-foreign-object content-width="6.2cm" content-height="2.2cm">
                            <j4lbarcode xmlns="http://java4less.com/j4lbarcode/fop" mode="inline">
                                <pdf417>
                                    <code>
                                        <xsl:value-of select="$PDF417"/>
                                    </code>
                                    <rows>0</rows>
                                    <maxRows>200</maxRows>
                                    <cols>0</cols>
                                    <ecLevel>5</ecLevel>
                                    <compaction>BINARY</compaction>
                                    <X>0</X>
                                    <H>2</H>
                                    <margin>0</margin>
                                </pdf417>
                            </j4lbarcode>
                        </fo:instream-foreign-object>
                    </fo:block>
                </fo:block-container>
            </xsl:if>
            <!-- Fin PDF417 -->

谁能帮帮我, TY

http://www.java4less.com/barcodes/barcodes.php?info=FOPPlugin_Guide

确保您的类路径中有 qrcode.jar:

In order to use the plugin in your FOP documents you need to add the following jars to your classpath:

  • rbarcode-fop.jar
  • rbarcode.jar
  • qrcode.jar ( if you need to create QRCode barcodes)

下面是根据文档中使用 $PDF417 变量值的示例建模的。我不知道您的 pdf417 元素中的任何其他元素是否也可以应用,但这应该足以开始。

<fo:instream-foreign-object >
  <j4lbarcode xmlns="http://java4less.com/j4lbarcode/fop" mode="inline">
    <qrcode>
      <code><xsl:value-of select="$PDF417"/></code>
      <moduleSize>2</moduleSize>
      <processTilde>false</processTilde>
      <margin>30</margin> 
      <ecLevel>H</ecLevel> 
      <encoding>AUTO</encoding>
      <configuration>1</configuration>
    </qrcode>
  </j4lbarcode>
</fo:instream-foreign-object>