PDFPAGE_SetAction
IPDFDocument3 :: Annotations

See Also Example
Collapse All

This method creates an action annotation on the current PDF page.

Syntax

LONG PDFPAGE_SetAction (
LONG left,
LONG top,
LONG right,
LONG bottom,
LONG actionIndex
)
Parameters
left
X coordinate of the top-left corner of the bounding rectangle

top
Y coordinate of the top-left corner of the bounding rectangle

right
X coordinate of the bottom-right corner of the bounding rectangle

bottom
Y coordinate of the bottom-right corner of the bounding rectangle.

actionIndex
Index of the action

Return value
Index of the annotation

Remarks

PDFPAGE_SetAction inserts an action annotation area into the current page in an area bounded by the coordinates specified. Each mouse click in the annotation area executes the action with index actionIndex (created from any action in the actions collection).

The return value is an annotation/control identifier in document's annotations collection and can be used inĀ AddControlToAction, CurrentAnnotationIndex.

Equivalent in new interface: IPDFDocument4::AddActionArea.

Example

Creating an Action Annotation on a Page

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
ind := PDF.CreateJavascriptAction('app.alert("Hello")');
PDF.PDFPAGE_Rectangle(100, 200, 210, 250);
PDF.PDFPAGE_Stroke;
PDF.PDFPAGE_SetAction(100, 200, 210, 250, ind);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
LONG ind = PDF->CreateJavascriptAction("app.alert('Hello')");
PDF->PDFPAGE_Rectangle(100, 200, 210, 250);
PDF->PDFPAGE_Stroke();
PDF->PDFPAGE_SetAction(100, 200, 210, 250, ind);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
long ind = PDF.CreateJavascriptAction("app.alert('Hello')");
PDF.PDFPAGE_Rectangle(100, 200, 210, 250);
PDF.PDFPAGE_Stroke();
PDF.PDFPAGE_SetAction(100, 200, 210, 250, ind);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
ind = PDF.CreateJavascriptAction("app.alert('Hello')")
PDF.PDFPAGE_Rectangle 100, 200, 210, 250
PDF.PDFPAGE_Stroke
PDF.PDFPAGE_SetAction 100, 200, 210, 250, ind
PDF.EndDoc

See Also

Reference