Zoning using abbyy ocr sdk?

How do I create a zoning app using c# and abbyy finereader sdk, where I can zone areas, sequence them and extract text to a text file?

In case there is a table area, the text should be converted to html table i.e. with <tr>, <td>

I have uploaded a file which indicate the type of zoning I'm talking about. How do I draw those zones, sequence them and extract text accordingly using c# windows form app?



1 comment

  • Avatar
    Helen Osetrova



    To export only certain blocks from the page, you should obtain the page layout and add to it the blocks that you are interested in. Please find below the code snippet which illustrates this process: 

    // Get layout of the first page
    FREngine.FRPages pages = document.Pages;
    FREngine.FRPage page = pages.Item(0);
    FREngine.Layout layout = page.Layout;

    // Set block region
    FREngine.Region region = engineLoader.Engine.CreateRegion();
    region.AddRect(left, top, right, bottom); 

    // Create a new block
    FREngine.IBlock newBlock = layout.Blocks.AddNew(FREngine.BlockTypeEnum.BT_Table, region, 0);
    FREngine.TextBlock tableBlock = newBlock.GetAsTableBlock();

    // Replace page in the document with the new one
    page.Layout = layout;

    // Process
    document.Recognize( null, null ); 
    document.Synthesize( null );
    document.Export(resultFilePath, FREngine.FileExportFormatEnum.FEF_HTMLUnicodeDefaults, null);


    You can also perform the automatic layout analysis and apply the approach described in the related topic:


    Drawing the zones on the original picture is possible using the AddPaintRegion method of the ImageModification object. This method allows filling the specified region with some color. You can draw the boundaries of each zone as a set of rectangles.

    After adding all the necessary regions, please call the IImageDocument::Modify method (it takes the ImageModification object as an input parameter). The actual changes take place only when you call this method. After this save the changes using the IImageDocument::SaveModified method.


    Please find more in the Developer's Help  Guided Tour  Advanced Techniques  Working with Images.


    Hope this information will be helpful!


Please sign in to leave a comment.