Skip to content

Commit 42b3251

Browse files
author
Aleksander Grinin
committed
Add articles to /java/developer-guide/complex-barcode/ section
1 parent 3fe2a05 commit 42b3251

4 files changed

Lines changed: 62 additions & 32 deletions

File tree

java/developer-guide/complex-barcode/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Complex Barcode"
33
description: "Learn how to generate, read, decode, and troubleshoot structured complex barcodes with Aspose.BarCode for Java."
44
type: docs
5-
weight: 40
5+
weight: 60
66
url: /java/developer-guide/complex-barcode/
77
---
88

java/developer-guide/complex-barcode/examples/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Complete Complex Barcode Examples"
33
description: "Explore complete end-to-end workflows for generating, recognizing, decoding, and validating complex barcodes."
44
type: docs
5-
weight: 40
5+
weight: 50
66
url: /java/developer-guide/complex-barcode/examples/
77
---
88

java/developer-guide/complex-barcode/supported_types/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Supported Complex Barcode Types"
33
description: "Explore the complex barcode standards supported by Aspose.BarCode for Java."
44
type: docs
5-
weight: 50
5+
weight: 40
66
url: /java/developer-guide/complex-barcode/supported_types/
77
---
88

java/developer-guide/complex-barcode/supported_types/usa_driver_id/_index.md

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,79 +28,109 @@ codetext.setNumberOfEntries(1);
2828
codetext.setSubfileDesignator(
2929
List.of(
3030
new USADriveIdCodetext
31-
.SubfileProperties("DL")
31+
.SubfileProperties("DL")
3232
)
33-
);
33+
);
3434
```
3535

3636
## Configure mandatory fields
3737

38+
The mandatory AAMVA data includes identity, document, address, physical-description, and truncation fields. The following example matches the complete set used in the related TestNG class.
39+
3840
```java
3941
USADriveIdCodetext.MandatoryFields fields =
4042
new USADriveIdCodetext.MandatoryFields();
4143

4244
fields.setVehicleClass("C");
43-
fields.setExpirationDate(
44-
LocalDate.of(2030, 12, 31)
45-
);
45+
fields.setRestrictionCodes("NONE");
46+
fields.setEndorsementCodes("NONE");
47+
48+
fields.setExpirationDate(LocalDate.of(2030, 12, 31));
49+
4650
fields.setFamilyName("DOE");
4751
fields.setFirstName("JOHN");
48-
fields.setDateOfBirth(
49-
LocalDate.of(1990, 5, 20)
50-
);
52+
fields.setMiddleName("Q");
53+
54+
fields.setIssueDate(LocalDate.of(2026, 1, 1));
55+
56+
fields.setDateOfBirth(LocalDate.of(1990, 5, 20));
57+
5158
fields.setSex(USADriveIdSex.MALE);
52-
fields.setEyeColor(
53-
USADriveIdEyeColor.BROWN
54-
);
59+
fields.setEyeColor(USADriveIdEyeColor.BROWN);
60+
fields.setHeight("070 in");
61+
62+
fields.setAddressStreet1("123 MAIN STREET");
63+
fields.setAddressCity("ANYTOWN");
5564
fields.setAddressState("CA");
65+
fields.setAddressPostalCode("90210");
66+
5667
fields.setCustomerIDNumber("D1234567");
68+
fields.setDocumentDiscriminator("DOC123456789");
69+
70+
fields.setCountryIdentification(USADriveIdCountry.US);
71+
72+
fields.setFamilyNameTruncation("N");
73+
fields.setFirstNameTruncation("N");
74+
fields.setMiddleNameTruncation("N");
5775

5876
codetext.setMandatoryElements(fields);
5977
```
6078

79+
These values are serialized into the AAMVA data structure before the PDF417 carrier is generated.
80+
6181
## Configure optional fields
6282

6383
```java
6484
USADriveIdCodetext.OptionalFields optional =
6585
new USADriveIdCodetext.OptionalFields();
6686

67-
optional.setHairColor(
68-
USADriveIdHairColor.BROWN
69-
);
87+
optional.setHairColor(USADriveIdHairColor.BROWN);
7088
optional.setOrganDonorIndicator("1");
7189

7290
codetext.setOptionalElements(optional);
7391
```
7492

93+
Optional fields extend the cardholder data without replacing the mandatory AAMVA elements.
94+
7595
## Generate the PDF417 carrier
7696

7797
```java
78-
ComplexBarcodeGenerator generator =
79-
new ComplexBarcodeGenerator(codetext);
98+
ComplexBarcodeGenerator generator = new ComplexBarcodeGenerator(codetext);
8099

81-
generator.save(
82-
"usa_driver_id.png",
83-
BarCodeImageFormat.PNG
84-
);
100+
generator.save("usa_driver_id.png",BarCodeImageFormat.PNG);
85101
```
86102

87-
Recognize the result with `DecodeType.PDF_417`.
103+
Recognize the generated image with `DecodeType.PDF_417`.
104+
105+
```java
106+
BarCodeReader reader = new BarCodeReader("usa_driver_id.png",DecodeType.PDF_417);
107+
108+
BarCodeResult[] results = reader.readBarCodes();
109+
```
88110

89111
## Decode Driver ID data
90112

91113
```java
92-
USADriveIdCodetext decoded =
93-
ComplexCodetextReader.tryDecodeUSADriveId(
94-
results[0].getCodeText()
95-
);
114+
USADriveIdCodetext decoded = ComplexCodetextReader.tryDecodeUSADriveId(results[0].getCodeText());
115+
```
116+
117+
After decoding, the mandatory and optional objects can be accessed directly.
118+
119+
```java
120+
String familyName = decoded.getMandatoryElements().getFamilyName();
121+
122+
String documentNumber = decoded.getMandatoryElements().getCustomerIDNumber();
123+
124+
USADriveIdHairColor hairColor = decoded.getOptionalElements().getHairColor();
96125
```
97126

98-
Validate issuer, AAMVA version, identity, document, address, physical-description, and optional cardholder fields.
127+
Validate issuer, AAMVA version, identity, document, address, physical-description, truncation, and optional cardholder fields.
99128

100129
## Recommendations
101130

102-
- Populate every mandatory AAMVA field.
131+
- Populate every mandatory AAMVA field required by the selected format.
103132
- Use the correct AAMVA and jurisdiction versions.
104-
- Preserve required field formats.
133+
- Preserve required date, height, address, and document formats.
134+
- Set truncation indicators explicitly when required by the data format.
105135
- Recognize the carrier as PDF417.
106-
- Validate mandatory and optional decoded fields.
136+
- Validate both mandatory and optional decoded fields.

0 commit comments

Comments
 (0)