Creating Barcodes in Oracle XML BI Publisher (BIP)

The implementation tutorial presented here creates barcodes in Oracle XML Publisher with RTF templates using the QR Code Font and Encoder. This example is a summary taken from a barcoding blog written by Tim Dexter at the Oracle Website. For assistance with this tutorial and technical support, please refer to the examples provided on the Oracle site:


    Java Barcode Jars
    Symbology InformationClass File Path

    IDAutomation_QRCode_JavaFontEncoder.jarQRCode with support for Byte, Numeric, and Alpha-numeric encoding modes. Automatic Version selection.com.idautomation.fontencoder.qrcode
    IDAutomation_LinearJavaFontEncoder.jar
    Code 39, Extended Code 39, Code 128, Code 128 auto, GS1-128, Interleaved 2 of 5, Codabar, UPC-A, UPC-E, MSI, EAN-8, EAN-13, Code 11, Code 93, Industrial 2 of 5, USPS Intelligent Mail IMb, Postnet & Planet, GS1 DataBar, Stacked, Truncated, Stacked Omni-directional, Limited, Expanded, Expanded Stacked Omni-directional, and Universal Fonts

    com.idautomation (Linear, Databar, and Intelligent Mail)

    com.idautomation.universalencoder (Universal)

    AztecEncoder.class
    Aztec matrix generation with automatic mode selection and GS1 compatibility. AIM Specification ANSI/AIM BC13 ISS Aztec Code. com.idautomation.fontencoder.aztec
    IDAutomation_JavaFontEncoder_DataMatrix.jar
    Data Matrix with ECC200, ASCII, text, C40 and Base256 encoding, Includes support for US DOD UID and macro codeword 236 and 237 ISO/IEC 15434 formatscom.idautomation.fontencoder.datamatrix
    PDF417Encoder.class
    PDF417 with EC levels 1 to 8, text and binary encoding.com.idautomation.fontencoder.pdf417
    IDAutomation_JavaFontEncoder_DotCode.jar
    In Development and Testing
    com.idautomation.fontencoder.dotcode
    IDAutomation_JavaFontEncoder_MaxiCode.jar
    MaxiCode with structured append, UPS encoding and mode 2-6 support.com.idautomation.fontencoder.maxicode


      Tutorial

      1. Install all required applications and components for Word and BI Publisher.

      2. Purchase, download, extract, and install the QR Code Font and Encoder (Developer License and up).

      3. A Java Font Encoder class file is included as .jar with the license. Extract this file and retrieve the .jar.

      4. Set up the .jar file in your environment. View Oracle's documentation for additional help.

      5. Access Tim Dexter's BarcodeUtil.java file available in the qrbarcodes-2.zip.BarcodeUtil.java for BI Publisher

      6. Because the Quick Quips tutorial was created in 2012, the BarcodeUtil.java available in Tim's article has a few outdated parameters. The Encoder section of the tutorial provides an example of the parameters. Open the BarcodeUtil.java file and verify that it is updated to this:
        /* Import the idautomation encoder class */
        import com.idautomation.fontencoder.qrcode.QRCodeEncoder;
        QRCodeEncoder qre = new QRCodeEncoder();
        boolean ApplyTilde = false;
        String EncodingMode = "Byte";
        int Version = 0;
        String ErrorCorrectionLevel = "M";
        boolean BestMask = false;
        return qre.FontEncode(DataToEncode, ApplyTilde, EncodingMode, ErrorCorrectionLevel,Version,BestMask);
      7. Within the BarcodeUtil.java file, include an encoder call to the IDAutomation_QRCode_JavaFontEncoder.jar :
      8. Class[] clazz = new Class[] { "".getClass() };  
              //ENCODERS.put("code128a",mUtility.getClass().getMethod("code128a", clazz));
              //ENCODERS.put("code128b",mUtility.getClass().getMethod("code128b", clazz));
              //ENCODERS.put("code128c",mUtility.getClass().getMethod("code128c", clazz));
              ENCODERS.put("qrcode",mUtility.getClass().getMethod("qrcode", clazz)); 
        This entry will register the encoder method.

      9. Verify the IDAutomation_QRCode_JavaFontEncoder.jar is in the classpath.

      10. Access the jlib path and place the following jar files in the classpath: xdocore.jar, xmlparserv2.jar, collections.jar, aolj.jar, share.jar, xdoparser.jar, jewt4.jar, 18nAPI_v3.jar.

      11. Compile the BarcodeUtil.java file to create a new class. If there are errors, contact Tim Dexter directly.

      12. After creating the BarcodeUtil.class, create a jar file to store it in. In the example, Tim Dexter names it barcodejar.jar.

      13. Copy the IDAutomation_QRCode_JavaFontEncoder.jar and the barcodejar.jar to the jlib folder within the Template Builder for Word.
        Barcodejar.jar in the Template Builder for Word

      14. So that BI Publisher can find the wrapper class, all the jars required for the project must be put into  the RTF2PDF.jar which is located in the jlib folder.

      15. Make a back up of the RTF2PDF.jar file.

      16. Open the RTF2PDF.jar using Winzip or 7zip and access the META-INF directory. Open and edit the MANIFEST.MF to include the jars at the end of the classpath list:
        Manifest-Version: 1.0
        Class-Path: ./activation.jar ./mail.jar ./xdochartstyles.jar ./bicmn.jar ./jewt4.jar
        ./share.jar ./bipres.jar ./xdoparser.jar ./xdocore.jar ./xmlparserv2.jar
        ./xmlparserv2-904.jar ./i18nAPI_v3.jar ./versioninfo.jar
        ./barcodejar.jar ./IDAutomation_JavaFontEncoder_QRCode.jar
        Main-Class: RTF2PDF

      17. In order to render the barcode in a PDF report, it must be embedded by referencing the font within a config file in the BI Publisher config folder. Open the xdo example.cfg file located:

      18. Add an entry for the IDAutomation2D font in the code area under the font setting:

        Embed IDAutomation2D font for BI Publisher

        <!--IDAutomation 2D QR Code Font-->
        <font family="IDAutomation2D" style="normal">
        <truetype path="C:\windows\fonts\IDAutomation2D.ttf"/>
        </font>
        
      19. Return to Word and access the BI Publisher file. Double-click the field to barcode and choose Add Help Text to open the Form Field.

      20. In the Status Bar tab, enter the first command:
        <?register-barcode-vendor:'ENCODER WRAPPER CLASS'; 'ENCODER NAME'?>
        
        Register IDAutomation barcode in Form Field´╗┐
      21. In the Help Key (F1), enter the second command:
        <?format-barcode:DATA_TO_ENCODE;'ENCODER_METHOD_NAME';'ENCODER_NAME'?>
        
        Encode Data in BI Publisher Form Field´╗┐
      22. To ensure the data is encoded, view the document (PDF,RTF,HTML): BI Publisher Barcode PreviewIDAutomation Encoded Data in BI Publisher
      23. Return to the project and select the IDAutomation2D font from the font list. View the document.QR Code Barcode in BI Publisher