Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

FreeText Annotation not being added in New Adobe

New Here ,
Jun 11, 2025 Jun 11, 2025

I have vb.net code that was adding a Text Box to my Adobe forms.  It worked prior to the new version of adobe.  I was using the following code:

Public Sub addAnnotation(commentText As String, PageNum As String, rect() As Object, editable As Boolean)
Dim annot As Object
Dim props As Object

annot = jso.addAnnot()
props = annot.getProps

props.type = "FreeText"
props.page = PageNum
props.contents = commentText
props.strokeColor = jso.Color.black
props.Rect = rect
props.name = commentText
props.readonly = editable
annot.setProps(props)
End Sub

 

After going to the newer version (I cannot go back to the older version of Adobe due to company policy) it does nothing when I run this.  I made a small change and have it assign the type of FreeText first which then gives me a rectangle on the Form, but the text doesn't display in it.

 

Public Sub addAnnotation(commentText As String, PageNum As String, rect() As Object, editable As Boolean)
Dim annot As Object
Dim props As Object

annot = jso.addAnnot()
props = annot.getProps

props.type = "FreeText"
annot.setProps(props)
props = annot.getProps
props.page = PageNum
props.contents = commentText
props.strokeColor = jso.Color.black
props.Rect = rect
props.name = commentText
props.readonly = editable
annot.setProps(props)
End Sub

 

What do I need ot chnage so I can add the type of text box threw the SDK to display the text on the form.

TOPICS
Acrobat SDK and JavaScript
114
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2025 Jun 12, 2025
LATEST

I would suggest two things. 

1)  Do not run a complex series of JS code directly from VB.  The VB and JS objects are different animals. The best strategy for running Acrobat JS from VB is to put as much of the JS functionality into a folder level JS function, then call that function from the VB.  This also give you the ability to test the JS before using it in a foriegn context. 

2) Do not call Add Annot with an empty argument list. Add all necessary arguments are presetnt at the time it is called. 

 

Did you check the Acrobat Console for errors?  It's likely that Acrobat is telling you the problem. 

Also, make sure the document being operated does not have security on it. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines