File Import
You can import images or PDF files into Docutain and do a bunch of things with them, same as after a successful document scan with Docutain's Capacitor Scanner SDK.
Supported file types
- BMP
- JPG
- JPEG
- PNG
- TIFF
- HEIC
Initialization
Initialize the Docutain Capacitor SDK as described here.
File Import
If you want to create a searchable PDF (includes text), or get the detected data or text of the imported file, use loadFile
import { DocutainSDK, PDFPageFormat } from '@docutain/capacitor-plugin-docutain-sdk'
try{
const result = await DocutainSDK.loadFile(filePath)
//generate a PDF from the imported file
var destinationUri = (await Filesystem.getUri({ path: "sample.pdf", directory:Directory.Data })).uri;
const pdfUri = (await DocutainSDK.writePDF({
fileUri: destinationUri,
overWrite: true,
pageFormat: PDFPageFormat.A4
})).fileUri
}catch (error) {
//error occured
console.error(error);
}