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 } from '@docutain/capacitor-plugin-docutain-sdk'
const result = await DocutainSDK.loadFile(filePath)
if(result.return)
{
//generate a PDF from the imported file
const destinationPath "TestPDF.PDF";
const pdfFile = DocutainSDK.writePDF(destinationPath,true,"A4");
if(pdfFile != null)
{
//do something with the generated pdf file
}
else
{
//error occured
}
}
else
{
//error occured
const error = await DocutainSDK.getLastError();
}