Applying the Barcode Font to a Text View
//used to set the text views to the barcode fonts protectedTypeface BarcodeFontFace;//set the font of the text box to the Code 128 fontBarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomationC128.ttf");
BarcodeTextView.setTypeface(BarcodeFontFace);
Code 128 Implementation Example
//set the font of the text box to the Code 128 fontTypeface BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomationC128.ttf"); BarcodeTextView.setTypeface(BarcodeFontFace);//initialize the Linear encoder to generate the encoded string
LinearFontEncoder BCEnc = new LinearFontEncoder();//set the barcode text view to the BarcodeView ID
TextView BarcodeTextView = (TextView) findViewById(R.id.BarcodeView);//set the text of the TextView to the encoded stringBarcodeTextView.setText(String.format("%s",BCEnc.Code128(barcodedata,true)));
QR Code Implementation Example
//set the font of the text box to the 2D barcode fontTypeface BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomation2D.ttf"); BarcodeTextView.setTypeface(BarcodeFontFace);//initialize the Linear encoder to generate the encoded string
QRCodeEncoder QREnc = new QRCodeEncoder();//set the barcode text view to the BarcodeView ID
TextView BarcodeTextView = (TextView) findViewById(R.id.BarcodeView);//set the text of the TextView to the encoded string
BarcodeTextView.setText(String.format("%s", QREnc.FontEncode(ReplaceCR(barcodedata), true, 0, 0, 0)));
//set the font of the text box to the PDF417 font and adjust the font size.Typeface BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomationPDF417n2.ttf"); BarcodeTextView.setTypeface(BarcodeFontFace); BarcodeTextView.setTextSize(12);//initialize the PDF417 encoder to generate the encoded string
PDF417Encoder PDFEnc = new PDF417Encoder();//set the barcode text view to the BarcodeView ID
BarcodeTextView = (TextView) findViewById(R.id.BarcodeView);//adjust the columns, and set the text of the TextView to the encoded stringPDFEnc.setPDFColumns(3); BarcodeTextView.setText(String.format("%s",PDFEnc.fontEncode(ReplaceCR(barcodedata))));
Method to Remove Extra Carriage Returns for 2D Barcode Implementations
protected String ReplaceCR(String data)
{
return data.replaceAll("\n", String.valueOf((char)13));
}
Code 128 Barcode FAQ | QR Code Barcode FAQ | PDF417 Barcode FAQ
Related Products & Information
The following product and information links relate to this product and may be of interest:
- Linear Barcode Font Packages
- 2D Barcode Font Packages
- Linear Java Barcode Encoder Tool
- Data Matrix Java Barcode Integration
- PDF417 Java Barcode Integration
- Aztec Java Barcode Integration
- Maxicode Java Barcode Integration
- QR-Code Java Barcode Integration
Android Barcode Integration Support
Free product support is available by reviewing the font problems and solutions information that IDAutomation has documented and by searching resolved public forum threads.
Pre-sales and existing customer support is available by contacting IDAutomation, and additional technical support may be attained with the purchase of the one year Priority Support and Upgrade Subscription.
|
© Copyright 2013 IDAutomation.com, Inc., All Rights Reserved. Legal Notices. Barcode Fonts | Components | Scanners | Support | Contact Us |
|
|
|
|
|
|
|





