You are viewing limited content. For full access, please sign in.

Question

Question

Create Yellow highlight at coordinate position on a page

asked on April 23, 2018

For a conversion from DocStar to Laserfiche 10.2 I am also converting document annotations. Using the SDK I need to highlight a section on a page using rectangle coordinates I have from the source document, as opposed to tying it to OCR text. In fact the text is handwritten in many cases. So I am trying to use the HighlightAnnotation, adding the coordinates via an LFRectangle object  but it is telling me that the ImageRectangles property of HighlightAnnotation is read only. 

<<-- Prior to this I initialize PageInfo as pInfo -->

Dim HA As HighlightAnnotation = New HighlightAnnotation()

Try

HA.ImageRectangles.Add(LFRect)  ' Getting an error here that this collection is read only

Catch ex As Exception

LogInformation("Error adding LFRect to ImageRectangle for LFDoc ID " & LFDocID.ToString() & " - Docstar Doc ID: " & AnnotationData.DocID.ToString() & ", Pagenum: " & PageNum.ToString() & ", Content: " & AnnotationData.Text & ": " & ex.Message)

End Try

HA.Color = LFBackgroundColor

Try

pinfo.AddAnnotation(HA)

Catch ex As Exception

LogInformation("Error adding annotation for LFDoc ID " & LFDocID.ToString() & " - Docstar Doc ID: " & AnnotationData.DocID.ToString() & ", Pagenum: " & PageNum.ToString() & ", Content: " & AnnotationData.Text)

End Try

 

Other annotation types I have tried such as rectangle or redaction cover the text - I need the text on the image under the highlight to be visible. The HighlightAnnotation in 10.2 seems to only accept StartText and EndText from matched OCR text.

 

Help?

 

0 0

Answer

SELECTED ANSWER
replied on April 23, 2018

As is often the case, no sooner did I ask the question than the answer dawned on me. I needed to initialize a list of type Common.LFRectangle and set the ImageRectangles collection to that instead of trying to Add to the ImageRectangles collection.

So instead of this:

HA.ImageRectangles.Add(LFRect)  ' Getting an error here that this collection is read only

This:

Dim LFRectList As New List(Of Common.LfRectangle)

LFRectList.Add(LFRect)

Try

     HA.ImageRectangles = LFRectList

Catch ex As Exception

     MessageBox.Show("Doh ! " & ex.message)

End Try

 

3 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.