Table of contents
Swift
Objective-C

Migrate from 9.x to 11.x

Dynamsoft Barcode Reader SDK has been refactored to integrate with the DynamsoftCaptureVision (DCV) architecture since version 10.0. This guide helps you upgrade from version 9.x by highlighting the key API changes and providing migration paths.

The actual migration effort depends on which APIs you currently use. In many cases, only the interfaces you actively use need to be updated — review the sections below to identify the changes that affect your integration.

If you are new to the DCV architecture and prefer to start fresh, refer to the User Guide for a quick-start tutorial.

Update the License Key

You may need to update your license key before upgrading to version 11.x.

  • 30-Day Free Trial License: Visit the Request a Trial License page to obtain a free license for evaluation.
  • Annual Online Full License: Your license will continue to work with the new SDK version. Go to Customer Portal to get your license key.
  • Perpetual License: Please contact our sales team to update your license.

Migrate Project Configuration

Since the SDK architecture has changed, you need to update your project configuration including headers, libraries, and runtime files.

Update Headers and Libraries

#include "[INSTALLATION FOLDER]/Include/DynamsoftCaptureVisionRouter.h"

using namespace std;
using namespace dynamsoft::license;
using namespace dynamsoft::cvr;
using namespace dynamsoft::dbr;
using namespace dynamsoft::utility;

#if defined(_WIN64) || defined(_WIN32)
    #ifdef _WIN64
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x64/DynamsoftCorex64.lib")
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x64/DynamsoftLicensex64.lib")
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x64/DynamsoftCaptureVisionRouterx64.lib")
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x64/DynamsoftUtilityx64.lib")
    #else
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x86/DynamsoftCorex86.lib")
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x86/DynamsoftLicensex86.lib")
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x86/DynamsoftCaptureVisionRouterx86.lib")
        #pragma comment(lib, "[INSTALLATION FOLDER]/Dist/Lib/Windows/x86/DynamsoftUtilityx86.lib")
    #endif
#endif

Deploy Runtime Files

  • Copy the folders Templates and Models under [INSTALLATION FOLDER]/Dist/ to the same folder as the executable program.
  • Copy the libraries to the same folder as the executable program.
    • For Windows: Copy ALL *.dll files under [INSTALLATION FOLDER]/Dist/Lib/Windows/[platform]. Replace [platform] with your project’s platform setting.
    • For Linux: Copy ALL *.so files under [INSTALLATION FOLDER]/Dist/Lib/Linux/[platform]. Replace [platform] with your project’s platform setting.

Migrate License Activation Code

Starting from 10.0, we have unified the API for setting licenses across different Dynamsoft products.

Old APIs New APIs
CBarcodeReader.InitLicense CLicenseManager.InitLicense

Migrate Decoding APIs

Single Image Decoding

The APIs for decoding single image have been adjusted as follows:

Old APIs New APIs
CBarcodeReader.DecodeFile CCaptureVisionRouter.Capture or CCaptureVisionRouter.CaptureMultiPages
CBarcodeReader.DecodeFileInMemory CCaptureVisionRouter.Capture or CCaptureVisionRouter.CaptureMultiPages
CBarcodeReader.DecodeBuffer CCaptureVisionRouter.Capture
struct TextResult class CBarcodeResultItem
struct TextResultArray class CCapturedResult
CBarcodeReader.DecodeBase64String CImageIO.ReadFromBase64String + CCaptureVisionRouter.Capture
CBarcodeReader.DecodeDIB Not available.

Video Streaming Decoding

CImageSourceAdapter is added to replace the FrameDecodingParameters and the previous video methods. You should implement CImageSourceAdapter to transfer image data from camera or video file to buffer. The following code snippet demonstrates basic usage of decoding video frames:

class MyVideoSource : public CProactiveImageSourceAdapter 
{
    // You should implement the `HasNextImageToFetch` method to indicate if there is a next frame
    bool HasNextImageToFetch() const override 
    {
        return true;
    }

    // You should implement the `FetchImage` method to get the next frame
    CImageData* FetchImage() override
    {
        // Add code to get the video frame from camera or video file
    }
};

class MyBarcodeResultReceiver: public CCapturedResultReceiver
{
public:
    virtual void OnDecodedBarcodesReceived(CDecodedBarcodesResult* result) {
        // Add code to process the result
    }
};

int main()
{
    CCaptureVisionRouter *cvRouter = new CCaptureVisionRouter;

    // Create your video source and bind it to the router
    MyVideoSource *source = new MyVideoSource;
    cvRouter->SetInput(source);

    // Create a CCapturedResultReceiver instance 
    MyBarcodeResultReceiver *barcodesReceiver = new MyBarcodeResultReceiver;
    cvRouter->AddResultReceiver(barcodesReceiver);

    // Start capturing
    char errorMsg[512] = {0};
    int errorCode = cvRouter->StartCapturing(CPresetTemplate::PT_READ_BARCODES, true, errorMsg, 512);

    delete barcodesReceiver;
    delete source;
    delete cvRouter;
}

Upgrade Template Files

The template file format has changed in the new version. Templates created for version 9.x are not compatible with version 11.x. Use the Template Upgrade Tool to automatically convert your existing templates to the new format.

Migrate Template APIs

The template-based APIs have been updated as follows:

Old APIs New APIs
CBarcodeReader.InitRuntimeSettingsWithFile CCaptureVisionRouter.InitSettingsFromFile
CBarcodeReader.InitRuntimeSettingsWithString CCaptureVisionRouter.InitSettings
CBarcodeReader.OutputSettingsToFile CCaptureVisionRouter.OutputSettingsToFile
CBarcodeReader.OutputSettingsToString CCaptureVisionRouter.OutputSettings
CBarcodeReader.ResetRuntimeSettings CCaptureVisionRouter.ResetSettings
CBarcodeReader.AppendTplFileToRuntimeSettings Not available.
CBarcodeReader.AppendTplStringToRuntimeSettings Not available.

Migrate Runtime Settings

The struct PublicRuntimeSettings has been refactored. It retains commonly used properties while removing the previously complex property settings, which are now exclusively supported through templates.

The APIs for accessing and updating PublicRuntimeSettings have been adjusted as follows:

Old APIs New APIs
CBarcodeReader.GetRuntimeSettings CCaptureVisionRouter.GetSimplifiedSettings
CBarcodeReader.UpdateRuntimeSettings CCaptureVisionRouter.UpdateSettings

Properties with Direct API Replacement

The following properties are replaced by similar properties under SimplifiedCaptureVisionSettings or SimplifiedBarcodeReaderSettings. They can also be set via a template file.

SimplifiedCaptureVisionSettings

PublicRuntimeSettings Property SimplifiedCaptureVisionSettings Parameter Template File Parameter
region roi & roiMeasuredInPercentage TargetROIDef.Location.Offset
timeout timeout CaptureVisionTemplates.Timeout

SimplifiedBarcodeReaderSettings

PublicRuntimeSettings Property SimplifiedBarcodeReaderSettings Property Template File Parameter
minBarcodeTextLength minBarcodeTextLength BarcodeFormatSpecification.BarcodeTextLengthRangeArray
minResultConfidence minResultConfidence BarcodeFormatSpecification.MinResultConfidence
localizationModes localizationModes BarcodeReaderTaskSetting.LocalizationModes
expectedBarcodesCount expectedBarcodesCount BarcodeReaderTaskSetting.ExpectedBarcodesCount
barcodeFormatIds barcodeFormatIds BarcodeReaderTaskSetting.BarcodeFormatIds
barcodeFormatIds_2 barcodeFormatIds BarcodeReaderTaskSetting.BarcodeFormatIds
deblurModes deblurModes BarcodeReaderTaskSetting.DeblurModes
deblurLevel deblurModes BarcodeReaderTaskSetting.DeblurModes
maxAlgorithmThreadCount maxThreadsInOneTask BarcodeReaderTaskSetting.MaxThreadsInOneTask

Remarks:

  • The 2 groups of barcode formats are merged.
  • DeblurLevel is deprecated. You can use DeblurModes instead.
FurtherModes Property SimplifiedBarcodeReaderSettings Property Template File Parameter
grayscaleTransformationModes grayscaleTransformationModes ImageParameter.GrayscaleTransformationModes
imagePreprocessingModes grayscaleEnhancementModes ImageParameter.GrayscaleEnhancementModes

Remarks: The mode IPM_MORPHOLOGY of imagePreprocessingModes is migrated to BinarizationModes. The mode arguments MorphOperation, MorphOperationKernelSizeX, MorphOperationKernelSizeY, MorphShape are now available for all modes of BinarizationModes.

Properties Requiring Template File

The following properties can only be set via a template file. Please call CBarcodeReader.OutputSettingsToFile first with the old version to export the settings and then use the template upgrade tool to upgrade your template.

PublicRuntimeSettings Property Template File Parameter
scaleDownThreshold ImageParameter.ImageScaleSettings
binarizationModes ImageParameter.BinarizationModes
textResultOrderModes BarcodeReaderTaskSetting.TextResultOrderModes
returnBarcodeZoneClarity BarcodeReaderTaskSetting.ReturnBarcodeZoneClarity
scaleUpModes BarcodeReaderTaskSetting.BarcodeScaleModes
barcodeZoneMinDistanceToImageBorders BarcodeFormatSpecification.BarcodeZoneMinDistanceToImageBorders
FurtherModes Property Template File Parameter
colourConversionModes ImageParameter.ColourConversionModes
regionPredetectionModes BarcodeReaderTaskSetting.RegionPredetectionModes
textureDetectionModes ImageParameter.TextureDetectionModes
textFilterModes ImageParameter.TextDetectionMode & ImageParameter.IfEraseTextZone
dpmCodeReadingModes BarcodeReaderTaskSetting.DPMCodeReadingModes
deformationResistingModes BarcodeReaderTaskSetting.DeformationResistingModes
barcodeComplementModes BarcodeReaderTaskSetting.BarcodeComplementModes

Properties Migrated to Other APIs

The PDF properties of PublicRuntimeSettings are moved to set via the setPDFReadingParameter method of CDirectoryFetcher and CFileFetcher with a CPDFReadingParameter parameter.

PublicRuntimeSettings Property
pdfReadingMode
pdfRasterDPI

Removed Properties (No Replacement)

The following properties are removed.

PublicRuntimeSettings Property
barcodeColourModes
intermediateResultTypes
intermediateResultSavingMode
resultCoordinateType
terminatePhase
FurtherModes Property
colourClusteringModes

This page is compatible for: