Step 5: Export Results
After the documents are recognized, you need to save the recognized data. ABBYY FlexiCapture 12 SDK allows you to save recognized data to a file in XLS, XLSX, DBF, TXT, CSV, or XML format, and save an electronic copy of your document, e.g. in PDF or PDF/A format. You can use the Export method of the Project or Batch object. The first one allows you to export results from several batches, while the second one performs export from several documents of the batch. Also you can create export profiles with the specified export parameters in a Document Definition using AddNew method of the ExportProfiles object.
Use the following procedure:
- [optional] Create a IntsCollection object and specify the documents in the batch (or batches in the project) to export. You can also pass a NULL object, to export all document in the batch (or all batches in the project)
- [optional] Create a ExportParams object and specify the export parameters. Currently, only export to file is available. For details, see the Tuning Export Parameters section.
- Call the Export method of the Batch (or Project) object to save the document to a file in a specified format.
- After you have finished working with the batch, call the Close method of the corresponding Batch object to close the batch and free the resources.
- After you have finished working with the project, call the Close method of the Project object to close the project and free the resources.
C++ (COM) code
// Global ABBYY FlexiCapture SDK Engine object. // Create the Engine object ... // Open a project FCEngine::IProjectPtr project = Engine->OpenProject( L"D:\\TestProject\\TestProject.fcproj" ); // Add a new batch FCEngine::IBatchPtr batch = project->Batches->AddNew( L"TestBatch" ); // Open the batch batch->Open(); // Add some images to the batch ... // Recognize the documents batch->Recognize( 0, FCEngine::RM_ReRecognizeMinimal, 0 ); batch->Export( 0, 0 ); // Close the batch and the project when you're done batch->Close(); project->Close();
This procedure is used in the ABBYY FlexiCapture 12 SDK samples which can be found in the Samples folder (Start > Programs > ABBYY FlexiCapture 12 SDK > Code Samples Folder).
You can change the export parameters. By default, the parameters specified in the Document Definitions are used.
If the export methods provided by ABBYY FlexiCapture 12 SDK are not suitable for your task for some reason, you can implement your own export procedure. For example, you can traverse all fields of a document and export their values.
Final Step: Unload FlexiCapture 12 SDK