PDF Creation
The Docutain SDK for Capacitor comes with the ability to create searchable PDF documents either from a scanned document with Docutain's Scanner SDK or imported file.
Initialization
Initialize the Docutain Capacitor SDK as described here.
Create a PDF
import { DocutainSDK } from '@docutain/capacitor-plugin-docutain-sdk'
//...
//scan or import file
//...
const destinationPath "TestPDF.PDF";
const pdfFile = await DocutainSDK.writePDF(destinationPath,true,"A4");
if(pdfFile != null)
{
//do something with the generated pdf file
}
else
{
//error occured
const error = await DocutainSDK.getLastError();
}
tip
You can specify to overwrite an existing file and the PDF page format by providing the appropriate value
//writePDF(filePath: string, overWrite: boolean, PDF_PageFormat: PDFPageFormat): Promise<string>;
const pdfFile = await DocutainSDK.writePDF(destinationPath,true,"A4");