Punch-Hole Erase when ocr file

  • Last Post 3 days ago
aravindb posted this 2 weeks ago

    Is it possible to earse Punch-Hole marks when ocr files  using FR Engine 10 or 14, we have scanned documents with Punch-Hole marks on left and right side,but we cant say which location and size of mark.Is it possible to remove when ocr files.

Here i attach sample pdf file.

Attached Files

Nikolay Krivchanskiy posted this 3 days ago

Hi Aravind,

For your issue we would recommend ImageDocument::Modify method. This method uses ImageModification object to update and change the ImageDocument.

You can use ImageModification::AddReplaceBlackPixelsRegion. Effectively replaces all black pixels in the set region.

For more information about ImageModification object, please refer to Help → API Reference → Image-Related Objects → ImageModification.

These holes are generally recognized as images, therefore you can use Layout::LayoutBlocks to remove them. You should iterate through blocks, returned by foresaid method, detect image blocks with coordinates left to or right to the rest of the text blocks, get their Block::Region and pass this region to ImageModification::AddReplaceBlackPixelsRegion.


If you do not intend to detect any other pictures, you can simply set PageAnalysisParams::DetectPictures to false, to effectively achieve the same result.