Printing Bar Code in Oracle Reports and XML Publisher Reports

Printing Bar Code in Oracle Reports and XML Publisher Reports 

Definitions
What is Barcode?
Barcode is an automatic identification technology that encodes information into an array of parallel bars and spaces of varying widths. Barcode 3 of 9 and Barcode 128 are two different barcode code types.
Barcode 3 of 9:
Barcode 3 of 9 is TrueType and the most popular bar code type. This barcode type doesn’t require checksum and lets you encode numbers (0-9), upper case letters (A-Z), and some special characters (space, $ % + - . /).
Barcode 128:
Barcode 128 is TrueType and PostScript barcode font set, which requires a checksum and lets one encode the entire ASCII character set, including control codes. Simply begin each barcode with a special start code, and end each bar code with a checksum and the stop character.
Barcode 128 includes three subsets (A, B, and C) of bar code 128.  Barcode 128 fonts come in different aspect ratios, so one can vary the height and width of the bars independent of each other.

Printing Barcode in Oracle Reports


This section describes the steps to implement barcodes in Oracle Reports with the Oracle Graphic Designer (OGD) file i.e. “barcode6i.ogd” and barcode fonts. The “barcode6i.ogd” is an Oracle Graphic Designer file which has the logic to encode value and draw the equivalent barcode.

Printing Barcode 3 of 9: 

1. Create a “Chart” item field in the report layout using Chart Item Tool Button.





2.  In the Chart Item Field Property palette window, set the “Chart Filename” property as “barcode6i.ogd”, where “barcode6i.ogd” is the Oracle Graphic Designer file which has the program logic to generate the barcode. “barcode6i.ogd” file resides in $AU_TOP/graphs.





3. Also set the “Parameters and Columns” property; click the button beside this property, which opens the Chart Parameters and Columns Property values window.

Go to the Parameters tab, highlight the Report Column, which is source for the barcode and put the ‘X’ character in the Chart Parameter (which is quite beside the high-lighted Report Column).

Press “OK” button and save the report.




4. Place the “barcode6i.ogd” file in the Unix Server under “$AU_TOP/graphs” path.





Oracle Graphics Designer OGD file for barcode 3 of 9:


Printing Bar Code in XML Publisher Reports

Printing Barcode 3 of 9:

This section describes how to implement barcode 3 of 9 in XML Publisher Reports.

Install the barcode font (i.e. 3of9.ttf) in the local machine.
Create a RTF template.
Create a form-field to display the barcode.
Map the field with the XML tag that will come in at runtime.
Highlight this form field and set the font installed in step 1.
Open RTF template properties, and create a custom property which locates the font file at the run time.
Copy the bar code font (i.e. 3of9.ttf) to the Unix Server.

Below are the steps in detail to implement bar code 3 of 9 in XML Publisher Reports.

1. Install the barcode font (3of9.ttf) in windows\fonts.





Once the font is installed, it can be accessed from Microsoft word.





2. Insert a form field in the RTF template; map this field with the XML tag that will come in at runtime. Highlight this form field and set the font “3 of 9 Barcode” created in step 1.





3. Go to the properties of the RTF template.








4. In the “Custom” tab, create a custom property with the values below and save the property.

a. Property:  xdo-font.3 of 9 Barcode.normal.normal
b. Value:  truetype./usr/openwin/lib/X11/fonts/TrueType/3of9.ttf
c. Click "Add" button and then "OK" button.
d. Save the RTF template.




5. Copy the font file (i.e. 3of9.ttf) to the Unix Server in “/usr/openwin/lib/X11/fonts/TrueType” folder. This is where, usually, all font files are kept.




Printing Barcode 128:

Barcode 128 needs dynamic generation of start, checksum, and stop digits which should be generated dynamically. This can be done with java class. Below are the steps to print the Barcode 128 with XML Publisher.

This section describes how to implement barcode 128 in XML Publisher Reports.

Install the barcode 128 fonts in the local machine.
Create a RTF template.
In the beginning of the RTF template register the barcode encoding class (i.e. BarcodeUtil.java)  using “register-barcode-vendor” command.
Create a form-field to display the barcode.
Highlight this form field and set the font installed in step 1.
Use “format-barcode” command to encode the data.
Open RTF template properties, and create a custom property which locates the font file at the runtime.
Copy the barcode font (i.e. 3of9.ttf) to the Unix Server.

Below are the steps in detail to implement barcode 128 in XML Publisher Reports.


1. Install one of the barcode 128 fonts in windows. Below are different barcode 128 fonts.

Barcode128 fonts:
a. IDAutomationC128S.ttf
b. IDAutomationC128M.ttf
c. IDAutomationC128L.ttf
d. IDAutomationC128XS.ttf
e. IDAutomationC128XL.ttf
f. IDAutomationC128XXS.ttf
g. IDAutomationC128XXL.ttf








Once the font is installed, it can be accessed from Microsoft word.





2. In the beginning of the RTF template, create one form field and give the below values to the form field.

Default text: <Name of the form field> for ex. Register_Barcode

Open the form field properties i.e. “form field options” and then go to “Form Field Help Text”; enter the below command and click “OK” button.

<?register-barcode-vendor:'oracle.apps.xdo.template.rtf.util.BarcodeUtil';'XMLPBarVendor'?>

Where
'oracle.apps.xdo.template.rtf.util.BarcodeUtil' is the path where the BarcodeUtil class is placed.
'XMLPBarVendor' is the barcode vendor id.


The “register-barcode-vendor” command registers the barcode encoding class. It requires parameters like java class name, which carry out the encoding, and a barcode vendor ID as defined by the class. This command needs to appear before the commands to encode the data in the template.




3. Insert a form field in the RTF template; highlight this form field and set the font created in step 1.




4. Give the below value(s) to the form field, which is created in the above step.

Default text: <Name of the form field> for ex. C_PO_NUMBER

Open the form field properties i.e. “form field options” and then go to “Form Field Help Text”; enter the below command and click “OK” button.

<?format-barcode:C_PO_NUMBER;'code128a';'XMLPBarVendor'?>

Where
'C_PO_NUMBER' is the element in the XML to be encoded.
'code128a' is the barcode_type method in encoding java class used to format the data.
'XMLPBarVendor' this is the ID as defined in the register-barcode-vendor field.


At runtime the barcode_type method will be called to format the data value and the barcode font will then be applied to the data in the final output.


5. Go to the properties of the RTF template.






6. In the "Custom" tab create a custom property with the values below and save the property.

a. Property: xdo-font.IDAutomationC128M.normal.normal
b. Value: truetype./usr/openwin/lib/X11/fonts/TrueType/IDAutomationC128M.ttf
c. Click "Add" button and then "OK" button.
d. Save the RTF template.






7. Copy the font file to the UNIX server in "/usr/openwin/lib/X11/fonts/TrueType/" directory. This is where, usually, all font files are kept in the server.


8. Copy Java file “BarcodeUtil.java” to “$JAVA_TOP/oracle/apps/xdo/template/rtf/util” in Unix Server. Compile this file with “javac BarcodeUtil.java” command to create the “BarcodeUtil.class”.

1 comments :

Appreciating the persistence you put into your blog and detailed information you provide.
Aws training chennai | AWS course in chennai

Reply

Post a Comment