Is it possible to create Fixed Layout document definitions (.fcdot) files using only FlexiCapture SDK? I do not want to use an AFL or and XFD.
My system would work as follows
- My application will be listening to a messaging queue where requests for either processing images or creating new templates will come
- The data for creating the template will arrive as a JSON which my application will parse and use the objects created through FC Engine SDK to create a Document Definition and save it as a .fcdot file
- List item
The important points are
- All my document definitions are fixed layout. So I do not want to use AFL
- I do not have multiple images to train the system. I get a single page with the position and other details of the fields in it. I want to create the document definition
I tried the following approaches
This follows the method given in the documentation and the sample code from Auto-learning Demo. I used the following steps
- Created an ITrainingBatch and added the page image using AddPageFile function.
- Based on the type and location given for each field from the parsed data from JSON, added blocks using Blocks.AddNew function. The region is created based on the details from my JSON request.
- Saved the definition to AFL and FCDOT formats according to the sample code
When the saved definition was loaded to a processor, and tried for recognition, the recognition was very wrong.
The location of the recognised areas were all wrong. Often the entire image is recognised as a single field
- I created an IDocumentDefinition object using CreateDocumentDefinition function of an engine.
- Added a new section to this using Sections.AddNew. The name of the section was the name of the page.
- Added a new page to the section using Section.Pages.AddNew.
- Added blocks to the Page using Page.Blocks.AddNew.
- Checked the document definition using Check. I got the following error “Document Definition, Page 1: Page has no elements for Document Definition matching”
Using a mix of the two
In this, I created Anchor blocks using the data from ITrainingBatch and added it to the DocumentDefinition.
- Created a IDocumentDefinition, ITrainingBatch and ITrainingDocumentDefinition
- Added Sections and Pages to both objects
- Did a Page.PrepareLayout to do initial recognitions
- For each ImageObject in the page, got the Region and added a new block to the DocumentDefinition as Anchor block. There were more than 2000 of these
- Checked the document definition using Check. I got the following error “Document Definition, Page 1: Block 'Anchor 115' is too small.”
However, I saved the definition and tried processing with it. When loading the definition, all the blocks were correctly present in the template On processing, I got the following error
“No Document Definitions to match.”
Creating Fixed Layout from Flexible Layout I tried creating a Flexible Layout according to the documentation and added a dummy field and a dummy reference field. Then I saved this as AFL Then I loaded it as IDocumentDefinition using ICustomStorage::LoadFormFile. I tried to use this as a base for adding fixed layout fields. However I got the following error
"Additional information: Unable to define fixed layout inside flexible."