You'll quickly find that Acrobat's IAC (COM implementation) provides bare-bones functionality. They do provided a CAcroPDBookmark object, but it doesn't provide a Create() method! You can get and set titles with it, navigate and destroy bookmarks, but as far as I can tell, you can't create them.
However, in Acrobat's JavaScript DOM, there is also a Bookmark Object, which has a CreateChild() method and an InsertChild() method. These appear to let you create bookmarks.
There doesn't appear to be any way for VB to communicate with the JS object though, so passing in names/labels (strings) from VB for a JavaScript function to use might not be possible.
Sorry... but Adobe has historically provided extremely weak Automation/COM support with Acrobat.
So my suggestion is to table VB for now and look into JavaScript.
If you're creating your PDFs from PostScript, you can use the pdfmark operator to build bookmarks and other link annotations.
The solution does exist. I am using Adobe Acrobat 4 and Visual Basic 6.
Dim PDBookmark As CAcroPDBookmark
Dim AcroApp As CAcroApp
Dim AVYourDoc As CAcroAVDoc
Dim PDYourDoc As CAcroPDDoc
Dim bFileOpen4 As Boolean
Dim btitle As Boolean
'Create the Acrobat Object
Set acroApp = CreateObject("AcroExch.App", ""
'Show the Application
acroApp.Show
'Create Doc objects
Set PDYourDoc = CreateObject("AcroExch.PDDoc", ""
Set AVYourDoc = CreateObject("AcroExch.AVDoc", ""
'code to load your doc doc
bFileOpen4 = AVYourDoc.Open("path to your doc", "Window Title"
Set PDYourDoc = AVYourDoc.GetPDDoc
'Create BookMark Object
Set PDBookmark = CreateObject("AcroExch.PDBookmark", ""
'activate the app
acroApp.Show
'execute the menu item
acroApp.MenuItemExecute ("NewBookmark"
'set bookmark title
btitle = PDBookmark.GetByTitle(PDYourDoc, "Untitled"
btitle = PDBookmark.SetTitle("bookmarktitle"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.