Skip to content

Commit 43bf2c2

Browse files
Update read-postal-codes.md
1 parent 8076984 commit 43bf2c2

File tree

1 file changed

+64
-25
lines changed

1 file changed

+64
-25
lines changed

programming/usecases/read-postal-codes.md

Lines changed: 64 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Dynamsoft Barcode Reader (DBR) supports the following types of postal codes. Det
2323

2424
## Particular Parameter Required
2525

26-
DBR provides a parameter, [`BarcodeFormatIds`]({{ site.dcv_parameters_reference }}barcode-reader-task-settings/barcode-format-ids.html), to control the formats of the barcode to process. To enable decoding the postal codes, simply set a `BF_POSTALCODE` or a specific postal code format enumeration to this parameter.
26+
DBR provides a parameter, [`BarcodeFormatIds`]({{ site.dcv_parameters_reference }}barcode-reader-task-settings/barcode-format-ids.html){:target="_blank"}, to control the formats of the barcode to process. To enable decoding the postal codes, simply set a `BF_POSTALCODE` or a specific postal code format enumeration to this parameter.
2727

2828
## Sample Code
2929

@@ -33,6 +33,9 @@ You can configure the parameter `BarcodeFormatIds` in two different ways, depend
3333

3434
<div class="sample-code-prefix template2"></div>
3535
>- C++
36+
>- Android
37+
>- Objective-C
38+
>- Swift
3639
>
3740
>
3841
```c++
@@ -46,6 +49,42 @@ settings.barcodeSettings.barcodeFormatIds = BF_POSTALCODE;
4649
// Update the settings.
4750
cvr->UpdateSettings(CPresetTemplate::PT_READ_BARCODES, &settings, szErrorMsg, 256);
4851
```
52+
>
53+
```java
54+
try {
55+
// Obtain current runtime settings. `cvr` is an instance of `CaptureVisionRouter`.
56+
// Here we use `EnumPresetTemplate.PT_READ_BARCODES` as an example. You can change it to your own template name or the name of other preset template.
57+
SimplifiedCaptureVisionSettings captureVisionSettings = cvr.getSimplifiedSettings(EnumPresetTemplate.PT_READ_BARCODES);
58+
captureVisionSettings.barcodeSettings.barcodeFormatIds = BF_POSTALCODE;
59+
// Update the settings. Remember to specify the same template name you used when getting the settings.
60+
cvr.updateSettings(EnumPresetTemplate.PT_READ_BARCODES, captureVisionSettings);
61+
} catch (CaptureVisionRouterException e) {
62+
e.printStackTrace();
63+
}
64+
```
65+
>
66+
```objc
67+
NSError *error;
68+
// Obtain current runtime settings. `cvr` is an instance of `CaptureVisionRouter`.
69+
// Here we use `EnumPresetTemplate.PT_READ_BARCODES` as an example. You can change it to your own template name or the name of other preset template.
70+
DSSimplifiedCaptureVisionSettings *captureVisionSettings = [self.cvr getSimplifiedSettings:DSPresetTemplateReadBarcodes error:&error];
71+
captureVisionSettings.barcodeSettings.barcodeFormatIds = DSBarcodeFormatPostalCode;
72+
// Update the settings. Remember to specify the same template name you used when getting the settings.
73+
[self.cvr updateSettings:DSPresetTemplateReadBarcodes settings:captureVisionSettings error:&error];
74+
```
75+
>
76+
```swift
77+
do{
78+
// Obtain current runtime settings. `cvr` is an instance of `CaptureVisionRouter`.
79+
// Here we use `EnumPresetTemplate.PT_READ_BARCODES` as an example. You can change it to your own template name or the name of other preset template.
80+
let captureVisionSettings = try cvr.getSimplifiedSettings(PresetTemplate.readBarcodes.rawValue)
81+
captureVisionSettings.barcodeSettings?.barcodeFormatIds = .postalCode
82+
// Update the settings. Remember to specify the same template name you used when getting the settings.
83+
try cvr.updateSettings(PresetTemplate.readBarcodes.rawValue, settings: captureVisionSettings)
84+
}catch{
85+
// Add code to do when error occurs.
86+
}
87+
```
4988

5089
* Configure barcode format via `JSON parameter template file`
5190
* update parameter `BarcodeFormatIds` in JSON template
@@ -89,27 +128,27 @@ cvr->UpdateSettings(CPresetTemplate::PT_READ_BARCODES, &settings, szErrorMsg, 25
89128
cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256);
90129
// more process here
91130
```
92-
>
93-
```java
94-
try {
95-
// `cvr` is an instance of `CaptureVisionRouter`.
96-
cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE");
97-
} catch (CaptureVisionRouterException e) {
98-
e.printStackTrace();
99-
}
100-
```
101-
>
102-
```objc
103-
NSError *error;
104-
// `cvr` is an instance of `DSCaptureVisionRouter`.
105-
[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error];
106-
```
107-
>
108-
```swift
109-
do{
110-
//`cvr` is an instance of `CaptureVisionRouter`.
111-
try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE")
112-
}catch{
113-
// Add code to do when error occurs.
114-
}
115-
```
131+
>
132+
```java
133+
try {
134+
// `cvr` is an instance of `CaptureVisionRouter`.
135+
cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE");
136+
} catch (CaptureVisionRouterException e) {
137+
e.printStackTrace();
138+
}
139+
```
140+
>
141+
```objc
142+
NSError *error;
143+
// `cvr` is an instance of `DSCaptureVisionRouter`.
144+
[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error];
145+
```
146+
>
147+
```swift
148+
do{
149+
//`cvr` is an instance of `CaptureVisionRouter`.
150+
try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE")
151+
}catch{
152+
// Add code to do when error occurs.
153+
}
154+
```

0 commit comments

Comments
 (0)