Zoning using abbyy ocr sdk?

  • 49 Views
  • Last Post 17 September 2018
0Cool posted this 13 September 2018

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?

Attached Files

Helen Osetrova posted this 17 September 2018

Hi!

 

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;
document.Pages.DeleteAt(0);
document.AddPage(page);

// 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: https://forum.ocrsdk.com/thread/tables-only-from-pdf/

 

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!

Close