Skip to main content

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 React Native Scanner SDK.

React-Native PDF Creation

React-Native Text Detection

React-Native Data Extraction

Supported file types

  • PDF
  • BMP
  • JPG
  • JPEG
  • PNG
  • TIFF
  • HEIC

Initialization

Initialize the Docutain React-Native 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/react-native-docutain-sdk';

if(await DocutainSDK.loadFile(filePath))
{
//generate a PDF from the imported file
const destinationPath: string = RNFS.DocumentDirectoryPath + "/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: string = await DocutainSDK.getLastError();
}