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: Annotation & Bookmark
Conf: (P-PDF) Developers, Msg: 51670
From: winnielyk
Date: 5/29/2002 04:47 PM

I'm a novice in using Adobe SDK 4, from Visual Basic 6. I hope you can help me on certain complications that I'm facing currently. Appreciate your help. Tks.

1) After creating annotation in a PDF document using AddNewAnnot method, how do I lock it from users so that they can only view the contents without changing them?

2) I tried to capture the behaviour of annotations, by creating a few & having a routine to count the total annotations created. Whenever I create an annotation, double-click to open for viewing, it is considered as 1 annotation. When I repeated this step say 2 times, then the total count will be 3, though I only have 1 single annotation created.

3) How do I link the annotations to bookmark?

For easy reference, I also enclosed the following codes that I obtained from Adobe SDK 4.

Public Sub SetAnnotation(strAnnot As String)
Dim objPdAnnot As CAcroPDAnnot
Dim objRect As CAcroRect
Dim objTime As CAcroTime

On Error GoTo Err_Handler

Set mobjPdDoc = mObjAcrAVDoc.GetPDDoc

' Obtain the AVPageView and PDPage
Set mobjAVPageView = mObjAcrAVDoc.GetAVPageView()
Set mobjPdPage = mobjAVPageView.GetPage()

' Create an AcroExch.Rect object
Set objRect = CreateObject("AcroExch.Rect")
' Set values for rect - increases from right to left and bottom to top
objRect.Left = 200
objRect.Right = 400
objRect.Bottom = 200
objRect.Top = 400

' Add a text annotation (a note) before the first annotation on the page
Set objPdAnnot = mobjPdPage.AddNewAnnot(-1, "Text", objRect)
If (objPdAnnot.IsValid) Then
objPdAnnot.SetTitle "Brand New Text Annotation"
objPdAnnot.SetOpen False
objPdAnnot.SetContents "This is an annotation of type 'Text'"

' Create an AcroExch.Time object and fill it

Set objTime = CreateObject("AcroExch.Time")
objTime.Year = 1996
objTime.Month = 12
objTime.Date = 25
objTime.Hour = 12
objTime.Minute = 1
objTime.Second = 59
objTime.millisecond = 2
objTime.Day = 2
objPdAnnot.SetDate objTime

' Set the color for the objPdAnnot; R is 1st byte, G is 2nd byte, B is 3rd byte
' 0 is minimum (black); 255 is maximum (full Red, Green, or Blue)
Dim color As Long
color = 255 'Red
' color = 65280 'Green
' color = 16711680 'Blue
objPdAnnot.SetColor color

End If

Exit Sub

Err_Handler:
'SetAnnotation = False
Exit Sub
End Sub

Public Sub GetTotalAnnotation()
Dim objPdAnnot As CAcroPDAnnot
Dim objPdAnnotPrev As CAcroPDAnnot
Dim numAnnots, ctr, idx As Long, msg As String, str, title As String

' Acquire the AVPageView and PDPage
Set mobjAVPageView = mObjAcrAVDoc.GetAVPageView()
Set mobjPdPage = mobjAVPageView.GetPage()
' Get the number of annots on the page
numAnnots = mobjPdPage.GetNumAnnots()
If (numAnnots > 0) Then
For ctr = 0 To numAnnots - 1
Set objPdAnnot = mobjPdPage.GetAnnot(ctr)

idx = mobjPdPage.GetAnnotIndex(objPdAnnot)
If (objPdAnnot.IsValid) Then
str = "is valid"
MsgBox idx & " - " & objPdAnnot.GetContents
Else
str = "is not valid"
End If

Next ctr
' msg = "Num Annots on Page = " & numAnnots & "; Annot 0 = " & str
Else
msg = "There are no annots on the page"
End If
'Style = vbOKOnly
title = "PDAnnot Demo"
MsgBox msg, vbOKOnly, title
End Sub

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

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
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.

Features

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.