Community

How to get field Image for Table element? Answered

Hi,

I am using FC 11.

We can get field image of each field captured, but query is for table element field image is image of entire table captured. I want image of each row of table separately. Is it possible?

Let me know if you need more details.

Thanks,

0

Comments

8 comments

  • Avatar
    Ekaterina

    Hello Kalyani

    Yes, you may do it by script. Please take a look at the Rows collection of in the (Table) IField. 

    To get access to images from the fields contained in the rows please use 

    (Table) IField::Rows.Item[i] >> Regions >> Picture property.

    You may find more in the Appendix > Using scripts in ABBYY FlexiCapture > Scripts for customizing processing stages > Objects > IField.

    0
  • Avatar
    Kalyani

    Hi,

    Thanks for your response!

    To get column content I wrote - Field("ColumnName").Items.Item(i).Value; I am getting value correctly.

    But I tried to get Picture accessing Picture object and failed to do so, getting null object error.

    I tried following scripts -

    In rules -
    1: Field("ColumnName").Items.Item(0).Regions(0).Picture.SaveAs("xyz", "tif" );

    In custom stage -
    1: Documents[0].Sections[0].Field("Table").Cell("ColumnName",0).Regions[0].Picture.SaveAs("abc.tif", "tif");

    2: Documents[0].Sections[0].Field("Table").Rows[0].Regions[0].Picture.SaveAs();

    If you could resolve this!

    I want entire row image of table.If not row image possible, column wise images of each cell is also fine!

    Can you please help me out or provide more details?

     

    0
  • Avatar
    Ekaterina

    Hello, Kalyani

    To get all the Table rows, the following approach works (used in Rules)

    ...

    foreach (IField field in Context.Field("Table").Rows)

    {

        field.Regions[0].Picture.SaveAs("filepath", null); //string filepath should be adapted to your environment

    }

    This rule should be implemented on higher level that the "Table" field itself, e.g. on the level of Document Section.

    If you want to get the resulting images in default TIFF format, you may use "null" as a second argument of SaveAs() method, otherwise you should create a new object of type IExportImageSavingOptions by FlexiCaptureTools::NewImageSavingOptions() method and set the desired image saving options there.

    Please also take a look on the following Help articles:

    Using scripts in ABBYY FlexiCapture > Scripts for customizing processing stages > Objects > IExportImageSavingOptions 

    Using scripts in ABBYY FlexiCapture > Scripts for customizing processing stages > Objects > IFlexiCaptureTools

    0
  • Avatar
    Kalyani

    Hi,

    I wrote the same script in Table field itself -

    foreach (IField field in Context.Field("Table").Rows)

    {

        field.Regions[0].Picture.SaveAs(@"serverpath\abc.tif", null);

    }

    Still its not creating any abc file on shared server, even verification station is getting hanged because of this script.

    I think there is error in line 'Context.Field("Table").Rows'.

    Error is - field is not a table at ABBYY.Flexicapture.IField.get_Rows();

    Let me know if I am going wrong!

     

    Thanks,

    0
  • Avatar
    Ekaterina

    Hello, Kalyani

    Please do not use this script in the Table field itself. Place the script in other field.

    0
  • Avatar
    Kalyani

     Hi,

    Thanks, Its resolved.

    0
  • Avatar
    arhyneRWU

    Does this script only work on export or can you feed an image into a picture field? 

    0
  • Avatar
    Ekaterina

    Hello,

    The script may work on the all stages after recognition (where IField::Regions[] is available) and will produce an image based on the existing field region from the document, it can as well be recognized text field, or barcode/picture field.

    0

Please sign in to leave a comment.