Altova RaptorXML+XBRL Server 2024

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\Common2024\jar.

 

The Java libraries used are in sub-folders of the folder <ProgramFilesFolder>\Altova\Common2024\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 and it must match the bit version of the Altova application (32-bit or 64-bit). 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 JAVA_HOME environment variable is properly set and that the Java Virtual Machines library (on Windows, the jvm.dll file) can be located in either the \bin\server or \bin\client directory.

 

XSLT example to generate barcode

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="https://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="data:image/png;base64"/>

         </body>

      </html>

      <xsl:result-document 
         href="barcode.png" 
         method="text" encoding="base64tobinary" >

         <xsl:variable name="barcodeObject" 
            select="altovaext-barcode:newInstance('Code39',string('some value'), 
            96,0, (altovaext-barcode-property:new( 'setModuleWidth', 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>

 

XQuery example to generate QR code

Given below is an XQuery example showing how barcode functions can be used to generate a QR code image.

 

declare variable \$lines := unparsed-text-lines('https://info.healthministry.gv.at/data/timeline-cases-provinces.csv', 'utf-8');

declare variable \$main := map:merge(tokenize(head(\$lines), ';')!map{.:position()});

declare variable \$data := map:merge(tail(\$lines)!array{tokenize(., ';')}!map{?(\$main?Name): [?(\$main?Date), xs:integer(?(\$main?ConfirmedCasesProvinces)) - xs:integer(?(\$main?Recovered))]}, map{'duplicates':'combine'});

declare variable \$chart_img := altovaext:chart(map{'width': 1900, 'height': 600}, map:for-each(\$data, function(\$k, \$v){[\$k, \$v?1!substring-before(., 'T'), \$v?2][\$k != 'Austria']}));

<img src="data:image/png;base64,{\$chart_img}"/>

(:\$main,  \$data,:)

 

 

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

 

© 2017-2023 Altova GmbH