Skip to main content

PDF Creation

The Docutain SDK for React-Native 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 React-Native SDK as described here.

Create a PDF

import DocutainSDK from '@docutain/react-native-docutain-sdk';

//...
//scan or import file
//...

const destinationPath: string = RNFS.DocumentDirectoryPath + "/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: string = 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");