public class FieldBarcode extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Inserts a postal barcode in a machine-readable form of address used by the U.S. Postal Service.
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFacingIdentificationMark()
Gets the type of a Facing Identification Mark (FIM) to insert.
|
java.lang.String |
getPostalAddress()
Gets the postal address used for generating a barcode or the name of the bookmark that refers to it.
|
int |
getSwitchType(java.lang.String switchName) |
boolean |
isBookmark()
Gets whether
getPostalAddress() / setPostalAddress(java.lang.String) is the name of a bookmark. |
void |
isBookmark(boolean value)
Sets whether
getPostalAddress() / setPostalAddress(java.lang.String) is the name of a bookmark. |
boolean |
isUSPostalAddress()
Gets whether
getPostalAddress() / setPostalAddress(java.lang.String) is a U.S. |
void |
isUSPostalAddress(boolean value)
Sets whether
getPostalAddress() / setPostalAddress(java.lang.String) is a U.S. |
void |
setFacingIdentificationMark(java.lang.String value)
Sets the type of a Facing Identification Mark (FIM) to insert.
|
void |
setPostalAddress(java.lang.String value)
Sets the postal address used for generating a barcode or the name of the bookmark that refers to it.
|
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, updatepublic java.lang.String getPostalAddress()
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
public void setPostalAddress(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
value - The postal address used for generating a barcode or the name of the bookmark that refers to it.java.lang.Exceptionpublic boolean isBookmark()
getPostalAddress() / setPostalAddress(java.lang.String) is the name of a bookmark.
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
getPostalAddress() / setPostalAddress(java.lang.String) is the name of a bookmark.public void isBookmark(boolean value)
throws java.lang.Exception
getPostalAddress() / setPostalAddress(java.lang.String) is the name of a bookmark.
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
value - Whether getPostalAddress() / setPostalAddress(java.lang.String) is the name of a bookmark.java.lang.Exceptionpublic java.lang.String getFacingIdentificationMark()
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
public void setFacingIdentificationMark(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
value - The type of a Facing Identification Mark (FIM) to insert.java.lang.Exceptionpublic boolean isUSPostalAddress()
getPostalAddress() / setPostalAddress(java.lang.String) is a U.S. postal address.
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
getPostalAddress() / setPostalAddress(java.lang.String) is a U.S.public void isUSPostalAddress(boolean value)
throws java.lang.Exception
getPostalAddress() / setPostalAddress(java.lang.String) is a U.S. postal address.
Examples:
Shows how to use the BARCODE field to display U.S. ZIP codes in the form of a barcode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln();
// Below are two ways of using BARCODE fields to display custom values as barcodes.
// 1 - Store the value that the barcode will display in the PostalAddress property:
FieldBarcode field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
// This value needs to be a valid ZIP code.
field.setPostalAddress("96801");
field.isUSPostalAddress(true);
field.setFacingIdentificationMark("C");
Assert.assertEquals(" BARCODE 96801 \\u \\f C", field.getFieldCode());
builder.insertBreak(BreakType.LINE_BREAK);
// 2 - Reference a bookmark that stores the value that this barcode will display:
field = (FieldBarcode) builder.insertField(FieldType.FIELD_BARCODE, true);
field.setPostalAddress("BarcodeBookmark");
field.isBookmark(true);
Assert.assertEquals(" BARCODE BarcodeBookmark \\b", field.getFieldCode());
// The bookmark that the BARCODE field references in its PostalAddress property
// need to contain nothing besides the valid ZIP code.
builder.insertBreak(BreakType.PAGE_BREAK);
builder.startBookmark("BarcodeBookmark");
builder.writeln("968877");
builder.endBookmark("BarcodeBookmark");
doc.save(getArtifactsDir() + "Field.BARCODE.docx");
value - Whether getPostalAddress() / setPostalAddress(java.lang.String) is a U.S.java.lang.Exceptionpublic int getSwitchType(java.lang.String switchName)