You are on page 1of 14

Barcode Printing steps Prepared By: Nisha Mathew (Programmer Analyst at City of St Petersburg, FL) Introduction: These steps

are for creating template for an already existing RDF report which has been registered as a concurrent program. Assuming that the patch for Oracle XML Publisher (patch 5027437) Desktop has been applied and the Microsoft Word has the plug-in for developing a template. (After installing the patch when MS word is opened there will be a menu option called Template Builder on the tool bar). Process: Change the concurrent program definition and make the output format to xml.

Created the Xml template as rtf and map all the fields with the xml tags. For barcode printing the following steps are required. Download a barcode font (e.g.: IDAutomation Code 128).

Page 1 of 14

For the barcode to be scanned by an external device it requires a java encoder. Download the java encoder that is provided with the font. Install the font in a folder like C:\Temp (not in Windows \font). The font needs to be deployed in the server as well. Copy the .ttf (true type font) file and place it in the server and add that path to the REPORTS60_PATH. A good path to use is /u6/u0/oracle/trng/appl/fnd/11.5.0/reports since this path is already defined in the REPORTS60_PATH (no need to modify this variable again). Now create an xdo.cfg file and place it in the config folder of XML Publisher Desktop. There is a sample xdo file (xdo example.cfg) file in the XML Publisher folder (C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\config). Open this file and copy it adding the command for the new font. Save it as xdo.cfg in the same folder. The extra commands for the barcode fonts are as follows: <font family="IDAutomationSC128L" style="normal" weight="normal"> <truetype path="C:\Temp\IDAutomationSC128L.ttf" /> </font> After installing the font, apply the field with the barcode font. (Right click on the tag name (e.g.; DELIVERY_ID) and click font. Choose the barcode font( eg: IDAutomationSC128L)

Page 2 of 14

After applying the barcode font to the required field, the template looks like below screen shot.

Page 3 of 14

In order to make this barcode to be read by the scanner, the encoder java code provided by the vendor has to be compiled and converted to a class file. This class files needs to be called in the template. To create class files, Download and install Java SE Development KIT 5.0 update 9 or later. (eg: installed it in C:\Program Files\Java\jdk1.5.0_16) Copy the encoder java code to a editor (e.g.: text pad) and save it as a .java file (BarcodeUtil.java) in a folder (e.g.: C:\source\ BarcodeUtil) For using the encoder in E-business suite, the following additional commands need to be added to the encoder code provided by the vendor. package oracle.apps.xdo.template.rtf.util.barcoder; import java.util.Hashtable; import java.lang.reflect.Method; import oracle.apps.xdo.template.rtf.util.XDOBarcodeEncoder; import oracle.apps.xdo.common.log.Logger; // This class name will be used in the register vendor // field in the template.

Page 4 of 14

public class BarcodeUtil implements XDOBarcodeEncoder // The class implements the XDOBarcodeEncoder interface { // This is the barcode vendor id that is used in the // register vendor field and format-barcode fields public static final String BARCODE_VENDOR_ID = "XMLPBarVendor"; // The hashtable is used to store references to // the encoding methods //public static final Hashtable ENCODERS = new Hashtable(10); public static final Hashtable<Object,Object> ENCODERS=new Hashtable<Object,Object>(); // The BarcodeUtil class needs to be instantiated public static final BarcodeUtil mUtility = new BarcodeUtil(); // This is the main code that is executed in the class, // it is loading the methods for the encoding into the hashtable. // In this case we are loading the three code128 encoding // methods we have created. static { try { Class[] clazz = new Class[] { "".getClass() }; ENCODERS.put("code128a",mUtility.getClass().getMethod("code128a",clazz) ); ENCODERS.put("code128b",mUtility.getClass().getMethod("code128b",clazz) ); ENCODERS.put("code128c",mUtility.getClass().getMethod("code128c",clazz) ); } catch (Exception e) { // This is using the XML Publisher logging class to push // errors to the XMLP log file. Logger.log(e,5); } } // The getVendorID method is called from the template layer // at runtime to ensure the correct encoding method are used public final String getVendorID() { return BARCODE_VENDOR_ID; } //The isSupported method is called to ensure that the // encoding method called from the template is actually // present in this class. // If not then XMLP will report this in the log. public final boolean isSupported(String s) { if(s != null) return ENCODERS.containsKey(s.trim().toLowerCase());

Page 5 of 14

else return false; } // The encode method is called to then call the appropriate // encoding method, in this example the code128a/b/c methods. public final String encode(String s, String s1) { if(s != null && s1 != null) { try { Method method = (Method)ENCODERS.get(s1.trim().toLowerCase()); if(method != null) return (String)method.invoke(this, new Object[] { s }); else return s; } catch(Exception exception) { Logger.log(exception,5); } return s; } else { return s; } } Now open a command prompt to set the path and class path. Set the class path to point the xdocore.jar (this is a file that comes with XML Publisher Desktop i.e. C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\jlib\xdocore.jar) Set the path to the folder where the javac command exists. (ie C:\Program Files\Java\jdk1.5.0_16\bin) In the command prompt, run the following commands. C:\>set CLASSPATH=C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\jlib\xdocore.jar C:\>set PATH=C:\Program Files\Java\jdk1.5.0_16\bin C:\>cd source

Page 6 of 14

C:\source>javac -g BarcodeUtil.java

This will create the class file in the path C:\source and the file name will be BarcodeUtil.class Now this class path has to be put in the JAVA_TOP (/u6/u0/oracle/trng/comn/java/oracle/apps/xdo/template/rtf/util). Create a folder called barcoder in the above path and put the class file in it. So once done the path of the class file is as follows: /u6/u0/oracle/trng/comn/java/oracle/apps/xdo/template/rtf/util/barcoder After this bounce the server. (Note that the server needs to be bounced after adding the fonts too.) Now this java class has to be registered and called in your template. Create a blank field (in the screen shot of the template, the blank field is at the top of the grey colored box). Click on that filed and then navigate to Template Builder tools Field Browser and add the following xml command. Then, click update and refresh. Syntax:<?register-barcode-vendor:path of java class.classname; XMLPBarVendor?> Eg: <?register-barcodevendor:'oracle.apps.xdo.template.rtf.util.barcoder.BarcodeUtil';'XMLPBarVendor'?>

Page 7 of 14

Add this command to the field that has to be bar-coded. Syntax: <?format-barcode:data; type of encoding; XMLPBarVendor?> Eg: <?format-barcode:DELIVERY_ID;'code128a';'XMLPBarVendor'?> Now the template part is complete. Now the template, data and font has to be defined in Oracle Applications. The steps are as follows. Register the data definition using XML Publisher Administrator Data Definitions Create data definition Enter a unique name for the template: Pick Slip Report Enter a unique code: WSHRDPIK Select the application same as the application of the concurrent Program.

Page 8 of 14

Register the template using the XML Publisher Administrator responsibility Templates Create Template Enter a unique name for the template: Pick Slip Report Enter a unique code: WSHRDPIK Select the application same as the application of the concurrent Program. Enter the correct file name and select the appropriate data definition.

Page 9 of 14

Register the font using XML Publisher Administrator Administration Font files Create Font File Enter a font name and browse the font (ttf ) file and save it.

Page 10 of 14

Use the Font Mappings page to define mappings for fonts used in your templates to produce desired published fonts. Font mapping is performed only for PDF Output. There are two types of mappings 1. FO to PDF for mapping fonts from RTF templates and XSL-FO templates to PDF Output fonts. 2. PDF Form for mapping fonts from PDF templates to different PDF output fonts. The mapping can be defined at the site level, the template level, or the data definition level, using the Edit Configuration tab. To create a Font Mapping, first create a Font Mapping set, and then create Font Mappings within that set. Select the Create Font Mapping Set button from the Font Mappings page. On the Create Font Mapping Set page, enter a Mapping Name and Mapping Code. Enter any unique name and code you choose. Select Apply. If there are no errors, you will receive confirmation that your mapping set was successfully created and the Font Mappings page will launch.

Page 11 of 14

Select Create Font Mapping button from the Font Mappings page. On the Create Font Mapping page, enter the following as appropriate and select Continue: a. Base font i. Font Family enter the font family that will be mapped to a different font. For example: IDAutomationSC128L ii. Select the Style: Normal. iii. Select the Weight: Normal. b. Locale i. (Optional) Select the Language (English) and Territory (United States) codes. Only templates with the corresponding language and territory codes will use this font mapping. c. Target Font Type i. Select the Font Type that the base font is to be mapped to: For example: TrueType. On the Create Font Mapping page, select the Font Mapping Set that we had created previously (Free 3 of 9). Click on Apply Button.

Page 12 of 14

You can make this font available at one of three levels, Template, Data Definition and Site. For Site Level Setting: a. Navigate to the Administration tab then select the Configuration sub-tab.

Expand the FO Processing properties group and use the LOV for the Font Mapping set property to select the font mapping you want to make available for this level. Forexample Custom XML Publisher Fonts. Click on Save button.

Page 13 of 14

You can also set the same property at the Template and/or Data Definition level too by querying your Template or Data definition in the Template Manager and select the Edit Configuration button.

Now run the concurrent program to get the report out put and if the above steps are correctly followed the barcode output will be printed and read by the scanner. Note: In order to test whether the encoding java class is being called or not (in a scenario where there is no scanner to test) apply a human readable font (eg: Times New Roman) to the template (after completing the template creation as per above instructions) and save it. Then update the template file in Oracle Applications and launch the concurrent program. If the encoding class is being called then the field out put will be in special characters. Eg: bizh

Page 14 of 14

You might also like