@docutain/capacitor-plugin-docutain-sdk

中文文档
7.0.0发布于 2025/10/14SEE LICENSE IN LICENSETypeScriptESM + CJS零依赖近 30 天下载 2205

Capacitor plugin of the Docutain Document Scanner SDK for Android and iOS. High quality document scanning, data extraction, text recognition and PDF creation for your apps. Easily scan documents in your app.

原始使用文档
文档目录14 节
  1. Preview
  2. What is Docutain SDK?
  3. Plugin Versions
  4. Usage
  5. Initialize
  6. Start the scanner to scan documents
  7. Generate a PDF document
  8. Image Export
  9. Text Recognition
  10. Data Extraction
  11. Photo Payment
  12. Documentation of the Docutain SDK
  13. Changelog
  14. License and Support

Docutain SDK for Capacitor

Preview

Capacitor Docutain SDK for high quality, high performance document scanning and data extraction. Use the document scanner in various industries, e.g. scanning BOLs, invoice scan and much more.

What is Docutain SDK?

The Docutain SDK brings functionalities for automatic document scanning, data capture, image processing, OCR text recognition, intelligent data extraction, PDF creation and photo payment to your apps.

It works 100% offline, which ensures maximum data safety.

It contains individually licensable modules:

For more details visit our website https://sdk.Docutain.com

If you like to test the functionality without writing any lines of code, check out our Showcase Apps.

Plugin Versions

Capacitor versionPlugin version
7.x7.x
6.x6.x
5.x1.x

Usage

The following shows a minimum example to use the document scanner. For all available features and theming possibilities, please check out our documentation.

Initialize

In order to use any functionality of the SDK, you must initialize it first.

try{
    await DocutainSDK.initSDK({licenseKey: "<YOUR-LICENSE-KEY>"})
} catch (error) {
    //init of Docutain SDK failed, get the last error message
    console.error(error);
    //your logic to deactivate access to SDK functionality
}

For testing purposes, you can leave the license key empty. However, the SDK will stop working after 1 minute. You can get a free extended trial license on our website.

Start the scanner to scan documents

On iOS, make sure to add a camera usage description in the Info.plist. If you don't, the app will crash.

NSCameraUsageDescription - "In order to scan documents, you need to grant permission to access the camera."

To start the document scanner, you only have to call DocutainSDK.startDocumentScanner and wait for it to return.

Check out the documentation for possible scan configurations.

try{
    await DocutainSDK.startDocumentScanner({
        //customize the scanner config according to your needs
    });
} catch (error) {
    if ((error as { code?: string })?.code === 'CANCELED') {
        //user canceled scan process
        console.log(`user canceled`);
    } else {
        console.error(error);
    }
}

Generate a PDF document

Once the user finished the scan, you can generate a PDF document out of the scanned pages. The PDF document will include the recognized text, making it searchable and selectable.

Check out the documentation for more details.

try{    
    const pdfUri = (await DocutainSDK.writePDF({
        fileUri: destinationUri,
        overWrite: true,
    })).fileUri 
} catch (error) {
    console.error(error);
}  

Image Export

It is also possible to get the scanned pages as single image files.

Check out the documentation for more details.

try{
    const pageCount = (await DocutainSDK.pageCount()).count;
    for(let i = 1; i <= pageCount; i++){
        const imageUri = (await DocutainSDK.writeImage({
            pageNumber: i,
            fileUri: destinationUri
        })).fileUri
    }
}catch (error) {
    console.error(error);
} 

Text Recognition

With a single line of code, you can get the recognized text of the scanned document or single pages.

Check out the documentation for more details.

try{
    const text = (await DocutainSDK.getText()).text
}catch (error) {
    console.error(error);
} 

Data Extraction

It is also possible to run data extraction on the scans to extract certain values, like Address, Amount, IBAN, Date and more.

Check out the documentation for more details.

try{
    const analyzeData = (await DocutainSDK.analyze()).data;
}catch (error) {
    console.error(error);
} 

Photo Payment

Integrate Photo Payment into your banking app within minutes with just a few lines of code. It works 100% offline on device. No data at all is transfered to any external server or cloud service, ensuring 100% data protection.

Check out the documentation for more details.

try{
    const result = await DocutainSDK.startPhotoPayment({
        //customize the photo payment process according to your needs
    });
    if(result.data !== ""){
        //payment information has been extracted
        //result.data is a JSON string containing the information
        //extract the fields you need and pass it on to your payment sheet
    } else{
        //no data was extracted at all
        //Note: this case is only reachable, if you disabled the Empty Result Screen
    }
} catch (error) {
    if ((error as { code?: string })?.code === 'CANCELED') {
        //user canceled scan process
        console.log(`user canceled`);
    } else {
        console.error(error);
    }
}    

Documentation of the Docutain SDK

The documentation includes everything you need to know to integrate the Docutain SDK into your Capacitor application. If you prefer sample projects over documentation, check out our Docutain SDK Capacitor sample app on Github.

Changelog

All changes included in each version can be found here: Changelog

License and Support

The Docutain SDK is a commercial product and requires a paid license for production use. In order to get a trial license, please visit our website via https://sdk.docutain.com/TrialLicense to generate a trial license key.

If you need technical support of any kind, please contact us via [email protected].

版本与发布记录

@docutain/capacitor-plugin-docutain-sdk 共发布 22 个版本,首次发布于 2023/10/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.0.0latest2025/10/141.1 年前
7.0.0-beta.2beta2025/10/081.1 年前
7.0.0-beta.12025/07/281.3 年前
6.0.02025/06/151.4 年前
6.0.0-beta.22025/05/311.5 年前
6.0.0-beta.12025/05/081.5 年前

关于 @docutain/capacitor-plugin-docutain-sdk 的常见问题

@docutain/capacitor-plugin-docutain-sdk 是什么?

Capacitor plugin of the Docutain Document Scanner SDK for Android and iOS. High quality document scanning, data extraction, text recognition and PDF creation for your apps. Easily scan documents in your app.

如何安装 @docutain/capacitor-plugin-docutain-sdk?

在项目目录运行 npm install @docutain/capacitor-plugin-docutain-sdk,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=7.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@docutain/capacitor-plugin-docutain-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@docutain/capacitor-plugin-docutain-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@docutain/capacitor-plugin-docutain-sdk 可以商用吗?

@docutain/capacitor-plugin-docutain-sdk 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@docutain/capacitor-plugin-docutain-sdk 的下载量有多少?

根据 npm 官方下载统计,@docutain/capacitor-plugin-docutain-sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,205 次,日均约 74 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@docutain/capacitor-plugin-docutain-sdk 还在维护吗?

最新版本 7.0.0 发布于 2025/10/14(1.1 年前);至今共发布 22 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/10/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。