Processing multiple standalone one-paged documents using Batch Processor of FineReader Engine

Question

Is it possible to process a significant amount of one-paged documents at a higher rate, exporting each of them as a standalone document using Batch Processor, FRPage, and ExportFileWriter?

Answer

The BatchProcessor itself is designed to process a high amount of one-paged documents at a maximum rate. 

In this case, we will be exporting each of them as a standalone document, which will need us to move the creation of ExportFileWriter inside the export cycle. This will allow the software to create a new file for each processed document, as shown in the sample below.

// Obtain recognized pages and export them to PDF format
CSafePtr<IFRPage> frPage;
CheckResult( batchProcessor->GetNextProcessedPage( &frPage ) );
while( frPage != 0 ) {
// Synthesize page before export
CheckResult( frPage->Synthesize( 0 ) );
//Adds page to export file
CheckResult(fileWriter->AddPage(frPage));
// Export page to file setting the name and extension
CheckResult(Engine->CreateExportFileWriter(resultDir + L "Out.pdf", FEF_PDF, 0, &fileWriter));
//Flush previous page releasing the memory
VARIANT_BOOL flushSuccessful;
CheckResult(frPage->Flush(VARIANT_FALSE, &flushSuccessful));
CheckResult(batchProcessor->GetNextProcessedPage(&frPage));
//Finalize and close the document
CheckResult(fileWriter->Close());
}

In addition to that, we can receive the same export results without using FRPage and ExportFileWriter as shown below

// Obtain recognized pages and export them to PDF format
CheckResult( batchProcessor->GetNextProcessedPage( &frPage ) );
while( frPage != 0 ) {
// Synthesize page before export
CheckResult( frPage->Synthesize( 0 ) );
// Export page to file with the set name and PDF extension
CheckResult( frPage->Export( resultDir + L"out.pdf", FEF_PDF, 0 ) );
CheckResult( batchProcessor->GetNextProcessedPage( &frPage ) );
}

The major difference is that FRPage can be used to connect pages from different documents, merging them into one using ExportFileWriter for export purposes. 

On the other hand, for now ExportFileWriter supports export only into PDF formats. 

 

 

 

 

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.