Custom settings

This page covers the description of custom settings

Contents

Process Params

Document processing

Multipage processing

Allows to process more than one page of the document (if they are exist) for several iterations:

DocReader.shared.processParams.multipageProcessing = true

If multipage processing is enabled, the SDK processes the front side of the document recognizes document type and checks in the database how many pages are available for this document. If there are any child documents (second page, back side) for this document type, multipage processing is triggered. It concerns scenarios which recognize document type.

The only exception is MrzAndLocate and Locate scenarios. In this case, if SDK detects an ID1-sized document, it will ask for the second page. Multi-page processing is not triggered for documents of other formats.

Double-page spread processing

Allows to process up to two pages of the document (so-called "a double-page spread") for one-shot if they are presented on the frame (image):

This option is available for the following scenarios: DocType, Ocr, FullProcess, MrzOrBarcodeOrOcr, MrzOrOcr, LocateVisual_And_MrzOrOcr.

DocReader.shared.processParams.doublePageSpread = true

Authenticity

Allows you to define whether a document's holograms have to be checked:

DocReader.shared.processParams.checkHologram = true

Timeouts

Allows you to set the time limit for document recognition (in seconds), beyond which the recognition does not continue regardless of its result. The countdown starts from the moment the scenario starts:

DocReader.shared.processParams.timeout = 20

Allows you to set the time limit for document recognition (in seconds), beyond which the recognition does not continue regardless of its result. The countdown starts from the moment the document is detected:

DocReader.shared.processParams.timeoutFromFirstDetect = 5

Allows you to set the time limit for document recognition (in seconds), beyond which the recognition does not continue regardless of its result. The countdown starts from the moment the document type is recognized:

DocReader.shared.processParams.timeoutFromFirstDocType = 3

Display formats

You can change the format string of displayed dates in the results. Mask examples: "dd/mm/yyyy", "mm/dd/yyyy", "dd-mm-yyyy", "mm-dd-yyyy", "dd/mm/yy":

DocReader.shared.processParams.dateFormat = "dd-mm-yyyy"

Allows you to change the measure system:

DocReader.shared.processParams.measureSystem = MeasureSystem.metric

Logs

If set, Core logs will be written to the console:

DocReader.shared.processParams.logs = true

If set, deep logs will be saved (in case of reading problems). Turn on/off logs saving:

DocReader.shared.processParams.debugSaveLogs = true

If set, input images will be saved (in case of reading problems). Turn on/off images saving:

DocReader.shared.processParams.debugSaveImages = true

If set, input images will be cropped and saved. Turn on/off image saving:

DocReader.shared.processParams.debugSaveCroppedImages = true

Allows to save RFID session data to the file in binary format:

DocReader.shared.processParams.debugSaveRFIDSession = true

Allows you to get the path to the folder of the current session. Before using this, enable save logs. Each new session provides different path:

DocReader.shared.processParams.sessionLogFolder

If set, personal information will be removed from logs:

DocReader.shared.processParams.depersonalizeLog = true

Scenario

Set proper scenario. You can find information of how to get available scenarios here:

DocReader.shared.processParams.scenario = RGL_SCENARIO_BARCODE

You can assign to Capture button a scenario. This scenario will be used if you press the button:

DocReader.shared.processParams.captureButtonScenario = RGL_SCENARIO_LOCATE

Barcode types

Set the types of barcodes that you wish to process:

DocReader.shared.processParams.barcodeTypes = [BarcodeType.QRCODE.rawValue as NSNumber, BarcodeType.AZTEC.rawValue as NSNumber]

There are documents that contain barcodes which data can be parsed only if document type verification is performed. The following property allows setting the barcode parser type which should be used during recognition. It allows parsing barcode data without performing document type verification:

DocReader.shared.processParams.barcodeParserType = 123

Filters

Set the list of the document ID's to process. All documents will be processed, if empty:

DocReader.shared.processParams.documentIDList = [-274257313, -2004898043]

If you read document which contains MRZ, all fields will be extracted. If you read document with OCR, you can set the list of field types that you wish to extract, other fields will be skipped during processing. All fields will be extracted, if the fieldTypesFilter is empty:

DocReader.shared.processParams.fieldTypesFilter = [FieldType.ft_Date_of_Expiry.rawValue as NSNumber]

If set, in case required fields are not read, their values will be empty:

DocReader.shared.processParams.checkRequiredTextFields = true

Detection

If you enable this parameter, document focus check will be omitted:

DocReader.shared.processParams.disableFocusingCheck = true

Allows you to set the maximum value of the deviation of the corners of the document from the value of 90 degrees:

DocReader.shared.processParams.perspectiveAngle = 5

Output images

If set, an original (uncropped) image will be received, which is sent to Core for processing:

DocReader.shared.processParams.returnUncroppedImage = true

Allows to build an integral image, taking into account the quality of fixation of each of the individual images:

DocReader.shared.processParams.integralImage = true

Allows you to set the minimum acceptable DPI value:

DocReader.shared.processParams.minDPI = 100

If set, an image with cropped barcode will be returned:

DocReader.shared.processParams.returnCroppedBarcode = true

Custom params

Allows you to set a custom JSON which should be processed along with other process params:

// allows you to depersonalize the document's data
let data = [["allTextFields": true], ["allGraphicFields": true]]
DocReader.shared.processParams.customParams = ["dePersonalize": data]

// allows you to set the maximum DPI for an output image (if set to zero, an image won't be resized):
DocReader.shared.processParams.customParams = ["imageDpiOutMax": 0]

Bounds

Allows you to manually set the document's bounds:

DocReader.shared.processParams.manualCrop = true

Other

Allows you to manually set the document's bounds:

DocReader.shared.processParams.resultTypeOutput = [ResultType.mrzOCRExtended.rawValue as NSNumber, ResultType.visualOCRExtended.rawValue as NSNumber]

Returns 2 aligned and straighten passport pages from input image as if it was captured from the flatbed scanner:

DocReader.shared.processParams.generateDoublePageSpreadImage = true

Allows you to set the maximum DPI for an output image (if set to zero, an image won't be resized):

DocReader.shared.processParams.imageDpiOutMax = 300

This option can be set to true if you know for sure that the image you provide contains an already cropped document by its edges.

DocReader.shared.processParams.alreadyCropped = true

Allows to use specific template ID and skip document type identification step:

DocReader.shared.processParams.forceDocID = 123

Allows to ignore assumptions based on the field mask in the template:

DocReader.shared.processParams.matchTextFieldMask = true

When enabled, shorten the list of candidates to process during document detection in a single image process mode. Reduces processing time for specific backgrounds:

DocReader.shared.processParams.fastDocDetect = true

When enabled, OCR validity fails if there is a glare over the text field on the image:

DocReader.shared.processParams.updateOCRValidityByGlare = true

When enabled no graphic fields will be cropped from document image:

DocReader.shared.processParams.noGraphics = true

Specifies minimal area of the image that document should cover to be treated as candidate when locating. Value should be in range from 0 to 1, where 1 is when document should fully cover the image.

DocReader.shared.processParams.documentAreaMin = 0.7

Allows to shift the date of expiry into the future or past for number of months specified:

DocReader.shared.processParams.shiftExpiryDate = 1

This options allows specifying the minimal age in years of the document holder:

DocReader.shared.processParams.minimalHolderAge = 18

Guarantees that output image will contain correct MRZ on it in series process mode:

DocReader.shared.processParams.forceReadMrzBeforeLocate = true

Guarantees that output image will contain correct MRZ on it in series process mode:

DocReader.shared.processParams.mrzFormatsFilter = [MRZFormat.ID2.rawValue as NSNumber, MRZFormat.ID1.rawValue as NSNumber]

If actual document dpi is below this threshold, check will fail:

DocReader.shared.processParams.imageQA.dpiThreshold = 150

If actual document perspective angle is above this threshold, check will fail:

DocReader.shared.processParams.imageQA.angleThreshold = 5

This option disabled focus check during performing image quality validation:

DocReader.shared.processParams.imageQA.focusCheck = true

This option disabled glares check during performing image quality validation:

DocReader.shared.processParams.imageQA.glaresCheck = true

This option disabled colorness check during performing image quality validation:

DocReader.shared.processParams.imageQA.colornessCheck = true

This option disabled moire patterns check during performing image quality validation:

DocReader.shared.processParams.imageQA.moireCheck = true

Functionality

Camera Frame

Set this setting to override default cropping frame on camera activity provided by scenario:

DocReader.shared.functionality.cameraFrame = DocReaderFrame.max

Buttons

Show/hide torch button:

DocReader.shared.functionality.showTorchButton = true

Show/hide close button:

DocReader.shared.functionality.showCloseButton = true

You can close camera view manually using _DocReader.shared.stopScanner() _function.

Capture allows to take picture and process it as single frame. Show/hide capture button:

DocReader.shared.functionality.showCaptureButton = true

You can set the time interval when Capture button should be displayed after the document is detected. 5 seconds is used by default:

DocReader.shared.functionality.showCaptureButtonDelayFromDetect = 5

You can set the time interval when Capture button should be displayed after the scanning process is started. 10 seconds is used by default:

DocReader.shared.functionality.showCaptureButtonDelayFromStart = 10

If set, frame expanding button will be shown on video capture screen. Show/hide change frame button:

DocReader.shared.functionality.showChangeFrameButton = true

Show/hide skip next page button:

DocReader.shared.functionality.showSkipNextPageButton = true

Show/hide the button for switching between cameras during processing:

DocReader.shared.functionality.showCameraSwitchButton = true

Detection

DocumentReader will receive data from Motion Sensor and pause scanning when device is moving. Turn on/off video capture motion control:

DocReader.shared.functionality.videoCaptureMotionControl = true

If set, scanning will be paused while camera is focusing (it can decrease camera processing speed):

DocReader.shared.functionality.skipFocusingFrames = true

Orientation

Defines orientation of activities by using one of UIInterfaceOrientationMask members:

DocReader.shared.functionality.orientation = UIInterfaceOrientationMask.portrait

Scanning modes

Allows you to set the scanning mode:

DocReader.shared.functionality.captureMode = CaptureMode.captureVideo

Allows you to control in the multipage processing mode:

Code samples

Do not use multipageProcessing and this one at the same time.

DocReader.shared.functionality.manualMultipageMode = true

Video Settings

Set the frame resolution. Use on of AVCaptureSession.Preset members:

DocReader.shared.functionality.videoSessionPreset = AVCaptureSession.Preset.hd1920x1080

If set, allows you to adjust a zoom level using the pinch gesture (its range from 1x to 10x):

DocReader.shared.functionality.isZoomEnabled = true

Allows you to set the desired zoom level (its range from 1x to 10x):

DocReader.shared.functionality.zoomFactor = 2.0

Allows you to record the scanning process:

Make sure to conform to the RecordScanningProcessDelegate protocol.

DocReader.shared.functionality.recordScanningProcess = true
DocReader.shared.functionality.recordScanningProcessDelegate = self

Single Result

If set, the result will be displayed as soon as it is received:

DocReader.shared.functionality.singleResult = true

Capture Device Position

You can specify the position of a capture device for video session:

DocReader.shared.functionality.cameraPosition = AVCaptureDevice.Position.back

Extra info

If set, the metadata will be displayed over the camera preview during document processing, namely the perspective angle value:

DocReader.shared.functionality.showMetadataInfo = true

Customization

Camera Frame

Set thickness of document bounds border on the video preview (dp):

DocReader.shared.customization.cameraFrameBorderWidth = 10

Hex string of document bounds border color in default state:

DocReader.shared.customization.cameraFrameDefaultColor = UIColor.red

Hex string of document bounds border color in document detected state:

DocReader.shared.customization.cameraFrameActiveColor = UIColor.purple

Defines the shape of document bounds border:

DocReader.shared.customization.cameraFrameShapeType = CameraFrameShapeType.corners

Defines the length (dp) of the corner side in shape mode corners:

DocReader.shared.customization.cameraFrameLineLength = 25

Frame is cropped by camera frame. Any changes with camera frame may alter scanning process. You can change the default camera frame view, even remove it. Discover Functionality page to find out how to do it.

Allows to change the corners' radius of the camera frame:

DocReader.shared.customization.cameraFrameCornerRadius = 10

Allows to customize the beginning and ending of stroked lines of the camera frame:

DocReader.shared.customization.cameraFrameLineCap = CGLineCap.round

Allows to specify the offsetWidth for the camera frame (only for the portrait orientation):

DocReader.shared.customization.cameraFrameOffsetWidth = 50

Allows to change the aspect ratio of the camera frame for portrait mode:

DocReader.shared.customization.cameraFramePortraitAspectRatio = 1.0

Allows to change the aspect ratio of the camera frame for landscape mode:

DocReader.shared.customization.cameraFrameLandscapeAspectRatio = 1.0

Allows to change the position of the camera frame vertically:

DocReader.shared.customization.cameraFrameVerticalPositionMultiplier = 0.5

Buttons

Allows you to change the Torch button's icon for both ON and OFF states:

// For the ON state
DocReader.shared.customization.torchButtonOnImage = UIImage(named: "icon")

// For the OFF state
DocReader.shared.customization.torchButtonOffImage = UIImage(named: "icon")

Allows you to change the Close button's icon:

DocReader.shared.customization.closeButtonImage = UIImage(named: "icon")

Allows you to change the Capture button's icon:

DocReader.shared.customization.captureButtonImage = UIImage(named: "icon")

Allows you to change the Change Frame button's icon for both ON and OFF states:

// For the ON state
DocReader.shared.customization.changeFrameButtonExpandImage = UIImage(named: "icon")

// For the OFF state
DocReader.shared.customization.changeFrameButtonCollapseImage = UIImage(named: "icon")

Allows you to change the Camera Switch button's icon:

DocReader.shared.customization.cameraSwitchButtonImage = UIImage(named: "icon")

Allows you to change the size of the toolbar (the area where the buttons are located):

DocReader.shared.customization.toolbarSize = 46.0

Status Message

Set a status message next to the frame:

DocReader.shared.customization.status = "Hello"

Turn on/off status message:

DocReader.shared.customization.showStatusMessages = true

Set the text font for the status message, so-called hint message:

DocReader.shared.customization.statusTextFont = UIFont.italicSystemFont(ofSize: 14)

Hex string of main text status color:

DocReader.shared.customization.statusTextColor = UIColor.red

Hex string of current text status background color:

DocReader.shared.customization.statusBackgroundColor = UIColor.green

Allows you to change the location of the status. For example, if you set the multiplier to 0.5 and the number of pixels by vertical is equal to 800, your message will be centralized and located at 200 px from top, i.e. (800 / 2) * 0.5 = 200 px. If multiplier is equal to 1, the message will be centered. If multiplier is equal to zero, default location will be used:

DocReader.shared.customization.statusPositionMultiplier = 0.5

Result Status Message

Set a result status message next to the frame:

DocReader.shared.customization.resultStatus = "Hello"

Turn on/off result status message:

DocReader.shared.customization.showResultStatusMessages = true

Set the text font for the current status:

DocReader.shared.customization.resultStatusTextFont = UIFont.italicSystemFont(ofSize: 14)

Hex string of current text status color:

DocReader.shared.customization.resultStatusTextColor = UIColor.purple

Hex string of current text status background color:

DocReader.shared.customization.resultStatusBackgroundColor = UIColor.red

Allows you to change the location of the results status. For example, if you set the multiplier to 0.5 and the number of pixels by vertical is equal to 800, your message will be centralized and located at 200 px from top, i.e. (800 / 2) * 0.5 = 200 px. If multiplier is equal to 1, the message will be centered. If multiplier is equal to zero, default location will be used:

DocReader.shared.customization.resultStatusPositionMultiplier = 0.5

Custom Status Message

Allows to create a custom status as NSAttributedString:

DocReader.shared.customization.customLabelStatus = NSAttributedString(string: "Hello, world!", attributes: [NSAttributedString.Key.foregroundColor: UIColor.red, NSAttributedString.Key.font: UIFont.italicSystemFont(ofSize: 18)])

Allows you to change the location of the custom status. For example, if you set the multiplier to 0.5 and the number of pixels by vertical is equal to 800, your message will be centralized and located at 200 px from top, i.e. (800 / 2) * 0.5 = 200 px. If multiplier is equal to 1, the message will be centered. If multiplier is equal to zero, default location will be used:

DocReader.shared.customization.customStatusPositionMultiplier = 1.0

Animation

If set, animation showing how to position document will be displayed. Show/hide help animation:

DocReader.shared.customization.showHelpAnimation = true

You can set image for the help animation. If not set, default image will be used:

DocReader.shared.customization.helpAnimationImage = UIImage(named: "icon")

Allows to change the content mode of the help animation image, use one of UIView.ContentMode members:

DocReader.shared.customization.helpAnimationImageContentMode = UIView.ContentMode.scaleAspectFit

If set, expecting page turn animation will be shown. Turn on/off next page animation:

DocReader.shared.customization.showNextPageAnimation = true

You can set front image for the multipage animation. If not set, default image will be used:

DocReader.shared.customization.multipageAnimationFrontImage = UIImage(named: "icon")

Allows to change the content mode of the front image of the multipage animation, use one of UIView.ContentMode members:

DocReader.shared.customization.multipageAnimationFrontImageContentMode = UIView.ContentMode.scaleAspectFit

You can set a back image for the multipage animation. If not set, default image will be used:

DocReader.shared.customization.multipageAnimationBackImage = UIImage(named: "icon")

Allows to change the content mode of the back image of the multipage animation, use one of UIView.ContentMode members:

DocReader.shared.customization.multipageAnimationBackImageContentMode = UIView.ContentMode.scaleAspectFit

Visual Elements

Hex string of visual elements color (one for all):

DocReader.shared.customization.tintColor = UIColor.red

Skip Button

Hex string of page skipping button background:

DocReader.shared.customization.multipageButtonBackgroundColor = UIColor.red

Loading Indicator

Hex string of loading indicator(s) color. You can see it if you press the capture button:

DocReader.shared.customization.activityIndicatorColor = UIColor.red

Background

If set, background will be darkened around the document detection frame. Show/hide background mask:

DocReader.shared.customization.showBackgroundMask = true

Allows to change the intensity of the background mask:

DocReader.shared.customization.backgroundMaskAlpha = 0.3

Allows to set image within camera frame:

DocReader.shared.customization.borderBackgroundImage = UIImage(named: "icon")

Allows to change the content mode of image, which is located within camera frame, use one of UIView.ContentMode members:

DocReader.shared.customization.borderBackgroundImageContentMode = UIView.ContentMode.scaleAspectFit

RFID

Allows you to automatically change the scenario settings depending on the type and results obtained during scanning of the last document. Default value is true:

DocReader.shared.rfidScenario.autoSettings = true

Allows to set an authentication procedure type, conducting which is expected in the presence of all the objective conditions:

DocReader.shared.rfidScenario.authProcType = RFIDAuthenticationProcedureType.advanced

Allows to set a type of priority mechanism for organizing SM-channel (Security Messaging - a mechanism of protected data exchanging):

DocReader.shared.rfidScenario.baseSMProcedure = RFIDAccessControlProcedureType.bac

Allows to set a data access type for PACE procedure:

DocReader.shared.rfidScenario.pacePasswordType = RFIDPasswordType.mrz

Priority of using DS-certificates:

DocReader.shared.rfidScenario.pkdDSCertPriority = false

Use of CSCA-certificates submitted by individual data files only:

DocReader.shared.rfidScenario.pkdUseExternalCSCA = false

Level of trust to CSCA-certificates from PKD:

DocReader.shared.rfidScenario.trustedPKD = false

Logical sign of passive authentication performance:

DocReader.shared.rfidScenario.passiveAuth = true

Logical sign of the cancellation of active authentication procedure (AA) after the successful performance of chip authentication (CA) procedure:

DocReader.shared.rfidScenario.skipAA = false

Selection of the type of logical data profiler to use with the electronic document:

DocReader.shared.rfidScenario.profilerType = RGLRFIDSdkProfilerTypeDoc9303Edition2006

Strict ISO protocol:

DocReader.shared.rfidScenario.strictProcessing = false

Allows to specify whether the ePassport has to be read or not:

DocReader.shared.rfidScenario.readEPassport = true

Allows to specify which data groups of the ePassport have to be read:

DocReader.shared.rfidScenario.ePassportDataGroups.dG1 = true

Allows to specify whether the eID has to be read or not:

DocReader.shared.rfidScenario.readEID = false

Allows to specify which data groups of the eID have to be read:

DocReader.shared.rfidScenario.eIDDataGroups.dG1 = true

Allows to specify whether the eDL has to be read or not:

DocReader.shared.rfidScenario.readEDL = true

Allows to specify which data groups of the eDL have to be read:

DocReader.shared.rfidScenario.eDLDataGroups.dG1 = true

Other

Camera Session

If set, camera session will be paused as soon as the result is received:

DocReader.shared.isCameraSessionIsPaused = true

Last updated

Was this helpful?