How to manipulate the image field value using scripts in ABBYY FlexiCapture 12

Question

How can the value of the Image Field (the stored in the Image Field image part) be manipulated using scripts?

Answer

While every IField object has access to the IValue object, the image fields do not store anything as their value, thus the simple assign operation (as in the sample below) while working for the text fields will not work for the image fields.

//JScript
//Assign the value of the Text02 field to the value Text01 field
this.Field("Text01").Value = this.Field("Text02").Value;

The same operation for the Image01 and Image02 fields will require deleting the capture area of Image01 and adding the capture area of Image02 to it. Please refer to the example script below:

//JScript
this.Field("Image01").Regions.Item(0).Delete();
this.Field("Image01").AddRegion(
    this.Field("Image02").Regions.Item(0).Page,
    this.Field("Image02").Regions.Item(0).SurroundingRect.ToString());

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.