Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Dev Center
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

How to read Postal codes

Sample Code

The following code snippet shows how to set the parameter via RuntimeSettings to read Postal code.

  • JavaScript
  • C
  • C++
  • C#
  • Java
  • Android
  • Objective-C
  • Swift
  • Python
const scanner = scanner || await Dynamsoft.DBR.BarcodeScanner.createInstance();
let settings = await scanner.getRuntimeSettings();
// Sets barcode formats to read Postal Code.
settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_NULL;
settings.barcodeFormatIds_2 = Dynamsoft.DBR.EnumBarcodeFormat_2.BF2_POSTALCODE;
await scanner.updateRuntimeSettings(settings);
scanner.onUniqueRead = (txt, result) => {
    rawString = txt;
};
await scanner.show();
int iRet = -1;
char errorBuf[512];
iRet = DBR_InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
if (iRet != DBR_OK)
{
    printf("%s\n", errorBuf);
}
void* barcodeReader = DBR_CreateInstance();
PublicRuntimeSettings runtimeSettings;
DBR_GetRuntimeSettings(barcodeReader, &runtimeSettings); //Get the current RuntimeSettings
runtimeSettings.barcodeFormatIds = BF_NULL;
runtimeSettings.barcodeFormatIds_2 = BF2_POSTALCODE;
DBR_UpdateRuntimeSettings(barcodeReader, &runtimeSettings, errorBuf, 512); // Update RuntimeSettings with above setting
DBR_DecodeFile(barcodeReader, "YOUR-IMAGE-FILE-WITH-POSTAL-CODES", ""); // Start decoding
// Add further process
char errorBuf[512];
int iRet = -1;
iRet = dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
if (iRet != DBR_OK)
{
    cout << errorBuf << endl;
}
CBarcodeReader* reader = new CBarcodeReader();
PublicRuntimeSettings* runtimeSettings = new PublicRuntimeSettings();
reader->GetRuntimeSettings(runtimeSettings); //Get the current RuntimeSettings
runtimeSettings->barcodeFormatIds = BF_NULL;
runtimeSettings->barcodeFormatIds_2 = BF2_POSTALCODE;
reader->UpdateRuntimeSettings(runtimeSettings, errorBuf, 512); // Update RuntimeSettings with above setting
reader->DecodeFile("YOUR-IMAGE-FILE-WITH-POSTAL-CODES", ""); // Start decoding
// Add further process
string errorMsg;
EnumErrorCode iRet = BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
if (iRet != EnumErrorCode.DBR_SUCCESS)
{
    Console.WriteLine(errorMsg);
}
BarcodeReader reader = new BarcodeReader();
PublicRuntimeSettings settings = reader.GetRuntimeSettings(); //Get the current RuntimeSettings
settings.BarcodeFormatIds = (int)EnumBarcodeFormat.BF_NULL;
settings.BarcodeFormatIds_2 = (int)EnumBarcodeFormat_2.BF2_POSTALCODE;
reader.UpdateRuntimeSettings(settings); // Update RuntimeSettings with above setting
TextResult[] result = reader.DecodeFile("YOUR-IMAGE-FILE-WITH-POSTAL-CODES", ""); // Start decoding
// Add further process
BarcodeReader.initLicense("YOUR-LICENSE-KEY");
BarcodeReader reader = new BarcodeReader();
PublicRuntimeSettings settings = reader.getRuntimeSettings(); //Get the current RuntimeSettings
settings.barcodeFormatIds = EnumBarcodeFormat.BF_NULL;
settings.barcodeFormatIds_2 = EnumBarcodeFormat_2.BF2_POSTALCODE;
reader.updateRuntimeSettings(settings); // Update RuntimeSettings with above setting
TextResult[] result = reader.decodeFile("YOUR-IMAGE-FILE-WITH-POSTAL-CODES", ""); // Start decoding
// Add further process
BarcodeReader reader = new BarcodeReader();
PublicRuntimeSettings settings = reader.getRuntimeSettings(); //Get the current RuntimeSettings
settings.barcodeFormatIds = EnumBarcodeFormat.BF_NULL;
settings.barcodeFormatIds_2 = EnumBarcodeFormat_2.BF2_POSTALCODE;
reader.updateRuntimeSettings(settings); // Update RuntimeSettings with above setting
TextResult[] result = reader.decodeFile("YOUR-IMAGE-FILE-WITH-POSTAL-CODES"); // Start decoding
// Add further process
NSError* err = nil;
DynamsoftBarcodeReader *reader = [[DynamsoftBarcodeReader alloc] init];
iPublicRuntimeSettings *settings = [reader getRuntimeSettings:&err]; //Get the current RuntimeSettings
settings.barcodeFormatIds = EnumBarcodeFormatNULL;
settings.barcodeFormatIds_2 = EnumBarcodeFormat2POSTALCODE;
[reader updateRuntimeSettings:settings error:&err]; // Update RuntimeSettings with above setting
NSArray<iTextResult*>* result = [reader decodeFileWithName:@"YOUR-IMAGE-FILE-WITH-POSTAL-CODES" error:&err]; // Start decoding
// Add further process
let reader = DynamsoftBarcodeReader()
let settings = try? reader.getRuntimeSettings() //Get the current RuntimeSettings
settings?.barcodeFormatIds = EnumBarcodeFormat.NULL
settings?.barcodeFormatIds_2 = EnumBarcodeFormat2.POSTALCODE
try? reader.updateRuntimeSettings(settings) // Update RuntimeSettings with above setting
let result = try? reader.decodeFileWithName("YOUR-IMAGE-FILE-WITH-POSTAL-CODES") // Start decoding
// Add further process
error = BarcodeReader.init_license("YOUR-LICENSE-KEY")
if error[0] != EnumErrorCode.DBR_OK:
    print(error[1])
dbr = BarcodeReader()
settings = dbr.get_runtime_settings()
settings.barcode_format_ids = EnumBarcodeFormat.BF_NULL
settings.barcode_format_ids_2 = EnumBarcodeFormat.BF2_POSTALCODE
dbr.update_runtime_settings(settings)
text_results = dbr.decode_file("YOUR-IMAGE-FILE-WITH-POSTAL-CODES")
# Add further process

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    • Version 9.x
      • Version 9.6.0
      • Version 9.4.0
      • Version 9.2.0
      • Version 9.0.0
    • Version 8.x
      • Version 8.8.0
      • Version 8.6.0
      • Version 8.4.0
      • Version 8.2.0
      • Version 8.1.2
      • Version 8.1.0
      • Version 8.0.0
    • Version 7.x
      • Version 7.6.0
      • Version 7.5.0
    Change +