A unique action identifier specifying a required action object. You can obtain this identifier using these methods: GetViewerOpenActionID, GetBookmarkActionID, GetFormFieldActionID, GetAnnotationActionID or NewActionLaunch.

Please ensure that the type of the action object specified by this identifier is exactly the PdfActionType.ActionTypeLaunch, otherwise the method will fail. You can check the type of the required action object using the GetActionType method as it is shown in the example below.

Output parameter. The file name of the application to be launched or the document to be opened or printed, in standard Windows pathname format.
Output parameter. The default directory (related to the FileName and the Operation parameters) in standard DOS syntax. It is a Windows-specific parameter, so if it is not defined in the PDF document, the result is an empty string.
Output parameter. A parameter string to be passed to the application designated by the FileName parameter. It is a Windows-specific parameter, so if it is not defined in the PDF document, the result is an empty string.
Output parameter. A member of the PdfActionLaunchOperation enumeration. It is a Windows-specific parameter, so if it is not defined in the PDF document, the result is PdfActionLaunchOperation.ActionLaunchOperationUndefined.
Output parameter. Specifies whether to open the related document (see the FileName parameter) in a new window. If the returned value is false, the specified document replaces the current document in the same window. This value is ignored if the specified document is not a PDF document.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetActionLaunchDestination Method

GetActionLaunchDestination Method (GdPicturePDF)

In This Topic
Returns the action related information (the application name or the filename and its parameters) of a specified action of the type Launch. A launch action launches an application or opens or prints a document.
Syntax
'Declaration

 

Public Function GetActionLaunchDestination( _

   ByVal ActionID As Integer, _

   ByRef FileName As String, _

   ByRef DefaultDirectory As String, _

   ByRef Parameters As String, _

   ByRef Operation As PdfActionLaunchOperation, _

   ByRef NewWindow As Boolean _

) As GdPictureStatus
public GdPictureStatus GetActionLaunchDestination( 

   int ActionID,

   ref string FileName,

   ref string DefaultDirectory,

   ref string Parameters,

   ref PdfActionLaunchOperation Operation,

   ref bool NewWindow

)
public function GetActionLaunchDestination( 

    ActionID: Integer;

   var  FileName: String;

   var  DefaultDirectory: String;

   var  Parameters: String;

   var  Operation: PdfActionLaunchOperation;

   var  NewWindow: Boolean

): GdPictureStatus; 
public function GetActionLaunchDestination( 

   ActionID : int,

   FileName : String,

   DefaultDirectory : String,

   Parameters : String,

   Operation : PdfActionLaunchOperation,

   NewWindow : boolean

) : GdPictureStatus;
public: GdPictureStatus GetActionLaunchDestination( 

   int ActionID,

   ref string* FileName,

   ref string* DefaultDirectory,

   ref string* Parameters,

   ref PdfActionLaunchOperation Operation,

   ref bool NewWindow

) 
public:

GdPictureStatus GetActionLaunchDestination( 

   int ActionID,

   String^% FileName,

   String^% DefaultDirectory,

   String^% Parameters,

   PdfActionLaunchOperation% Operation,

   bool% NewWindow

) 

Parameters

ActionID
A unique action identifier specifying a required action object. You can obtain this identifier using these methods: GetViewerOpenActionID, GetBookmarkActionID, GetFormFieldActionID, GetAnnotationActionID or NewActionLaunch.

Please ensure that the type of the action object specified by this identifier is exactly the PdfActionType.ActionTypeLaunch, otherwise the method will fail. You can check the type of the required action object using the GetActionType method as it is shown in the example below.

FileName
Output parameter. The file name of the application to be launched or the document to be opened or printed, in standard Windows pathname format.
DefaultDirectory
Output parameter. The default directory (related to the FileName and the Operation parameters) in standard DOS syntax. It is a Windows-specific parameter, so if it is not defined in the PDF document, the result is an empty string.
Parameters
Output parameter. A parameter string to be passed to the application designated by the FileName parameter. It is a Windows-specific parameter, so if it is not defined in the PDF document, the result is an empty string.
Operation
Output parameter. A member of the PdfActionLaunchOperation enumeration. It is a Windows-specific parameter, so if it is not defined in the PDF document, the result is PdfActionLaunchOperation.ActionLaunchOperationUndefined.
NewWindow
Output parameter. Specifies whether to open the related document (see the FileName parameter) in a new window. If the returned value is false, the specified document replaces the current document in the same window. This value is ignored if the specified document is not a PDF document.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the returned 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.ActionTypeLaunch, the reason for the method's failure is GdPictureStatus.InvalidParameter.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
How to find out the action related information of all actions of type Launch associated with the form fields in the PDF document.
Dim caption As String = "Example: GetActionLaunchDestination"

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 ActionsL 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.ActionTypeLaunch Then

                            ActionsL = ActionsL + "Form Field Nr." + (x + 1).ToString() + " has associated action of type: " + ActionType.ToString() + vbCrLf

                            Dim File As String = "", DefDir As String = "", Params As String = ""

                            Dim LaunchOp As PdfActionLaunchOperation = PdfActionLaunchOperation.ActionLaunchOperationUndefined

                            Dim NewWindow As Boolean = False

                            status = gdpicturePDF.GetActionLaunchDestination(ActionId, File, DefDir, Params, LaunchOp, NewWindow)

                            If status = GdPictureStatus.OK Then

                                ActionsL = ActionsL + "    File: " + File + " New window:" + NewWindow.ToString() + vbCrLf +

                                "    (Win specific) Directory: " + DefDir + " Parameters: " + Params + " Operation: "

                                Select Case LaunchOp

                                    Case PdfActionLaunchOperation.ActionLaunchOperationOpen

                                        ActionsL = ActionsL + "open" + vbCrLf

                                        Exit Select

                                    Case PdfActionLaunchOperation.ActionLaunchOperationPrint

                                        ActionsL = ActionsL + "print" + vbCrLf

                                        Exit Select

                                    Case PdfActionLaunchOperation.ActionLaunchOperationUndefined

                                        'This value is optional - if the result is undefined, probably the value is not specified in the PDF document.

                                        'The default value is open by the definition in the PDF Reference.

                                        'You can add your own preferred notes here.

                                        ' ActionsL = ActionsL + "undefined - default: open\n"

                                        Exit Select

                                    Case Else

                                        'The default value is open by definition in the PDF Reference.

                                        'You can add your own preferred notes here.

                                        ' ActionsL = ActionsL + "undefined - default: open\n"

                                        Exit Select

                                End Select

                            Else

                                ActionsL = ActionsL + "    but the GetActionLaunchDestination() method has failed with the status: " + status.ToString() + vbCrLf

                            End If

                        Else

                            ActionsL = ActionsL + "Form Field Nr." + (x + 1).ToString() + " has associated another type of action." + vbCrLf

                        End If

                    End If

                End If

            End If

        Next

        MessageBox.Show(ActionsL, caption)

    End If

Else

    MessageBox.Show("The file can't be loaded.", caption)

End If

gdpicturePDF.Dispose()
string caption = "Example: GetActionLaunchDestination";

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 ActionsL = "";

        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.ActionTypeLaunch)

                        {

                            ActionsL = ActionsL + "Form Field Nr." + (x + 1).ToString() + " has associated action of type: " + ActionType.ToString() + "\n";

                            string File = "", DefDir = "", Params = "";

                            PdfActionLaunchOperation LaunchOp = PdfActionLaunchOperation.ActionLaunchOperationUndefined;

                            bool NewWindow = false;

                            status = gdpicturePDF.GetActionLaunchDestination(ActionId, ref File, ref DefDir, ref Params, ref LaunchOp, ref NewWindow);

                            if (status == GdPictureStatus.OK)

                            {

                                ActionsL = ActionsL + "    File: " + File + " New window:" + NewWindow.ToString() + "\n" +

                                    "    (Win specific) Directory: " + DefDir + " Parameters: " + Params + " Operation: ";

                                switch (LaunchOp)

                                {

                                    case PdfActionLaunchOperation.ActionLaunchOperationOpen:

                                        ActionsL = ActionsL + "open\n";

                                        break;

                                    case PdfActionLaunchOperation.ActionLaunchOperationPrint:

                                        ActionsL = ActionsL + "print\n";

                                        break;

                                    case PdfActionLaunchOperation.ActionLaunchOperationUndefined:

                                        //This value is optional - if the result is undefined, probably the value is not specified in the PDF document.

                                        //The default value is open by the definition in the PDF Reference.

                                        //You can add your own preferred notes here.

                                        // ActionsL = ActionsL + "undefined - default: open\n";

                                        break;

                                    default:

                                        //The default value is open by the definition in the PDF Reference.

                                        //You can add your own preferred notes here.

                                        // ActionsL = ActionsL + "undefined - default: open\n";

                                        break;

                                }

                            }

                            else

                            {

                                ActionsL = ActionsL + "    but the GetActionLaunchDestinatio() method has failed with the status: " + status.ToString() + "\n";

                            }

                        }

                        else

                        {

                           ActionsL = ActionsL + "Form Field Nr." + (x + 1).ToString() + " has associated another type of action.\n";

                        }

                    }

                }

            }

        }

        MessageBox.Show(ActionsL, caption);

    }

}

else

{

    MessageBox.Show("The file can't be loaded.", caption);

}

gdpicturePDF.Dispose();
See Also