- Client Setup
- Get the font IDAutomation font from idautomation
- Place the IDAutomation font under c:\Windows\Fonts.
- Select IDAutomation font for Barcode fields in XML Publisher Template.
- Calling encoder in the template.(Only if vendor specific fonts and java encoder is used else ignore)
- Add following expression in your template, It can be added directly to template or as a value to Form Field.
<?register-barcode-vendor:'oracle.apps.xdo.template.rtf.util.barcoder.BarcodeUtilaaa';'XMLPBarVendor'?>
Expression used to register vendor java encoder - Add format-barcode syntax to barcode field. Replace BARCODE in below syntax with your xml field.
*<?format-barcode:BARCODE;'code128a';'XMLPBarVendor'?>*
- Add following expression in your template, It can be added directly to template or as a value to Form Field.
- Server Setup -- Only needed if you have vendor specific barcode fonts else ignore.
- If vendor specific fonts are used, java encoder will be provided along with font which will be recognized by external device.
- Below imports have to be added to the vendor provided java encoder.
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.
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 hastable is used to store references to the encoding methods
public static final Hashtable ENCODERS = new Hashtable(10);
// 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());
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;
}
}
/** Add Vendor Method for Code128a */
public static final String code128a( String DataToEncode )
{
return Printable_string;
}
} - Generate class file from java code and place it under OA_JAVA/oracle/apps/xdo/template/rtf/util/barcoder. If barcoder directory doesn't exist create one.
$ cd $OA_JAVA/oracle/apps/xdo/template/rtf/util
$ mkdir barcoder
- Change permissions of the barcoder directory to 777/755.
- XML Publisher Font Setup
No longer XML publisher fonts needed to be placed on the server. They can be uploaded and used from XML publisher font file and font mappings.
For explanatory purpose IDAutomationHC39M font and font name is used. Make sure to use your own font while defining.
IMP***** Font selected while defining XML template MUST match with font name defined in xml publisher.- Navigate to XML Publisher responsibility.Go to Administration Tab.
Click on Font Files and create font file
Font Name: IDAutomationHC39MFile: Select IDAutomationHC39M.ttf from your saved location.Click Apply.Click on Font Mappings. Click “Create Font Mapping Set”.Mapping Name: BarcodesMapping Code: BarcodesType: FO To PdfClick Apply.Click on Create Font Mapping. Fill the values as below screen shot.Font Family: IDAutomationHC39MIn the next page enterFont Value: IDAutomationHC39MClick Apply.Click on Administration TabExpand FO Processing and enter Barcodes as Font Mapping Set value.Click Save.
Run the concurrent program and you should be able to see the Barcode printed on your output and is recognized by external scanning device.
Hi,
ReplyDeleteFirst thank you for sharing the information.
I have two questions: 1) I don't see how concurrent program connects the dots. In the encoder you used code128b but in the template font creation, you used IDAutomationHC39M. 2) I don't see the connection of public static final String code128a( String DataToEncode ). Where is being called?
Once again thank you.
opps. Got it.
DeleteFor Others..string code128a is being called in template using format-barcode
DeleteHi,
ReplyDeleteI follow your procedure and instead of code128, I used IDAutomationDMatrix. I added the following codes:
import com.idautomation.fontencoder.datamatrix.*;
...
/** Add Vendor Method for datamatrix */
public static final String datamatrix( String DataToEncode)
{
DataMatrixEncoder dme=new DataMatrixEncoder();
I need to call DataMatrixEncoder.class since I have the demo version.
return dme.fontEncode(DataToEncode);
}
}
Run XML report, it didn't give me any error but it didn't produce a barcode where I was expected it.
Any thought?
Thank you so much and have a nice day.
Hi,
DeleteDid you get any solution for IDAutomationDMatrix? Please share your ideas.
Thanks in Advance.
Hi,
ReplyDeleteAnyone got any solution for IDAutomationDMatrix?
https://blogs.oracle.com/xmlpublisher/entry/2d_barcodes_cracked
ReplyDeleteI have generated code 128 bar code images in java project, but now my boss asked me to adjust the height of generated code 128 bar code without changing the bar code width. So I wonder is there any way for me to resize the code 128 bar code height at large scale?
ReplyDeleteHi All,
ReplyDeleteIn Which path,Can I move the Vendor jar file "IDAutomation_JavaFontEncoder_QRCode.jar" and our custom class jar (barcodejar.jar) file to only $JAVA_TOP in 12.2.4? or other path ?
Please let me know.
Thanks,
Rama
It is not working for Word output only PDF output it is wotking
ReplyDeleteThanks for this useful content. But You can try our products, Barcode Scan SDK.
ReplyDeleteCan the same explanation be applied to QR codes as well. if not could you please explain that.
ReplyDeleteThank you