The concept of barcode came into existence in 1948 when Bernard Silver and Norman Woodland teamed up to create the most basic system for automatic machine reading of a string of product data. Since then , there have been many advancements in the technology and till date this technology is being used through out the industries in various fields. There exist quite a few types of barcodes now. Refer https://en.wikipedia.org/wiki/Barcode#Types_of_barcodes for details. One important addition came in form of a quick response barcoding scheme --The QRCode from Denso Wave., which is a two dimensional representation of data code. QR Code provides the following features.
- High Capacity Encoding of Data
- Small Printout Size
- Kanji and Kana Capability
- Dirt and Damage Resistant
- Readable from any direction in 360°
- Structured Appending Feature
For those who are interested in history of QRCode development , there is an interesting read on the site : https://www.qrcode.com/en/history/
Recently, we have noticed many clients trying to print QRCodes using JD Edwards Embedded BI Publisher. There is already a knowledge document which provides detailed steps to implement Barcode using RTF template in embedded BI Publisher. XMLP: Barcode Encoding with BI Publisher for EnterpriseOne (Doc ID 782809.1)
This post intends to summarize few of the key points needed for successful barcode generation using Embedded BI Publisher. .
Barcodes are a representation of a string of data in a barcode font. In order to be readable by barcode scanners, data represented in barcode format need to be preceded and followed by their respective control characters(start/stop). Any string of data cannot just use the barcode font directly. The data needs conversion before symbols in form of thick & thin lines, spaces & dots etc can actually represent the original data. Only once the data is encoded and represented in appropriate font , the scanners can read and understand them as they are. Examples of different kind of encoding schemes include Code128, Code 39, Code16K and ofcourse:Qrcode
And once the font is applied on this string , you get to see the actual Qrcode
How to encode ?
You do not encode the string on your own, although, you may do so if you understand the complete encoding scheme and algorithms. There are specified protocols and standards that should be used . These are available in form of already written functions and since JDE Embedded BIP uses Java , all you need is the correct class file or a jar file.
As for using simpler codes such as code 128 a, 128 b or 128 c the job is further simplified as xdocore library has the implemented code and a simple function call does the trick for you .
For details on how barcoding is used in Bi publisher, you may refer Tim Dexter's famous XML Publisher Blogs.
From JD Edwards perspective, things are not very different as it is the same publishing mechanism that is embedded in XMLP kernel. There is one extra step though, and that is to somehow make JDE system recognize the location of third-party jar file .
Since JDE tools release 188.8.131.52, we include BI Publisher core engine (10.1.3.4.1) which has built in support for barcode 128a,b,c. Using this version or higher versions which we use now, the barcode function can be invoked directly using the following command in your RTF template:
Where FieldName is the name of the dynamic field you want to convert to Barcode 128b.
And this formatted string needs to be published in a supported font such as the barcode 128 font delivered with BI Publisher Desktop: 128R00.TTF. See article posted in https://blogs.oracle.com/xmlpublisher/entry/bundled_barcodes_batman_1 for more details
What's different with QRcode?
Well , it is not the one officially implemented in xdo library and hence not completely within the scope of support. Although it is possible to implement, a direct format command like shown above may not work.
So we need to switch to old methodology of prior to Tools release 184.108.40.206 era.
We need following :
- A program or method to convert the data in desired encoding ( A Java class file that has method to encode the data).
- A font which can be used to represent the barcode in 2 dimensions. i.e. a QR code font.
Immediate queries which come to mind :
Does Oracle Jd Edwards offer any of these above for 2D fonts? No Neither do we provide any 2d barcode font nor do we ship any font encoder class or jar file.
How do I get these? Obtain both the font and encoder class from third party vendors. Example: (as seen from Xml Publisher blog posts shared before ): https://www.idautomation.com/barcode-fonts/2d/qr-code/
Once you have these files above , you should follow the RTF template designing guide section Implementing Custom Barcode Formats
To quote from guide :
BI Publisher offers the ability to execute preprocessing on the data prior to applying a barcode font to the data in the output document. For example, you might need to calculate checksum values or start and end bits for the data before formatting them.The solution requires that you register a barcode encoding class with BI Publisher that can then be instantiated at runtime to apply the formatting in the template. For information, see Advanced Barcode Font Formatting in Developer's Guide for Oracle Business Intelligence Publisher.
To enable the formatting feature in the template, you must use two commands in the template. The first command registers the barcode encoding class with BI Publisher. This must be declared somewhere in the template prior to the encoding command. The second is the encoding command to identify the data to be formatted.
Registering the Barcode Encoding Class
You can include barcodes in form fields.Use the following syntax in a form field in the template to register the barcode encoding class:
This command requires a Java class name (this carries out the encoding) and a barcode vendor ID as defined by the class. This command must be placed in the template before the commands to encode the data in the template. For example:
*where oracle.xdo.template.rtf.util.barcoder.BarcodeUtil is the Java class and XMLPBarVendor is the vendor ID that is defined by the class.
Encoding the Data
Use this syntax in a form field in the template to format the data.
where the data is the element from the XML data source to be encoded. For example: LABEL_ID, the barcode_type is the method in the encoding Java class used to format the data (for example: Code128a) & the barcode_vendor_id is the ID defined in the register-barcode-vendor field of the first command you used to register the encoding class.
At runtime, the barcode_type method is called to format the data value and the barcode font is then applied to the data in the final output.
Registration will tell the system to look for class file java_class_name ( oracle.xdo.template.rtf.util.barcoder.BarcodeUtil.) *Any other name may be used
What should be the content of this Java class that is used during registration ?
It is the implementation of the methods that are invoked at runtime. Overall three methods are expected inside the java source of this class.
* Return a unique ID for this barcode encoder
* @return the id as a string
public String getVendorID();
* Return true if this encoder support a specific type of barcode
* @param type the type of the barcode
* @return true if supported
public boolean isSupported(String type);
* Encode a barcode string by given a specific type
* @param data the original data for the barcode
* @param type the type of the barcode
* @return the formatted data
public String encode(String data, String type);
Out of these three methods the encode method should be using the Vendors logic to encode data either directly or indirectly .
For demo purpose , one can create an RTF template with below contents:
Here the string http://communities.oracle.com is hardcoded string and not an xml element (you may use any xml element name ). oracle.sample.MyWrapper is the class that the system will read for encoding methods.
So the flow looks as below:
JDE XMLP Kernel--calls --> XDO Library--> invokes--->Rtf template processor-- calls --->oracle.sample.MyWrapper (class method--qrcode)----> calls-->Third-party encoder method in third party class file or jar file (e.g.QrcodeEncoder.class from IDAutomation)
You can create a file MyWrapper.JAVA by using a sample here SAMPLE1 . Modify it to import packages provided by vendor and call the vendor method . For Vendor's api, IDautomation as an example : Refer their documentation here : QRCODEIDAUTOSAMPLE
MyWrapper.java's relevant part will look something like below: Please note that below is just a snapshot and is not complete code .
Once MyWrapper.Java is saved, compile it using the same JDK as being used by your enterprise server and possibly on same platform to create MyWrapper.class file.
Insert this class file in package structure oracle.sample and place it in XDO-core.jar file on the enterprise server/system/classes folder. Also insert "QRCodeEncoder" class or related jar file((or any other vendor's class or jar file) in this same location .
Once again to get this encoder class you should get a license from https://www.idautomation.com/barcode-fonts/2d/qr-code/
So final structure of xdo-core.jar(expanded form ) would look something like this
Tip :Open the xdo-core.jar using 7 zip and just create new folder and drag the files in desired location . This will save you from unzipping and zipping again.
What remains now is font specification on template. Change the font in template and select the Qrcode font which you have obtained from vendor .
Follow document :E1: XMLP: How to Use Custom Fonts with Embedded Publisher for EnterpriseOne ( Doc ID 652457.1 )
Upload the template and test your report definition . If no errors are received , you should see the Qrcode generated in output PDF.
- Always test the template locally first .
- Xdo debug logs will point you to error messages. Refer:E1: XMLP: How to Capture BI Publisher (BIP) Logs (Doc ID 651589.1)
- If you get class not found in xdo logs then adjust the xdo core jar file structure and ensure all class names and locations are specified correctly and there are no typo errors.