GetActionRemotePageDestination Method (GdPicturePDF)
Returns the remote destination information (a file, a page number and a page view with the used coordinates) of the specified GoToR action. This action jumps
to a destination in another PDF file according to the defined destination parameters.
public GdPictureStatus GetActionRemotePageDestination(
int ,
ref PdfDestinationType ,
ref string ,
ref bool ,
ref int ,
ref float ,
ref float ,
ref float ,
ref float ,
ref float
)
public function GetActionRemotePageDestination(
: Integer;
var : PdfDestinationType;
var : String;
var : Boolean;
var : Integer;
var : Single;
var : Single;
var : Single;
var : Single;
var : Single
): GdPictureStatus;
public function GetActionRemotePageDestination(
: int,
: PdfDestinationType,
: String,
: boolean,
: int,
: float,
: float,
: float,
: float,
: float
) : GdPictureStatus;
public: GdPictureStatus GetActionRemotePageDestination(
int ,
ref PdfDestinationType ,
ref string* ,
ref bool ,
ref int ,
ref float ,
ref float ,
ref float ,
ref float ,
ref float
)
'Declaration
Public Function GetActionRemotePageDestination( _
ByVal As Integer, _
ByRef As PdfDestinationType, _
ByRef As String, _
ByRef As Boolean, _
ByRef As Integer, _
ByRef As Single, _
ByRef As Single, _
ByRef As Single, _
ByRef As Single, _
ByRef As Single _
) As GdPictureStatus
Parameters
- ActionID
- A unique action identifier specifying a required action object. You can obtain this identifier using these methods: GdPicturePDF.GetViewerOpenActionID, GdPicturePDF.GetBookmarkActionID, GdPicturePDF.GetFormFieldActionID, GdPicturePDF.GetAnnotationActionID or GdPicturePDF.NewActionGoToR.
Please ensure that the type of the action object specified by this identifier is exactly the PdfActionType.ActionTypeGoToR, otherwise the method will fail. You can check the type of the required action object using the GdPicturePDF.GetActionType method as it is shown in the example below.
- DestinationType
- Output parameter. A member of the PdfDestinationType enumeration. Sets up a particular view of a destination to jump specified by the this action.
- FilePath
- Output parameter. The file path in which the destination is located.
- NewWindow
- Output parameter. Specifies whether to open the destination document in a new window. If the returned value is false, the destination document
replaces the current document in the same window.
- Page
- Output parameter. The destination page number.
- Left
- Output parameter. The horizontal (left) coordinate of the document window's position according to the used DestinationType mentioned above. The value of this coordinate is
expressed in the currently set units according to the currently used coordinate space, see the Remarks section below.
- Bottom
- Output parameter. The vertical (bottom) coordinate of the document window's position according to the used DestinationType mentioned above. The value of this coordinate
is expressed in the currently set units according to the currently used coordinate space, see the Remarks section below.
- Right
- Output parameter. The horizontal (right) coordinate of the document window's position according to the used DestinationType mentioned above. The value of this coordinate is
expressed in the currently set units according to the currently used coordinate space, see the Remarks section below.
- Top
- Output parameter. The vertical (top) coordinate of the document window's position according to the used DestinationType mentioned above. The value of this coordinate is
expressed in the currently set units according to the currently used coordinate space, see the Remarks section below.
- Zoom
- Output parameter. The zoom factor to use when displaying the destination page according to the DestinationType configuration.
The return value of 1 means 100% zoom, 2 means 200%, 0,5 for 50%, etc. The value of 0 means that the current zoom value should remain unchanged.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
If the action object specified by the action identifier is not of the type PdfActionType.ActionTypeGoToR, the reason for the method's failure is GdPictureStatus.InvalidParameter.
How to find out the destinations of all actions of type GoToR associated with the form fields in the PDF document.
Dim caption As String = "Example: GetActionRemotePageDestination"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("forms_actions.pdf", False) = GdPictureStatus.OK Then
Dim FormsCount As Integer = gdpicturePDF.GetFormFieldsCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status <> GdPictureStatus.OK OrElse FormsCount = 0 Then
MessageBox.Show("The GetFormFieldsCount() method has failed or " + vbCrLf + " this PDF document doesn't include any form fields.", caption)
Else
Dim ActionsR As String = ""
For x As Integer = 0 To FormsCount - 1
Dim FFId As Integer = gdpicturePDF.GetFormFieldId(x)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim ActionId As Integer = gdpicturePDF.GetFormFieldActionID(FFId)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim ActionType As PdfActionType = gdpicturePDF.GetActionType(ActionId)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If ActionType = PdfActionType.ActionTypeGoToR Then
ActionsR = ActionsR + "Form Field Nr." + (x + 1).ToString() + " has associated action of type: " + ActionType.ToString() + vbCrLf
Dim DestType As PdfDestinationType = PdfDestinationType.DestinationTypeUndefined
Dim File As String = ""
Dim NewWindow As Boolean = False
Dim Page As Integer = -1
Dim Left As Single = 0, Bottom As Single = 0, Right As Single = 0, Top As Single = 0, Zoom As Single = 0
status = gdpicturePDF.GetActionRemotePageDestination(ActionId, DestType, File, NewWindow, Page, Left,
Bottom, Right, Top, Zoom)
If status = GdPictureStatus.OK Then
ActionsR = ActionsR + " Destination: " + DestType.ToString() + " in file " + File + vbCrLf +
"New window:" + NewWindow.ToString() + ", Page Nr." + Page.ToString() +
", Coords = (" + Left.ToString() + "," + Bottom.ToString() + ");(" + Right.ToString() + "," + Top.ToString() + "), Zoom = " + Zoom.ToString() + vbCrLf
Else
ActionsR = ActionsR + " but the GetActionRemotePageDestination() method has failed with the status: " + status.ToString() + vbCrLf
End If
Else
ActionsR = ActionsR + "Form Field Nr." + (x + 1).ToString() + " has associated another type of action." + vbCrLf
End If
End If
End If
End If
Next
MessageBox.Show(ActionsR, caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetActionRemotePageDestination";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms_actions.pdf", false) == GdPictureStatus.OK)
{
int FormsCount = gdpicturePDF.GetFormFieldsCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status != GdPictureStatus.OK || FormsCount == 0)
{
MessageBox.Show("The GetFormFieldsCount() method has failed or \n this PDF document doesn't include any form fields.", caption);
}
else
{
string ActionsR = "";
for (int x = 0; x <= FormsCount - 1; x++)
{
int FFId = gdpicturePDF.GetFormFieldId(x);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
int ActionId = gdpicturePDF.GetFormFieldActionID(FFId);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
PdfActionType ActionType = gdpicturePDF.GetActionType(ActionId);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (ActionType == PdfActionType.ActionTypeGoToR)
{
ActionsR = ActionsR + "Form Field Nr." + (x + 1).ToString() + " has associated action of type: " + ActionType.ToString() + "\n";
PdfDestinationType DestType = PdfDestinationType.DestinationTypeUndefined;
string File = "";
bool NewWindow = false;
int Page = -1;
float Left = 0, Bottom = 0, Right = 0, Top = 0, Zoom = 0;
status = gdpicturePDF.GetActionRemotePageDestination(ActionId, ref DestType, ref File, ref NewWindow, ref Page, ref Left, ref Bottom, ref Right, ref Top, ref Zoom);
if (status == GdPictureStatus.OK)
{
ActionsR = ActionsR + " Destination: " + DestType.ToString() + " in file " + File +
"\nNew window:" + NewWindow.ToString() + ", Page Nr." + Page.ToString() +
", Coords = (" + Left.ToString() + "," + Bottom.ToString() + ");(" + Right.ToString() + "," + Top.ToString() + "), Zoom = " + Zoom.ToString() + "\n";
}
else
{
ActionsR = ActionsR + " but the GetActionRemotePageDestination() method has failed with the status: " + status.ToString() + "\n";
}
}
else
{
ActionsR = ActionsR + "Form Field Nr." + (x + 1).ToString() + " has associated another type of action.\n";
}
}
}
}
}
MessageBox.Show(ActionsR, caption);
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();