An Oracle blog about BI Publisher

  • July 8, 2010

Bundled Barcodes Batman

batman.jpgSorry, ran out of B's for my alliteration. Hope those of you on this side of the pond enjoyed the fourth. We had our town's celebration on Monday. Organized by my wife, who is an Englisher, the irony was lost on most folks. Still the Renaissance Festival's elephants were a hit and they did not eat the park tress. The water slide turned into a mud bath which went down well with hte kids until we hosed them off with snow melt water :) I spent my day making cotton candy (candy floss) for the kids. If I never have to make it again, it will be too soon. It gets everywhere, quite an ingenious machine thou.

As many of you may have noticed, there are 3 barcode fonts bundled with BI Publisher these daze.

Font fileSupported algorithms(barcode_type)
128R00.TTFcode128a, code128b and code128c
B39R00.TTFcode39, code39mod43
UPCR00.TTFupca, upce

Thats all well and good but for the likes of the code128 you need to encode your data prior to applying the font. That means some custom java code for you to write and maintain :(

Custom code, pah! No longer needed as the boys and gals in dev are now supplying a java encoding library for the delivered fonts. Big kudos and thanks to Tomoji and Kenneth for 1. putting the solution together and 2. writing it up! You need to be on at least to get the library. Once you have it, life could not be much simpler to use the barcodes.


1. Insert a field, and setup the code in properties with <?format-barcode:data;'barcode_type'?> command in the RTF template. You don't need to register any java program because it's already integrated, but you need make sure the font file exist in the font directory.



2. Configure the font correctly in the config file or BIP enterprise UI. Hit the books for this step, its all there in grayscale glory.

Once configured or if you want to test the font on the template builder, here's an example cfg file for UPC font:

<config version="1.0.0"  xmlns="http://xmlns.oracle.com/oxp/config/">
<!-- Properties -->
<!-- Font setting -->
<font family="Bookman" style="normal" weight="normal">
<truetype path="C:\WINDOWS\Fonts\UPCR00.TTF"/>


- Please note that for the Template Builder for Word, Microsoft Word require the fonts exist in the system font directory (e.g. C:\WINDOWS\Fonts) and you need to set up the configuration as above

- There is a known bug exist in Microsoft Word, if you save the template after setting a field with a barcode font, the code will become non-readable after you close and re-open. To avoid such case, set a different font (e.g. Bookman) to the form field in MS Word and map it to the actual font file in the configuration.

<font family="Bookman" style="normal" weight="normal"> 
<truetype path="C:\WINDOWS\Fonts\UPCR00.TTF"/>

This is neat work around for an issue that I hit all too often.


- upca accept only UPC-A message string and encode into UPC-A barcode

- string of 12 character length will be treated as UPC-A message with a check digit, 11 will be without check digit


- upce accept only UPC-E message string and encode into UPC-E barcode

- string of 8 character length will be treated as UPC-E message with both front and end guard bar, 6 will be without

- we always re-calculate the check digit on both UPC-A and UPC-E output

I know, I know, 11g was announced yesterday and Im late to the party. There are some very neat new features coming and I have a favorite that is going to make building data models a breeze ... more soon!

Join the discussion

Comments ( 3 )
  • Simon D Wednesday, August 25, 2010
    For some reason I cannot get this to work. In my .rtf i have the following:

    but when I view the PDF the output on the pdf is:
    How do i know when its encoded it properly? i can apply the font alright but it just seems as if its not being encoded at all?
  • Simon D Wednesday, August 25, 2010
    my code did not paste correctly due to angle brackets so here it is minus the brackets:
  • isnocomment Tuesday, October 30, 2012

    How about a german alliteration with Bs: "Baertige Biberacher Biertrinker bevorzugen bei besonderen Begebenheiten besonders braufrisches Bier" meaning roughly translated by G**gle: "bearded beer drinkers from Biberach prefer for special occassions particularly freshly brewed beer" ?

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