Community

Highlighting block regions in ImageViewer Answered

Hello,

is it possible to highlight the rectangle of a block via API?

Scenario would be to open an image file (PDF), query coordinates for the needed block regions from a database and then select/hightlight the regions in ImageViewer.

Then change the region size with Imageviewer and update the database with the new coordinates.

Was this article helpful?

0 out of 0 found this helpful

Comments

4 comments

  • Avatar
    Permanently deleted user

    Hi,

     

    You can connect FRPage of your document to ImageViewer, then add a region to this page with coordinates from database and this region will appear in the ImageViewer. You will be able to change the size of this region in ImageViewer and all the changes will be synchronized with your document. You can follow all the changes using OnMouseButtonUp event and update the database with new coordinates.

    0
  • Avatar
    Permanently deleted user

    Hi,

    thank you for your answer.

     

    How to connect the FRPage object to the ImageViewer?

    I am using your sample "VisualComponents".

     

    Edit: I only know how to connect FRDocument object to ImageViewer using Synchronizer (setting the document property of Synchronizer object).

    0
  • Avatar
    Permanently deleted user

    Using your Sample "Visual Components", I open a pdf and add a block programmatically, but the rectangle isn't drawed in the ImageViewer control.

    Here is how I do it:

     

        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

     

            Dim Region As FREngine.Region = Engine.CreateRegion

            Region.AddRect(1975, 403, 1975 + 131, 403 + 41)

            Dim Block As FREngine.IBlock = document.Pages(0).Layout.AddBlock(FREngine.BlockTypeEnum.BT_Text, Region)

     

            Dim RP As FREngine.RecognizerParams = Engine.CreateRecognizerParams

            RP.TextLanguage = Engine.PredefinedLanguages.FindLanguage("German").TextLanguage

     

            Dim Textblock As FREngine.ITextBlock = Block.GetAsTextBlock

            Textblock.RecognizerParams = RP

     

             imageViewer.FRPage = document.Pages(0)

        End Sub

     

    The block coordinates are valid.

     

     

    0
  • Avatar
    Permanently deleted user

    Solution: If the same FRPage is already connected to ImageViewer, you have to set the property to null before setting the FRPage (now with existing blocks) again.

    0

Please sign in to leave a comment.