Dev Center
Table of contents

How to Get Detailed Barcode Information

The Dynamsoft Barcode Reader SDK provides APIs for you to get the detailed barcode information like checksum digit, start/stop characters, error correction level, etc. To learn more about what information you can get, see the following items:

  • OneDCodeDetails: C++
  • QRCodeDetails: C++
  • PDF417Details: C++
  • DataMatrixDetails: C++
  • AztecDetails: C++

Here we take QR Code as example and show how to get the version and model of a QR Code.

What is the Version of a QR Code?

QRCode Version Modules
Version 1 21 x 21
Version 2 25 x 25
Version N (17 + N x 4) x (17 + N x 4)
Version 40 177 x 177

What is the Model of a QR Code?

QRCode Model Description
Model 1 The original QR Code. It is a code capable of coding 1,167 numerals with its maximum version being 14 (73 x 73 modules).
Model 2 Created by improving Model 1 so that this code can be read smoothly even if it is distorted in some way. This code can encode up to 7,089 numerals with its maximum version being 40 (177 x 177 modules). Today, the term QRCode usually refers to QRCode Model 2.

Code Snippet for Getting Detailed Barcode Information

  • JavaScript
  • C++
  • Android
  • Objective-C
  • Swift
const result = await cvRouter.capture(file, "ReadSingleBarcode");
for (let item of result.items) {
  if (item.type === Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE) {
    console.log("QR_version: " + item.details.version);
    console.log("QR_model: " + item.details.model);
  }
}
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
CCapturedResult* result = cvr->Capture("IMAGE-FILE-PATH", CPresetTemplate::PT_READ_BARCODES);
if (result->GetErrorCode() != 0) {
    cout << "Error: " << result->GetErrorCode() << "," << result->GetErrorString() << endl;
}
int capturedResultItemCount = result->GetItemsCount();
for (int j = 0; j < capturedResultItemCount; j++) 
{
    const CCapturedResultItem* capturedResultItem = result->GetItem(j);
    CapturedResultItemType type = capturedResultItem->GetType();
    if (type == CapturedResultItemType::CRIT_BARCODE) 
    {
        const CBarcodeResultItem* barcodeResultItem = dynamic_cast<const CBarcodeResultItem*> (capturedResultItem);
        if (barcodeResultItem->GetFormat() == BarcodeFormat::BF_QR_CODE)
        {
            const CQRCodeDetails* detail = dynamic_cast<const CQRCodeDetails*>(barcodeResultItem->GetDetails());
            cout << "Version: " << detail->version;
            cout << "Model: " << detail->model;
        }
    }
}
// more process here
public void onDecodedBarcodesReceived(DecodedBarcodesResult result) {
    if (result != null){
        BarcodeResultItem[] items = result.getItems();
        for (int i=0; i < items.length; i++){
            BarcodeResultItem item = items[i];
            Log.i("DecodedBarcodes", "onDecodedBarcodesReceived: This is the number "+i+" barcode");
            QRCodeDetails qrDetails = (QRCodeDetails) item.getDetails();
            int version = qrDetails.getVersion();
            Log.i("DecodedBarcodes", "The version of the QR barcode is: "+version);
            int model = qrDetails.getModel();
            Log.i("DecodedBarcodes", "The model of the QR barcode is: "+model);
        }
    }
}
- (void)onDecodedBarcodesReceived:(DSDecodedBarcodesResult *)result {
    if (result.items.count > 0) {
        for (DSBarcodeResultItem *item in result.items) {
            DSQRCodeDetails *qrDetails = (DSQRCodeDetails *) item.details;
            NSInteger version = qrDetails.version;
            NSInteger model = qrDetails.model;
        }
    }
}
func onDecodedBarcodesReceived(_ result: DecodedBarcodesResult) {
    if let items = result.items, items.count > 0 {
        for item in items {
            let qrCodeDetails = item.details as! QRCodeDetails
            let version = qrCodeDetails.version
            let model = qrCodeDetails.model
        }
    }
}

This page is compatible for:

Is this page helpful?

YesYes NoNo

latest version

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.21
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.42
    • Version 9.6.40
    • Version 9.6.33
    • Version 9.6.32
    • Version 9.6.31
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • 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
  • Documentation Homepage
Change +