Usage

Document steps

These steps are available with the Document SDK

Document capture step

Step that responsible for capturing user document

By press on the Capture button the user will be led to the capture screen. Photo will be made automatically as soon as the document fits the frame and recognized

By press on Gallery button the user can upload a photo of the document from the device drive

documentCaptureStep {
    docType = DocType.ANY
    title = "ID-card Photo"
    instruction = "Make sure the lighting is good and take a photo. Or download from the photo library"
    useGallery = true
    btnGallery = "Download from the photo library"
    btnCapture = "Take a photo"
    image = R.drawable.img_passport_intro
    mask = R.drawable.img_passport_mask
    isMultipage = true
    isDoublePage = false
    frontAnimationImage = R.drawable.img_front_anim
    backAnimationImage = R.drawable.img_back_anim
    frameColorDefault = "#00000000"
    frameColorActive = "#FFFFFFFF"
    backgroundOpacity = .3f
    hintStyle = hintStyle
    withRfid = rfidStep
    customDatabase = "Full"
    nextStep = nextStep
}
  • docType - type of the document (optional, by default DocType.ANY)

  • title - title field (optional)

  • instruction - instruction text (optional)

  • useGallery - gives user possibility to upload document photo from the device drive (optional, by default false)

  • btnGallery - text on the Gallery button (optional)

  • btnCapture - text on the Capture button (optional)

  • image - image (optional)

  • mask - mask for the capturing screen (optional)

  • isMultipage - support of multipage documents, available only if docType is DocType.ANY (optional, by default false)

  • isDoublePage - support of double page spread, available only if docType is DocType.ANY (optional, by default false)

  • frontAnimationImage - front side of the multipage scan help animation (optional)

  • backAnimationImage - back side of the multipage scan help animation (optional)

  • frameColorDefault - hex color code for the frame of the capturing screen (optional, by default transparent)

  • frameColorActive - hex color code for the frame of the capturing screen while reading a document (optional, by default colorPrimary)

  • backgroundOpacity - capturing screen background opacity (optional, by default 0.3f)

  • hintStyle - appearance of the hints on the capturing screen (optional)

  • withRfid - allows to read RFID chip of the scanned document (optional)

  • customDatabase - id of a custom database for the document recognition (optional)

  • nextStep - next step (optional)

Predefined types of document:

enum class DocType {
    BARCODE,
    CREDIT_CARD,
    INTERNATIONAL_PASSPORT,
    ID_CARD,
    ID_CARD_BACKSIDE,
    UKRAINE_PASSPORT_FIRST_PAGE,
    UKRAINE_PASSPORT_SPREADS,
    UKRAINE_TAX_CODE,
    UTILITY_BILL,
    SELFIE_WITH_DOCUMENT,
    ANY
}

SDK has the list of predefined masks for the document capturing screen:

com.elkyc.documentsdk.R.id.img_elkyc_mask_driver_License
com.elkyc.documentsdk.R.id.img_elkyc_mask_id_card
com.elkyc.documentsdk.R.id.img_elkyc_mask_id_card_back
com.elkyc.documentsdk.R.id.img_elkyc_mask_passport
com.elkyc.documentsdk.R.id.img_elkyc_mask_tax_doc
com.elkyc.documentsdk.R.id.img_elkyc_mask_utility_bill

It is possible to use a custom database for the document recognition in two ways:

  • manually add the db.dat file to the app/src/main/assets/Reader folder;

  • specify database ID as a value of customDatabase parameter.

Hints on the capturing screen can be styled

hintStyle = hintStyle {
    textColor = "#7ed321"
    textBackgroundColor = "#f5a623"
    fontSize = 16
    textPosition = 1f
}
  • textColor - color of the hint text (optional)

  • textBackgroundColor - color of the hint text background (optional)

  • fontSize - hint text size in sp (optional)

  • textPosition - position of the hint on the capturing screen, 0f - very top, 1f - the center (optional)

RFID step

It is sub-step of the Document capture step and allows to read RFID chip of the scanned document. It works only for devices that have corresponding option (NFC)

rfidStep {
    title = "NFC Chip Reading"
    instruction = "Attach the document to the back of your phone"
    btnProceed = "Next"
    btnCancel = "Skip"
    btnRetry = "Try again"
    waitingTitle = "Get ready to chip reading"
    waitingText = "Attach the document to the back of your phone"
    successTitle = "Success!"
    successText = "Data read successfully"
    successImage = R.drawable.img_rfid_success
    failTitle = "There was a problem reading the data"
    failText = "Don't move the document. Attach it to the back of your smartphone and do not peel it off until the end of the reading process"
    failImage = R.drawable.img_rfid_error
}
  • title - title field (optional)

  • instruction - instruction text (optional)

  • btnProceed - text on the Proceed button (optional)

  • btnCancel - text on the Cancel button (optional)

  • btnRetry - text on the Retry button (optional)

  • waitingTitle - title field while device is looking for chip (optional)

  • waitingText - text message while device is looking for chip (optional)

  • successTitle - title in successful case scenario (optional)

  • successText - text message in successful case scenario (optional)

  • successImage - image in successful case scenario (optional)

  • failTitle - title in fail case scenario (optional)

  • failText - text message in fail case scenario (optional)

  • failImage - image in fail case scenario (optional)

Document selector step

Provides list of documents that can be scanned during the verification flow

docSelectorStep {
    title = "Select a document"
    btnConfirm = "Confirm"
    options = options
}
  • title - title field (optional)

  • btnConfirm - text on the Confirm button (optional)

  • options - list of acceptable documents

Options is a list of pairs: model that describe option element UI and step related to this option. The step doesn't have to be documentCaptureStep but might be anyone.

options = listOf(
    OptionModel(R.drawable.ic_old_passport, "Old Ukrainian passport")
        to oldPassportStep,
    OptionModel(R.drawable.ic_id_card, "ID card")
        to idCardStep,
    OptionModel(R.drawable.ic_international_passport, "International passport")
        to internationalPassportStep
)

OCR step

It is helpful is you scan a specific document and need to extract some particular text from it. If SDK can't find required text or it is recognized incorrectly, user sill will be able to edit final result

ocrStep {
    title = "Check your Tax ID number"
    btnProceed = "Confirm"
    inputLength = 10
    inputType = InputType.TYPE_CLASS_NUMBER
    inputPattern = "^[0-9]{10}$"
    nextStep = nextStep
}
  • title - title field (optional)

  • btnProceed - text on the Proceed button (optional)

  • inputLength - length of the seeking text (optional, by default 10)

  • inputType - android.text.InputType (optional, by default InputType.TYPE_CLASS_NUMBER)

  • inputPattern - regex of the seeking text (optional)

  • nextStep - next step (optional)

Last updated