Highlighting block regions in ImageViewer

  • 70 Views
  • Last Post 06 December 2017
  • Topic Is Solved
PhilippWuelfing posted this 16 November 2017

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.

Order By: Standard | Newest | Votes
Denis Gusak posted this 24 November 2017

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.

PhilippWuelfing posted this 04 December 2017

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).

PhilippWuelfing posted this 04 December 2017

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.

 

 

PhilippWuelfing posted this 06 December 2017

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.

Close