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 .NET MAUI Scanner SDK.

.NET MAUI PDF Creation

.NET MAUI Text Detection

.NET MAUI Data Extraction

Supported file types

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

Initialization

Initialize the Docutain .NET MAUI SDK as described here.

File Import

If your simple goal is to import image files and generate a non-searchable (includes no text) PDF file from it, use the Document class.

using Docutain.SDK.MAUI;

if(Document.LoadFile(filePath))
{
//generate a PDF from the imported file
var destinationPath = FileSystem.CacheDirectory + "/TestPDF.pdf";
var pdfFile = Document.WritePDF(destinationPath);
if(pdfFile != null)
{
//do something with the generated pdf file
}
else
{
//error occured
var error = DocutainSDK.LastError;
}
}
else
{
//error occured
var error = DocutainSDK.LastError;
}

If you want to create a searchable PDF (includes text), or get the detected data or text of the imported file, use the DocumentDataReader class.

using Docutain.SDK.MAUI;

if(DocumentDataReader.LoadFile(filePath))
{
//generate a searchable PDF from the imported file
var destinationPath = FileSystem.CacheDirectory + "/TestPDF.pdf";
var pdfFile = Document.WritePDF(destinationPath);
//get the detected text
var text = DocumentDataReader.GetText();
//get the detected data
var data = DocumentDataReader.Analyze();
}
else
{
//error occured
var error = DocutainSDK.LastError;
}