AddActionArea
IPDFDocument4 :: Page Operations :: Common

See Also Example
Collapse All

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

Syntax

LONG AddActionArea (
FLOAT left,
FLOAT top,
FLOAT right,
FLOAT bottom,
LONG actionNumber
)
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

actionNumber
Index of an action

Return value
Created annotation index.

Remarks

This method inserts an action annotation area into the current page in an area bounded by the specified coordinates. Each mouse click in the annotation area executes the action with index actionNumber (created by any of the Action groupmethods).

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

Example

Adding an Action Area

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
action := PDF.CreateJavascriptAction('app.alert("Hello!")');
PDF.AddActionArea(30, 30, 130, 130, action);
PDF.DrawRectangle(30, 30, 100, 100, 0);
PDF.Stroke;
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long action = PDF->CreateJavascriptAction("app.alert('Hello!')");
PDF->AddActionArea(30, 30, 130, 130, action);
PDF->DrawRectangle(30, 30, 100, 100, 0);
PDF->Stroke();
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long action = PDF.CreateJavascriptAction("app.alert('Hello!')");
PDF.AddActionArea(30, 30, 130, 130, action);
PDF.DrawRectangle(30, 30, 100, 100, 0);
PDF.Stroke();
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
action = PDF.CreateJavascriptAction("app.alert('Hello!')")
PDF.AddActionArea 30, 30, 130, 130, action
PDF.DrawRectangle 30, 30, 100, 100, 0
PDF.Stroke
PDF.SaveToFile "test.pdf", true

See Also

Reference