Requirements:
Downgrade sub HighLightText to VB6. Bonus points if you can modify the routine to additionally replace text, and use addlink method via additional passed array parameters. The methods referencing 'Adobe Acrobat 9.0 Type Library' still can be used. Ie, getPageNthWordQuads, getPageNumWords, getPageNthWord, addAnnot, GetProps, SetProps, .flattenPages(), etc.
Scope:
I have the following global variables in my VB6 project: Dim gApp, gPDDoc, jso. This routine was found on the internet, and I'd like to incorporate it into my project. Attached is a VB6 procedure that will give you some context in referencing those variables. Also:
Variable m_JSO, has already been defined by jso.
Variable m_PDDoc, has already been defined by gPDDoc.
-=--=--=--=--=--=--=--=--=-
Public Sub HighLightText(ByVal Text() As String)
If Not Me.m_PDDoc Is Nothing Then
Dim m_JSO As Object = [login to view URL]
Dim m_Matches As New ArrayList
'Find text
For m_Page As Integer = 0 To [login to view URL] - 1
For m_Word As Integer = 0 To [login to view URL](m_Page)
Dim m_CurrentWord As String = [login to view URL](m_Page, m_Word)
If Not m_CurrentWord Is Nothing Then
If [login to view URL](Text, m_CurrentWord) >= 0 Then
[login to view URL](New Integer() {m_Page, m_Word})
End If
End If
Next
Next
'Highlight text
For Each m_Match As Array In Me.m_Matches
Dim m_Quad As Object = [login to view URL]([login to view URL](0), [login to view URL](1))
Dim m_HighLight = [login to view URL]()
Dim m_Properties = [login to view URL]
With m_Properties
m_Color = New Object() {"RGB", Me.m_HighlightColor.R, Me.m_HighlightColor.G, Me.m_HighlightColor.B}
.Type = "Square"
.Page = [login to view URL](0)
.Rect = New Integer() {CType(m_Quad(0), Array).GetValue(0), _
CType(m_Quad(0), Array).GetValue(1), _
CType(m_Quad(0), Array).GetValue(6), _
CType(m_Quad(0), Array).GetValue(7)}
.StrokeColor = m_Color
.FillColor = m_Color
.Width = 0
.Opacity = 0.35
End With
[login to view URL](m_Properties)
Next
'Finalize highlights
[login to view URL]()
'Clean up
m_JSO = Nothing
End If
End Sub