SDK and Document Definition

  • Last Post 17 June 2016
angusto posted this 06 June 2016

Hello, is it possibile to add or modify a document definition usinf flexicapture sdk? I whant to search some fields with text extracted from a database, but I don't whant to configure the database in the FlexiLayout Studio (with GUI or FlexiLayout Language) (data searched maybe is different from any document). So, is it possible to this? I can't find anything on FieldDefinition or RecognitionParams; the only way to use an external database is on FlexiLayout Studio?

Thanks Angelo

Order By: Standard | Newest | Votes
Anna Falevskaya posted this 07 June 2016


Yes, it's possible to create a document definition by using FlexiCapture Engine. For more information please refer to the Help file: Help→Guided Tour→Advanced Techniques→Creating Document Definitions and Help→Guided Tour→Tutorial→Creating Document Definitions by Training. Also it is possible to modify Document Definitions using ABBYY FlexiCapture Engine, but only for the Document Definitions which do not belong to any FlexiCapture project. But unfortunately it seems that Database check rules can be set only by using ABBYY FlexiCapture or FlexiLayout Studio.

angusto posted this 09 June 2016

Hello, thanks! So, another questions:

If I utilize the textfile search data, it is reloaded every document or it's loaded only when is loaded the layout? How can I vary the searched static text for every document?

Think abount someting like an Invoice, I must search a buyer and a seller. Every Invoice has a different seller (but I know witch is) and a list of buyers that is known in advance. I whant to change the searched text of the seller just to verify that is ok and I whant to search for the buyer on a list connected to the seller.


Anna Falevskaya posted this 10 June 2016


All recognized data of the particular document is available till the corresponding Document object is available (is not deleted or unloaded from memory).

angusto posted this 10 June 2016


Ok but if I have two same lists, one for the seller and one for the buyer and two different fields. It can happen that both seller and buyer are reconized the same "location" field. The only way I know is to tell the second to not search into the first area. I wold prefer to insert into the document definition one new field.

So: - I create a document definition from AFL - I modify this document definition adding one static text field with one search string - I use ony the second field to search from the sql list

Anna Falevskaya posted this 10 June 2016

It looks like you've resolved the issue on your own.

In case you need some recommendations about setting up Document Definitions, created in ABBYY FlexiCapture or FlexiLayout Studio, please send your questions to ABBYY Technical Support. They will be happy to provide detailed instructions. You can find Technical Support Contacts here -

angusto posted this 10 June 2016

Hi, I'm not asking help on realizing a flexylayout. I wold like to know if is possibile, in the FC SDK, after creating a document definition from afl file, to add a new filed with static search text and if is possibile to modify this static search text field on every new document added.

Thanks Angelo

Anna Falevskaya posted this 10 June 2016

As I've already answered you, it is possible to modify Document Definitions using ABBYY FlexiCapture Engine, but only for the Document Definitions which do not belong to any FlexiCapture project. For example, you can add a new block with type BT_StaticText to a page of a Document Definition by using the AddNew Method of the BlockDefinitions Object. You can get a recognized data from a StaticText field via the AsText property of the FieldValue object. You can modify this obtained Text object via its methods, e.g., Delete method (removes a range from the current text) and Insert method (inserts new text into the current text). Please refer to the Help file for more information.

angusto posted this 10 June 2016

Really thanks!

angusto posted this 15 June 2016

Hi Anna,

I have this peace of code:

IDocumentDefinition df = engine.CreateDocumentDefinitionFromAFL("", "Italian");

IFieldDefinition fField = trovaField(df, "FlexiLayoutBlockName") (find field by recursive function like code examples);

Program.trace("Field Type... " + fField.Type.ToString()); --> output is FT_TextField Program.trace("Recognition Params Type... " + fPivaCliente.RecognitionParams.Type.ToString()); --> output is BT_Text

ITextRecognitionParams cTextParams = fField.RecognitionParams.AsTextParams();

ILanguage cLanguage = cTextParams.CreateEmbeddedLanguage(LanguageTypeEnum.LT_Simple, engine.PredefinedLanguages.FindLanguage("Italian"));

ISimpleLanguage cSimpleLanguage = cLanguage.AsSimpleLanguage();

cSimpleLanguage.UsePredefinedDictionary = false;

cSimpleLanguage.UseUserDefinedDictionary = true;

FCEngine.IDictionary cDictionary = cSimpleLanguage.UserDefinedDictionary;

cDictionary.AddWord("0123456789", 100); --> (In the document is present this word I can see it in flexylayout studio matching procedure)

cTextParams.Language = cLanguage; processor.AddDocumentDefinition(df);

After processing in the blocks recognized I see all block connected to some searchfields in flexilayout that are found, but the field (corresponding on the "FlexiLayoutBlockName" is empty).

Why? What am I missing?

Thanks Angelo

Anna Falevskaya posted this 15 June 2016

Please collect the following additional information: 1) serial number of the FlexiCapture Engine; 2) your FlexiLayout Studio project; 3) AFL file that you are using; 4) sample images; 5) the full code snippet with which we could reproduce the situation on our side (currently it's unclear, e.g., what trovaField method does and how it works)

and send it to We will try to assist you through the email correspondence.

angusto posted this 16 June 2016

I'm doing it now. Thanks!

angusto posted this 17 June 2016

Hello, have you received it?

Thanks Angelo

Anna Falevskaya posted this 17 June 2016

Hello Angelo!

Yes, we received your letter and passed it to our colleagues from the technical support group of the European office. They will contact you shortly. Thank you for the provided materials!

angusto posted this 17 June 2016

Thank you for your rapid response!