https://github.com/hansemannn/titanium-scanner
Use the iOS 13+ "VisionKit" document scanner API in Appcelerator Titanium.
https://github.com/hansemannn/titanium-scanner
appcelerator axway document-scanner ios13 titanium visionkit
Last synced: about 1 month ago
JSON representation
Use the iOS 13+ "VisionKit" document scanner API in Appcelerator Titanium.
- Host: GitHub
- URL: https://github.com/hansemannn/titanium-scanner
- Owner: hansemannn
- License: mit
- Created: 2019-09-08T19:52:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-06-12T08:40:48.000Z (almost 2 years ago)
- Last Synced: 2025-03-29T01:12:02.760Z (2 months ago)
- Topics: appcelerator, axway, document-scanner, ios13, titanium, visionkit
- Language: Swift
- Homepage:
- Size: 14.9 MB
- Stars: 18
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Titanium iOS 13+ Document Scanner
Use the iOS 13+ `VisionKit` document scanner API in Appcelerator Titanium. Pro tip: Combine with
[Ti.Vision](https://github.com/hansemannn/titanium-vision) to apply machine learning to the detected
document.
## Requirements
- [x] iOS 13+
- [x] Titanium SDK 8.2.0+
- [x] Granted camera permissions## APIs
### Methods
- [x] `showScanner`
- [x] `imageOfPageAtIndex(index)` (after the `success` event)
- [x] `pdfOfPageAtIndex(index)` (after the `success` event)
- [x] `pdfOfAllPages(params)` (after the `success` event - the params include `resizeImages` and `padding` to be used to generate resized A4 PDF's)### Events
- [x] `success`
- [x] `error`
- [x] `cancel`## Example
```js
import Scanner from 'ti.scanner';const win = Ti.UI.createWindow({
backgroundColor: '#fff'
});const btn = Ti.UI.createButton({
title: 'Scan Document'
});btn.addEventListener('click', () => {
Ti.Media.requestCameraPermissions(event => {
if (!event.success) {
alert('No camera permissions');
return;
}
Scanner.showScanner();
});
});Scanner.addEventListener('cancel', () => {
Ti.API.warn('Cancelled …');
});Scanner.addEventListener('error', event => {
Ti.API.error('Errored …');
Ti.API.error(event.error);
});Scanner.addEventListener('success', event => {
Ti.API.warn('Succeeded …');
Ti.API.warn(event);const win2 = Ti.UI.createWindow({
backgroundColor: '#333'
});const image = Ti.UI.createImageView({
height: '70%',
image: Scanner.imageOfPageAtIndex(0) /* Or pdfOfPageAtIndex(0) if you need the PDF of it, or many images via "event.count" */
});win2.add(image);
win2.open();
});win.add(btn);
win.open();
```## License
MIT
## Author
Hans Knöchel