Please enable JavaScript to view this site.

Altova RaptorXML+XBRL Server 2020

The XSLT Engine uses third-party Java libraries to create barcodes. Given below are the classes and the public methods used. The classes are packaged in AltovaBarcodeExtension.jar, which is located in the folder <ProgramFilesFolder>\Altova\Common2020\jar.

 

The Java libraries used are in sub-folders of the folder <ProgramFilesFolder>\Altova\Common2020\jar:

 

barcode4j\barcode4j.jar  (Website: http://barcode4j.sourceforge.net/)

zxing\core.jar  (Website: http://code.google.com/p/zxing/)

 

The license files are also located in the respective folders.

 

Java virtual machine

In order to be able to use the barcode functions, a Java virtual machine must be available on your machine. The path to the machine is found as noted below.

 

If you are using an Altova desktop product, the Altova application attempts to detect the path to the Java virtual machine automatically, by reading (in this order): (i) the Windows registry, and (ii) the JAVA_HOME environment variable. You can also add a custom path in the Options dialog of the application; this entry will take priority over any other Java VM path detected automatically.

If you are running an Altova server product on a Windows machine, the path to the Java virtual machine will be read first from the Windows registry; if this is not successful the JAVA_HOME environment variable will be used.

If you are running an Altova server product on a Linux or macOS machine, then make sure that the path to the Java virtual machine is stored in the JAVA_HOME environment variable. The path must point to the jvm.dll file in the \bin\server or \bin\client directory.

 

The com.altova.extensions.barcode package

The package, com.altova.extensions.barcode, is used to generate most of the barcode types.

 

The following classes are used:

 

public class BarcodeWrapper

 static BarcodeWrapper newInstance( String name, String msg, int dpi, int orientation, BarcodePropertyWrapper[] arrProperties )

 double getHeightPlusQuiet()

 double getWidthPlusQuiet()

 org.w3c.dom.Document generateBarcodeSVG()

 byte[] generateBarcodePNG()

 String generateBarcodePngAsHexString()

 

public class BarcodePropertyWrapper Used to store the barcode properties that will be dynamically set later

 BarcodePropertyWrapper( String methodName, String propertyValue )

 BarcodePropertyWrapper( String methodName, Integer propertyValue )

 BarcodePropertyWrapper( String methodName, Double propertyValue )

 BarcodePropertyWrapper( String methodName, Boolean propertyValue )

 BarcodePropertyWrapper( String methodName, Character propertyValue )

 String getMethodName()

 Object getPropertyValue()

 

public class AltovaBarcodeClassResolver Registers the class com.altova.extensions.barcode.proxy.zxing.QRCodeBean for the qrcode bean, additionally to the classes registered by the org.krysalis.barcode4j.DefaultBarcodeClassResolver.

 

 

The com.altova.extensions.barcode.proxy.zxing package

The package, com.altova.extensions.barcode.proxy.zxing, is used to generate the QRCode barcode type.

 

The following classes are used:

 

class QRCodeBean

 

Extends org.krysalis.barcode4j.impl.AbstractBarcodeBean

Creates an AbstractBarcodeBean interface for com.google.zxing.qrcode.encoder  

 

 void generateBarcode(CanvasProvider canvasImp, String msg)

 void setQRErrorCorrectionLevel(QRCodeErrorCorrectionLevel level)

 BarcodeDimension calcDimensions(String msg)

 double getVerticalQuietZone()

 double getBarWidth()

 

class QRCodeErrorCorrectionLevel Error correction level for the QRCode

 static QRCodeErrorCorrectionLevel byName(String name)

 “L” = ~7% correction

 “M” = ~15% correction

 “H” = ~25% correction

 “Q” = ~30% correction

 

 

XSLT example

Given below is an XSLT example showing how barcode functions are used in an XSLT stylesheet.

 

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   xmlns:fn="http://www.w3.org/2005/xpath-functions" 
   xmlns:altova="http://www.altova.com" 
   xmlns:altovaext=”http://www.altova.com/xslt-extensions 
   xmlns:altovaext-barcode="java:com.altova.extensions.barcode.BarcodeWrapper" 
   xmlns:altovaext-barcode-property="java:com.altova.extensions.barcode.BarcodePropertyWrapper">

   <xsl:output method="html" encoding="UTF-8" indent="yes"/>

   <xsl:template match="/">

      <html>

         <head><title/></head>

         <body>

            <img alt="barcode" src="{altovaext:get-temp-folder()}barcode.png"/>

         </body>

      </html>

      <xsl:result-document 
         href="{altovaext:get-temp-folder()}barcode.png" 
         method="text" encoding="base64tobinary" >

         <xsl:variable name="barcodeObject" 
            select="altovaext-barcode:newInstance(&apos;Code39&apos;,string(&apos;some value&apos;), 
            96,0, (altovaext-barcode-property:new( &apos;setModuleWidth&apos;, 25.4 div 96 * 2 ) ) )"/>

         <xsl:value-of select="xs:base64Binary(xs:hexBinary(string(altovaext-barcode:generateBarcodePngAsHexString($barcodeObject)) ))"/>

      </xsl:result-document>

   </xsl:template>

</xsl:stylesheet>

 

© 2019 Altova GmbH