An Oracle blog about BI Publisher

2D Barcodes Cracked ...

A few weeks back I wrote about the barcode encoding solution thats now available for use with XML Publisher for advanced barcode encoding calculations prior to applying the bar code font to the output. I found some time to take a look at some of the 2D barcodes and their requirements for encoding and rendering. Once you have the encoding class set up in your environment its pretty simple to add the 2D barcode encoding code.

XML Publisher does not yet license fonts for ... they're coming, although no 2D barcodes. So I have been working with the PDF417 and Data Matrix fonts available from IDAutomation, along with the fonts they also provide neat java classes to do all the encoding you need. Its just a case of making their classes available in your environment and calling them in your encoding class. Then with a neat trick in your RTF template et voila you can have funky 2D barcodes in your output.

Step 1: Get the barcodes and encoding classes

So you'll need to license the fonts from the vendor, in this example I worked with the sample fonts available from the IDAutomation site.
PDF417 Font - http://www.advancemeants.com/downloads/IDAutomation_PDF417FontEncoderDEMO.zip - you'll get a zip file with the font and java class plus a bunch of other useful integration tools. All you need is the PDF417Encoder.class and the IDAutomationPDF417nX.ttf font from the AdditionalFonts.zip where 'X' is the X to Y ratio of the font shape, 3 is the standard.

This is explained better on the web site, http://www.idautomation.com/fonts/pdf417/faq.html#Specifications

Step 2: Update your XMLP encoding class

Now you need to add the encoding code to your encoding class, take a look at our entry from a while back on Advanced Barcode Support.
In the encoder class we created we import the font vendors encoding class and add an entry for the pdf417 font
      import IDautomationPDFE.PDF417Encoder;
      ENCODERS.put("pdf417",mUtility.getClass().getMethod("pdf417", clazz));

and create a pdf417 method that just calls the class provided by the font vendor:

  public static final String pdf417( String DataToEncode )
       PDF417Encoder pdfe = new PDF417Encoder();
       return ( pdfe.fontEncode(DataToEncode) );

Compile and deploy to the server as normal.

Step 3: Use the font in your template

Install your font into the <<WINDOWS_HOME>>/fonts directory and fire up MSWord. Create your template and for the data that you wish to use the barcode for:
(a) Use a formfield or raw text
    <?format-barcode:ITEM_DESCRIPTION ;'PDF417';'XMLPBarVendor'?>
where ITEM_DESCRIPTION is the data to be encoded
           PDF417 is the name of the encoding method to be used
           XMLPBarVendor is the name of our encoder
(b) Mark the formfield or text with the PDF417 font
Now save your template and deploy.
Now when you run the template the data will be encoded and the font applied.
I have uploaded a sample encoding class and template to help you out.

The same process can be applied to the Datamatrix barcode to generate that output.  We had a customer test the result of the PDF417 and Datamatrix barcodes and their 2D barcode hardware read the resulting barcodes perfectly.

Join the discussion

Comments ( 14 )
  • bsaha Monday, July 3, 2006
    Hello Tim, We have been trying to implement barcodes in our XML Publisher Reports. We have tried several options but nothing works out. In most cases the scanner is not able to read the barcodes correctly. We had picked up the IDAutomationSC128M.ttf font from their site. If you want I can mail my RTF template to you so that you can have a look at it and let mw know where I am wrong. We want to print Code 128a barcode fonts. Request you to please tell me where can I get this font from, along with the encoder class. For your information, we are the version we have is as below: java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) jre -version Java(tm) Runtime Loader Version 1.1.8 You may get back to me at bulbul.saha@ge.com Can I have your email ID please? Thanks regards Bsaha
  • Tim Dexter Thursday, July 13, 2006

    Hi Bsaha

    The IDAutomation font should be fine ... we have other customers using them successfully. You can send me your template, font and sample data to tim.dexterAToracleDOTcom.


  • Mike Parr Thursday, April 2, 2009
    I have been trying to use this on the PC side to test the barcoding and cannot get the new class to 'find' the IDautomation class. What do I need to do to get the class to compile?
  • L&uuml;&uuml;li Monday, November 23, 2009
    I should use pdf417 font on dispatch labels, but I have not got it working properly. The encoder is invoked, but the output of the 2D barcode is not correct. There is horizontal white space in the code. I have allready logged two service requests (last one:3-1075385333) regarding. We are using the code from IDAutomation. Where and how to format the output?
    Best regards,
  • Thomas Wanner Wednesday, December 9, 2009
    This is absolutely fantastic :) Thanks for putting this online.
  • kl&auml;der online Wednesday, August 18, 2010
    Interesting reading
  • Douglass Hoak Sunday, September 26, 2010
    try going to the lib ray and try an beginners book for her maybe she could try to sound out the words and if the book has her stumped maybe you should read it to her about 3 times and see if she was listening and let her read it on her own.My little cousin likes to read from the pictures.
  • Olivia Monday, November 21, 2011

    Thanks for sharing.

  • Adam Barlow Wednesday, November 23, 2011


    Here is another cracking tech to share:

    1. Dowload Free Evaluation version from my home page

    2.Put it into C# IDEs

    Make buttom to generete QR Code using the generator.

    3.Press the bottom several times till the water marks disappeared.

  • Venkat Monday, July 28, 2014


    Thanks for the article. I am trying to get the 2dBarcodes (DataMatrix) to work in Oracle Apps and BI Publisher

    I followed the instructions on this blog, installed the DataMatrixEncoder.class under $JAVA_TOP. Created a new java encoding class BarcodeUtil and compiled it under the path 'oracle.apps.xdo.template.rtf.util.barcoder.BarcodeUtil'. I installed the ataMatrix fonts using BI Publisher Administration - fonts and font mappings. I can't seem to get the encoding working.

    I wanted to take a look at your Sample file listed on this blog but I can't access it. Is there a place where I can access the sample files you had created as part of this blog to compare with what I am doing.

    Thanks in advance.



  • Pradeep Friday, May 8, 2015

    Hi Tim,

    Thanks for your post here. When I spoke to IDAutomation, it seems they are not giving support for XML publisher thing. what can we do if there are any issues in the BI publisher rtf template after buying the license from them?

    I tried with demo version by downloading the product from IDAutoamtion and done all the setups in client machine.Will that work forever or do we need to buy the product from them though they do not give support?

    Please provide your comments.



  • Tim Friday, May 8, 2015

    Hi Pradeep

    IDAutomation can and should only support their font file and their java encoding class. Oracle supports the BIP implementation of the font. We have documented how to use the font and encoder class to preserve the division of responsibilities btw IDAutomation and Oracle ie do not copy and paste IDAutomation's java code into your class, import it and use the apis.

    Hope this clarifies


  • Arlene Tuesday, December 20, 2016

    Hi Tim,

    I am trying to use IDAutomationHC39M font. It shows up, but it is very large and I cannot adjust it down and our scanner won't pick it up. Any suggestions?



  • Tim Thursday, December 22, 2016

    The font sized used in the RTF template should be being respected in the final output. It might be worth creating a new template with just the bar code so you can test it. Something may have gotten corrupted in the template.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.