Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: Creating annotations using Visual Basic
Conf: (P-PDF) Developers, Msg: 119949
From: sgluzberg
Date: 10/9/2004 03:39 AM

Hello everyone,

I have a bit of problem creating annotations using VB. Probably I'm doing something wrong with JSO object. I just don't seem to get what exactly.
So, if someone could take a look at piece of code that I use and tell where the problem is, I'd really appreciate it. This code does create annotation, but I can't get to work properties "strokeColor" and "alignment". The contents of annotation, for some reason appears in red color and alignment is always left justified.
Private Sub Command2_Click()
Dim pdDoc As Acrobat.CAcroPDDoc
Dim page As Acrobat.CAcroPDPage
Dim jso As Object
Dim path As String
'Dim point(0 To 1) As Integer
Dim popupRect(0 To 3) As Integer
Dim pageRect As Object
Dim annot As Object
Dim props As Object

path = CommonDialog1.FileName
Set pdDoc = CreateObject("AcroExch.PDDoc")
If pdDoc.Open(path) Then
Set jso = pdDoc.GetJSObject
If Not jso Is Nothing Then
Set page = pdDoc.AcquirePage(0)
'Set pageRect = page.GetSize
popupRect(0) = 10
popupRect(1) = 10
popupRect(2) = 200
popupRect(3) = 42
Set annot = jso.AddAnnot
Set props = annot.getProps
props.Type = "FreeText"
annot.setProps props
Set props = annot.getProps = "myFreeText" = 1
props.textFont = jso.Font.Helv
props.textSize = 10
props.rect = popupRect
props.strokeColor =
props.fillColor = jso.Color.white
props.contents = "Some Text"
props.alignment = 2
props.Width = 0
annot.setProps props
pdDoc.Save PDSaveIncremental, path
End If
MsgBox "Annotation added to " & path
MsgBox "Failed to open " & path
End If
Set pdDoc = Nothing
End Sub

Thank you in advance.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.