Skip to content

Initialization

To start the initialization process, you need to get the license file first. A demo license can be obtained at our Client Portal.

The initializeReader method is designed to perform the initialization process. It accepts an instance of the RGLConfig class as a configuration object.

The RGLConfig allows you to set the license and other configuration properties. The license is passed to the initializeReader as NSData. For more information, please have a look at the API Reference for RGLConfig.

The initialization is performed fully offline, although by default the SDK attempts to access the licensing server to keep your license updated. You can change this behavior by setting the licenseUpdateCheck property to false in the RGLConfig instance.

Here is an example of how to perform initialization with the license stored in the application bundle:

guard let licensePath = Bundle.main.path(forResource: "regula.license", ofType: nil) else { return }
guard let licenseData = Data(contentsOf: URL(fileURLWithPath: licensePath)) else { return }
let config = DocReader.Config(license: licenseData)

DocReader.shared.initializeReader(config: config) { (success, error) in
    if success {
        // DocumentReader successfully initialized
    } else {
        // DocumentReader not initialized
        print(error)
    }
}
NSString *licensePath = [[NSBundle mainBundle] pathForResource:@"regula.license" ofType:nil];
NSData *licenseData = [NSData dataWithContentsOfFile:licensePath];
RGLConfig *config = [RGLConfig configWithLicenseData:licenseData];

[RGLDocReader.shared initializeReaderWithConfig:config completion:^(BOOL success, NSError *error) {
    if (success) {
        // DocumentReader successfully initialized
    } else {
        // DocumentReader not initialized
        NSLog(@"%@", error);
    }
}];

Next Steps