{"_id":"@code-chris/swipe-capacitor-document-scanner","name":"@code-chris/swipe-capacitor-document-scanner","dist-tags":{"latest":"7.0.0"},"versions":{"7.0.0":{"name":"@code-chris/swipe-capacitor-document-scanner","version":"7.0.0","description":"A Capacitor plugin that lets you scan documents using Android and iOS","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"swipe GmbH"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/swipegmbh/capacitor-document-scanner.git"},"bugs":{"url":"https://github.com/swipegmbh/capacitor-document-scanner/issues"},"keywords":["capacitor","plugin","native"],"scripts":{"verify":"npm run verify:ios && npm run verify:android && npm run verify:web","verify:ios":"cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..","verify:android":"cd android && ./gradlew clean build test && cd ..","verify:web":"npm run build","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","eslint":"eslint . --ext ts","prettier":"prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java","swiftlint":"node-swiftlint","docgen":"docgen --api DocumentScannerPlugin --output-readme README.md --output-json dist/docs.json","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"devDependencies":{"@capacitor/android":"^7.0.0","@capacitor/core":"^7.0.0","@capacitor/docgen":"^0.3.0","@capacitor/ios":"^7.0.0","@ionic/eslint-config":"^0.4.0","@ionic/prettier-config":"^4.0.0","@ionic/swiftlint-config":"^2.0.0","eslint":"^8.57.0","prettier":"^3.4.2","prettier-plugin-java":"^2.6.6","rimraf":"^6.0.1","rollup":"^4.30.1","swiftlint":"^2.0.0","typescript":"~4.1.5"},"peerDependencies":{"@capacitor/core":">=7.0.0"},"prettier":"@ionic/prettier-config","swiftlint":"@ionic/swiftlint-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"_id":"@code-chris/swipe-capacitor-document-scanner@7.0.0","gitHead":"539472dd35ece686f2179d0ddc1a49dad06d157a","homepage":"https://github.com/swipegmbh/capacitor-document-scanner#readme","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-yoRKaBE4krynK7s/TlF67j/sfERlJudJk389r7w1uSrBeymj00+MgG+dGNzQteyOQl4hfGqeDEsJg+TVmxioiQ==","shasum":"ab6deb1ee1a166b4b54ae7390b2cc23800d7ea20","tarball":"https://registry.npmjs.org/@code-chris/swipe-capacitor-document-scanner/-/swipe-capacitor-document-scanner-7.0.0.tgz","fileCount":25,"unpackedSize":44587,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBSZvpfVHj/9triwk6GDBnY5R+DkBH0Lf66E+jADVYPCAiA758ybiSZeOxKv5uAvH6OJ5ZEoVhYxoIPriyWzVygvQg=="}]},"_npmUser":{"name":"code-chris","email":"christian.kotzbauer@gmail.com"},"directories":{},"maintainers":[{"name":"code-chris","email":"christian.kotzbauer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/swipe-capacitor-document-scanner_7.0.0_1756582869979_0.9391631857969978"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-30T19:41:09.822Z","7.0.0":"2025-08-30T19:41:10.172Z","modified":"2025-08-30T19:41:10.582Z"},"maintainers":[{"name":"code-chris","email":"christian.kotzbauer@gmail.com"}],"description":"A Capacitor plugin that lets you scan documents using Android and iOS","homepage":"https://github.com/swipegmbh/capacitor-document-scanner#readme","keywords":["capacitor","plugin","native"],"repository":{"type":"git","url":"git+https://github.com/swipegmbh/capacitor-document-scanner.git"},"author":{"name":"swipe GmbH"},"bugs":{"url":"https://github.com/swipegmbh/capacitor-document-scanner/issues"},"license":"MIT","readme":"# Capacitor Document Scanner\n\n[![Npm package version](https://img.shields.io/npm/v/swipe-capacitor-document-scanner/latest.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/swipe-capacitor-document-scanner) [![npm peer dependency version](https://img.shields.io/npm/dependency-version/swipe-capacitor-document-scanner/peer/@capacitor/core?color=222d3a&logo=capacitor&style=for-the-badge)](https://github.com/swipegmbh/capacitor-document-scanner/blob/master/package.json)\n\nThis is a Capacitor plugin that lets you scan documents using Android and iOS. You can use it to create\napps that let users scan notes, homework, business cards, receipts, or anything with a rectangular shape.\n\n| iOS                                                                                                                  | Android                                                                                                                  |\n| -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| ![Dollar-iOS](https://user-images.githubusercontent.com/26162804/160485984-e6c46563-56ee-4be9-b241-34a186e0029d.gif) | ![Dollar Android](https://user-images.githubusercontent.com/26162804/160306955-af9c5dd6-5cdf-4e2c-8770-c734a594985d.gif) |\n\n## Install\n\n```bash\nnpm install capacitor-document-scanner\nnpx cap sync\n```\n\n## Examples\n\n- [Basic Example](#basic-example)\n- [Limit Number of Scans](#limit-number-of-scans)\n- [Remove Cropper](#remove-cropper)\n\n### Basic Example\n\n```typescript\nimport { Capacitor } from '@capacitor/core';\nimport { DocumentScanner } from 'capacitor-document-scanner';\n\nconst scanDocument = async () => {\n  // start the document scanner\n  const { scannedImages } = await DocumentScanner.scanDocument();\n\n  // get back an array with scanned image file paths\n  if (scannedImages.length > 0) {\n    // set the img src, so we can view the first scanned image\n    const scannedImage = document.getElementById(\n      'scannedImage',\n    ) as HTMLImageElement;\n    scannedImage.src = Capacitor.convertFileSrc(scannedImages[0]);\n  }\n};\n```\n\nHere's what this example looks like with several items\n\nhttps://user-images.githubusercontent.com/26162804/160264220-0a77a55c-33b1-492a-9617-6d2c083b0583.mp4\n\nhttps://user-images.githubusercontent.com/26162804/160264222-bef1ba3d-d6c1-43c8-ba2e-77ff5baef836.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643046-57536193-0c6c-4edf-8f29-6f3ef9854dc5.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643075-365b5008-4bc8-4507-969d-b2c188f372ec.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643102-35283536-73a3-4b05-bd76-c06514ca3928.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643126-f5c2461d-768d-481c-8dee-4d74a0cae778.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643156-4ce1abac-d78b-4211-a99a-f0bebd40e2a6.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643167-fc751455-1a1a-4b1c-b06f-a3a2cef0d0b0.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643192-71db71af-392d-4b6a-b94d-851a3369dbf3.mp4\n\nhttps://user-images.githubusercontent.com/26162804/161643203-2a265cc1-5cf1-4474-b43c-7b1b2dcba704.mp4\n\n### Limit Number of Scans\n\nYou can limit the number of scans. For example if your app lets a user scan a business\ncard you might want them to only capture the front and back. In this case you can set\nmaxNumDocuments to 2. This only works on Android.\n\n```typescript\nimport { Capacitor } from '@capacitor/core';\nimport { DocumentScanner } from 'capacitor-document-scanner';\n\nconst scanDocument = async () => {\n  // limit the number of scans to 2\n  const { scannedImages } = await DocumentScanner.scanDocument({\n    maxNumDocuments: 2,\n  });\n\n  // get back an array with scanned image file paths\n  if (scannedImages.length > 0) {\n    // set the img src, so we can view the first scanned image\n    const scannedImage = document.getElementById(\n      'scannedImage',\n    ) as HTMLImageElement;\n    scannedImage.src = Capacitor.convertFileSrc(scannedImages[0]);\n  }\n};\n```\n\nhttps://user-images.githubusercontent.com/26162804/161643345-6fe15f33-9414-46f5-b5d5-24d88948e801.mp4\n\n### Remove Cropper\n\nYou can automatically accept the detected document corners, and prevent the user from\nmaking adjustments. Set letUserAdjustCrop to false to skip the crop screen. This limits\nthe max number of scans to 1. This only works on Android.\n\n```typescript\nimport { Capacitor } from '@capacitor/core';\nimport { DocumentScanner } from 'capacitor-document-scanner';\n\nconst scanDocument = async () => {\n  // skip the crop screen\n  const { scannedImages } = await DocumentScanner.scanDocument({\n    letUserAdjustCrop: false,\n  });\n\n  // get back an array with scanned image file paths\n  if (scannedImages.length > 0) {\n    // set the img src, so we can view the first scanned image\n    const scannedImage = document.getElementById(\n      'scannedImage',\n    ) as HTMLImageElement;\n    scannedImage.src = Capacitor.convertFileSrc(scannedImages[0]);\n  }\n};\n```\n\nhttps://user-images.githubusercontent.com/26162804/161643377-cabd7f51-a16f-4f5e-938a-afb6f3b1c8cb.mp4\n\n## iOS\n\niOS requires the following usage description be added and filled out for your app in `Info.plist`:\n\n- `NSCameraUsageDescription` (`Privacy - Camera Usage Description`)\n\nRead about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode\n\n## Documentation\n\n<docgen-index>\n\n* [`scanDocument(...)`](#scandocument)\n* [Interfaces](#interfaces)\n* [Enums](#enums)\n\n</docgen-index>\n\n<docgen-api>\n<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->\n\n### scanDocument(...)\n\n```typescript\nscanDocument(options?: ScanDocumentOptions | undefined) => Promise<ScanDocumentResponse>\n```\n\nOpens the camera, and starts the document scan\n\n| Param         | Type                                                                |\n| ------------- | ------------------------------------------------------------------- |\n| **`options`** | <code><a href=\"#scandocumentoptions\">ScanDocumentOptions</a></code> |\n\n**Returns:** <code>Promise&lt;<a href=\"#scandocumentresponse\">ScanDocumentResponse</a>&gt;</code>\n\n--------------------\n\n\n### Interfaces\n\n\n#### ScanDocumentResponse\n\n| Prop                | Type                                                                              | Description                                                                                                                       |\n| ------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| **`scannedImages`** | <code>string[]</code>                                                             | This is an array with either file paths or base64 images for the document scan.                                                   |\n| **`status`**        | <code><a href=\"#scandocumentresponsestatus\">ScanDocumentResponseStatus</a></code> | The status lets you know if the document scan completes successfully, or if the user cancels before completing the document scan. |\n\n\n#### ScanDocumentOptions\n\n| Prop                      | Type                                                  | Description                                                                                                                                                                                                                                                                                                                               | Default                                   |\n| ------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |\n| **`croppedImageQuality`** | <code>number</code>                                   | Android only: The quality of the cropped image from 0 - 100. 100 is the best quality.                                                                                                                                                                                                                                                     | <code>: 100</code>                        |\n| **`letUserAdjustCrop`**   | <code>boolean</code>                                  | Android only: If true then once the user takes a photo, they get to preview the automatically detected document corners. They can then move the corners in case there needs to be an adjustment. If false then the user can't adjust the corners, and the user can only take 1 photo (maxNumDocuments can't be more than 1 in this case). | <code>: true</code>                       |\n| **`maxNumDocuments`**     | <code>number</code>                                   | Android only: The maximum number of photos an user can take (not counting photo retakes)                                                                                                                                                                                                                                                  | <code>: 24</code>                         |\n| **`responseType`**        | <code><a href=\"#responsetype\">ResponseType</a></code> | The response comes back in this format on success. It can be the document scan image file paths or base64 images.                                                                                                                                                                                                                         | <code>: ResponseType.ImageFilePath</code> |\n\n\n### Enums\n\n\n#### ScanDocumentResponseStatus\n\n| Members       | Value                  | Description                                                                                               |\n| ------------- | ---------------------- | --------------------------------------------------------------------------------------------------------- |\n| **`Success`** | <code>'success'</code> | The status comes back as success if the document scan completes successfully.                             |\n| **`Cancel`**  | <code>'cancel'</code>  | The status comes back as cancel if the user closes out of the camera before completing the document scan. |\n\n\n#### ResponseType\n\n| Members             | Value                        | Description                                                                     |\n| ------------------- | ---------------------------- | ------------------------------------------------------------------------------- |\n| **`Base64`**        | <code>'base64'</code>        | Use this response type if you want document scan returned as base64 images.     |\n| **`ImageFilePath`** | <code>'imageFilePath'</code> | Use this response type if you want document scan returned as inmage file paths. |\n\n</docgen-api>\n\n## License\n\nCopyright 2022 David Marcus\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_rev":"1-5e332e8d583848e62db73b297132a909"}