Unleash Technology

How to display barcode on Oracle BI Publisher report

We all know use of barcode, right! It helps business to track a product or order quickly and accurately. Like in any supermarket, barcode helps to identify items easily and accurately. But how to generate barcode from Siebel or any other system? Can we generate and display barcode on Oracle Business Intelligence Publisher Report?
Answer is YES, we can use BI Publisher as barcode generator and print/display barcode on report.

Recently, I was working on a requirement for one manufacturing company where they were looking for better approach to track Service Request and RMA (Return Material Authorization) of products distributed among different systems. So easiest and reliable solution is Barcode but how will it help them to meet their goal? Well, let me give you a business scenario. Right now, business uses Siebel CRM application to create service request of any product or order. Suppose for RMA type service request, Siebel system will generate the RMA number and then send it to dispatch section for mail communication. So for dispatch section, it is manual task to enter RMA number into System. Next for RMA working department, it is another manual task to enter RMA number into their system. In complex system, business could have more hierarchy and more hierarchy means higher chance of doing wrong entry. So they need automation of this manual task to make the process faster and error free (almost error free) and best solution is barcode automation. Siebel will generate the RMA number and send it to reporting system (here business is using BI Publisher for reporting purpose). Then BI Publishers will change the RMA number to barcode which will be referred by all other business units. To read barcode, business units need only barcode scanner which will change the barcode to actual number and make an entry on their system. Faster and error free, isn’t it!!

Now, question is how BI Publisher will generate barcode and print it on report? 
Barcode is nothing but special kind of font which barcode scanner only can read. There are few free barcode fonts and few paid fonts. As per requirement, you could pick free font or paid. For our requirement, we have used free barcode font 39HIHR.ttf of barcode39 font family. In Microsoft Word, 39HIHR.ttf looks like below (barcode above and number down).
How to display barcode on Oracle BI Publisher report www.techonestop.com
You can download the font from Google. If the font file is zipped, then unzip it and paste it under C:WindowsFonts folder. Once you paste Code39.ttf, it will be installed automatically and you should see many other barcode fonts like 39HI.TTF, 39HIHR.TTF, 39HITLHR.TTF. To verify the new barcode font, open one word doc in MS word, write any text and select one barcode font. You will see the text in barcode font. Now our first step is completed. We have successfully installed barcode font on our system so that we could build our report template using barcode font. Here we have used 39HIHR.ttf as business needs barcode bar above and RMA number down what exactly this barcode font provides
Next check BI Publisher Desktop is installed on your system or not. We need it to build template with barcode font. If BI Publisher Desktop is installed, then you could see Oracle BI Publisher Add Ins tab in MS word. I hope you know how to add bookmark to display field in report. Here we have added two bookmarks, one for SR number and another for RMA Number and we have picked BC 39 HI HR font (which is nothing but display name of 39HIHR.ttf font) for both two fields.
display barcode on Oracle BI Publisher report www.techonestop.com
Once report template is ready, see the preview to check barcode font. To see preview, first add the font in xdo.cfg file, located under ..BI Publisher DesktopTemplate Builder for Wordconfig. If you are doing for first time, then you may have xdo_example.cfg instead of xdo.cfg. We have to rename this file as xdo.cfg and add below script under ‘<!– Font setting –>’ section.
<font family=”BC 39 HI HR” style=”normal” weight=”normal”>
<truetype path=”C:Program FilesJavajre6libfonts39HIHR.ttf” />
It should look like below
xdo.cfg www.techonestop.com
Now we can see the preview of the template. To see preview, click on Preview option from Oracle BIP Toolbar and select the report type (example PDF, DOC, HTML). If the template preview does not meet our requirement, modify it and verify it again. Once the template is ready, generate XLIFF file from the original template. At runtime, original template is applied for the layout and the XLIFF file is applied for translation.
Follow below steps to generate an XLIFF file from an RTF template
    – Open the template in Microsoft Word and click on Add-Ins tab
    – From the Template Builder menu, select Tools > Translate Template > Extract Text, BI Publisher 
      will extract the translatable strings from the template
    – Save the file with .xlf extension
Now our template and XLIFF file are ready. Next step is font mapping in BI Publisher so that we could use BIP as Barcode Generator. Follow below steps to configure new font in BIP.
Step 1:
Check the java path which is getting referred by Business Intelligence Publisher server and copy the font file (39HIHR.ttf) from C:WindowsFonts to .. Javajre(version no)libfonts
    – Make sure, font file extension (.ttf) is in small letter otherwise font may not appear in font mapping dropdown
    – If the extension is in Caps, then change it to small letter first and then copy it
    – Restart the werserver (OC4J/Tomcat) service if required

Step 2:
Login to BI Publisher Application and Navigate to Admin > Runtime Configuration > Font Mappings
Oracle BI Publisher font mapping www.techonestop.com
Step 3:
As per report template type (RTF or PDF), click on ‘Add Font Mapping’ button to add font. As we have used RTF template for our requirement, font mapping for RTF template type will be sufficient, no need to do anything on pdf font mapping option.
              Base font = BC 39 HI HR (Base Font value should be same as font display name in MS Word)
              Style = Normal
              Weight = Normal 
              Target Font Type = Truetype
              Target Font = Actual font file (39HIHR.ttf)
              TTC Number = (keep it blank)

Barcode font mapping on Oracle BI Publisher report www.techonestop.com

Step 4:
Click on ‘Apply’ button from right hand side top corner and restart the webserver (OC4j or tomcat) service.

That’s all. Now goto Siebel application, upload files (template file and XLIFF file) on Administration-BI Publisher and generate reports. You could see nice barcode on the template.

Few things to remember:
– Font file extension (.ttf) must be in small letters otherwise font may not appear in font mapping dropdown
– Sometimes barcode scanner needs barcode terminator to read the code properly, mainly if you are using code39 barcode font. Here we have used * (asterisk) as terminator.

If you have any doubt or question, feel free to ask us. To get more updates on recent activities, follow ‘TechOneStop’ on Facebook/Twitter/LinkedIn or join our website as followers. In our next article, we will discuss about how to display MICR code and QR code on BIP Report.

Watch our video as well:

Sharing is caring!

  • Allen

    Very good Article…

  • Harris

    Excellent post.