Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / GetActionURI Method
A unique action identifier specifying a required action object. You can obtain this identifier using these methods: GetViewerOpenActionID, GetBookmarkActionID, GetFormFieldActionID, GetAnnotationActionID or NewActionURI.

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

Example





In This Topic
    GetActionURI Method (GdPicturePDF)
    In This Topic
    Returns the target (destination) of the specified URI action. A URI action causes a URI to be resolved. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet - typically a file that is the destination of a hypertext link. URIs are described in RFC 2396 - Uniform Resource Identifier (URI).
    Syntax
    'Declaration
     
    
    Public Function GetActionURI( _
       ByVal ActionID As Integer _
    ) As String
    public string GetActionURI( 
       int ActionID
    )
    public function GetActionURI( 
        ActionID: Integer
    ): String; 
    public function GetActionURI( 
       ActionID : int
    ) : String;
    public: string* GetActionURI( 
       int ActionID
    ) 
    public:
    String^ GetActionURI( 
       int ActionID
    ) 

    Parameters

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

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

    Return Value

    A uniform resource identifier as a string. Please always use the GetStat method to determine if this method has been successful.
    Remarks
    Please note that this method is only allowed for use with non-encrypted documents.

    It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any. For example, if the action object specified by the action identifier is not of the type PdfActionType.ActionTypeURI, the reason for the method's failure is GdPictureStatus.InvalidParameter.

    Example
    How to find out the target URI of a URI action associated with the form field in the PDF document.
    Dim caption As String = "Example: GetActionURI"
    Dim oGdPicturePDF As New GdPicturePDF()
    If oGdPicturePDF.LoadFromFile("forms_actions.pdf", False) = GdPictureStatus.OK Then
        Dim FormsCount As Integer = oGdPicturePDF.GetFormFieldsCount()
        Dim status As GdPictureStatus = oGdPicturePDF.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 ActionsURI As String = ""
            For x As Integer = 0 To FormsCount - 1
                Dim FFId As Integer = oGdPicturePDF.GetFormFieldId(x)
                If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
                    Dim ActionId As Integer = oGdPicturePDF.GetFormFieldActionID(FFId)
                    If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
                        Dim ActionType As PdfActionType = oGdPicturePDF.GetActionType(ActionId)
                        If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
                            If ActionType = PdfActionType.ActionTypeURI Then
                                Dim URI As String = oGdPicturePDF.GetActionURI(ActionId)
                                status = oGdPicturePDF.GetStat()
                                If status = GdPictureStatus.OK Then
                                    ActionsURI = ActionsURI + "Form Field Nr." + (x + 1).ToString() + " has associated URI action with URI = " + URI + vbCrLf
                                Else
                                    ActionsURI = ActionsURI + "Form Field Nr." + (x + 1).ToString() + " has associated URI action, but the GetActionURI() method has failed with the status: " + status.ToString() + vbCrLf
                                End If
                            End If
                        End If
                    End If
                End If
            Next
            MessageBox.Show(ActionsURI, caption)
        End If
    Else
        MessageBox.Show("The file can't be loaded.", caption)
    End If
    oGdPicturePDF.Dispose()
    string caption = "Example: GetActionURI";
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    if (oGdPicturePDF.LoadFromFile("forms_actions.pdf", false) == GdPictureStatus.OK)
    {
        int FormsCount = oGdPicturePDF.GetFormFieldsCount();
        GdPictureStatus status = oGdPicturePDF.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 ActionsURI = "";
            for (int x = 0; x <= FormsCount - 1; x++)
            {
                int FFId = oGdPicturePDF.GetFormFieldId(x);
                if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
                {
                    int ActionId = oGdPicturePDF.GetFormFieldActionID(FFId);
                    if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
                    {
                        PdfActionType ActionType = oGdPicturePDF.GetActionType(ActionId);
                        if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
                        {
                            if (ActionType == PdfActionType.ActionTypeURI)
                            {
                                string URI = oGdPicturePDF.GetActionURI(ActionId);
                                status = oGdPicturePDF.GetStat();
                                if (status == GdPictureStatus.OK)
                                {
                                    ActionsURI = ActionsURI + "Form Field Nr." + (x + 1).ToString() + " has associated URI action with URI = " + URI + "\n";
                                }
                                else
                                {
                                    ActionsURI = ActionsURI + "Form Field Nr." + (x + 1).ToString() + " has associated URI action, but the GetActionURI() method has failed with the status: " + status.ToString() + "\n";
                                }
                            }
                        }
                    }
                }
            }
            MessageBox.Show(ActionsURI, caption);
        }
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", caption);
    }
    oGdPicturePDF.Dispose();
    See Also