
Adobe Acrobat SDK
Working with Bookmarks
Developing Plug-ins and Applications
Deleting bookmarks 120
if (!PDBookmarkIsValid(aBookmark))
E_RTRN_VOID
//Get the title of the bookmark
char * bmBuf;
ASInt32 bufSize = PDBookmarkGetTitle(aBookmark, NULL, 0) +1;
//Allocate the size of bufSize to the character pointer
bmBuf = (char*)ASmalloc((os_size_t)bufSize);
//Populate bmBuf with the bookmark's title
PDBookmarkGetTitle(aBookmark, bmBuf, bufSize);
//Display the title of the bookmark within a message box
AVAlertNote(bmBuf);
//Determine if the current bookmark has children bookmark
if (PDBookmarkHasChildren (aBookmark))
{
//Get the first child of the bookmark
treeBookmark = PDBookmarkGetFirstChild(aBookmark);
while (PDBookmarkIsValid (treeBookmark)){
VisitAllBookmarks (treeBookmark);
treeBookmark = PDBookmarkGetNext(treeBookmark);
}
}
HANDLER
END_HANDLER
}
Deleting bookmarks
You can use the Acrobat core API to delete an existing bookmark. Deleting a bookmark deletes child
bookmarks; however, PDF document content is not affected. To delete a bookmark, you must invoke the
PDBookmarkDestroy
method and pass a
PDBookmark
object that represents the bookmark to delete.
For example, consider the bookmark structure shown in the following diagram.
Assume, for example, that you want to delete the bookmark titled Copying LiveCycle Print files. Once you
delete this bookmark, the API files and XDC files bookmarks are also deleted. To delete the Copying
LiveCycle Print files bookmark, you must create a
PDBookmark
object that represents this bookmark and
pass this object to the
PDBookmarkDestroy
method.
The following code example deletes a bookmark. Included in this code example is application logic that
retrieves a specific bookmark. For information, see
“Retrieving a specific bookmark” on page 118
.