Dim caption As String = "Example: GetActionJavaScript"
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 ActionsJS 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.ActionTypeJavaScript Then
Dim script As String = gdpicturePDF.GetActionJavaScript(ActionId)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
ActionsJS = ActionsJS + "Form Field Nr." + (x + 1).ToString() + " has associated JavaScript action with this script:" + vbCrLf + script + vbCrLf
Else
ActionsJS = ActionsJS + "Form Field Nr." + (x + 1).ToString() + " has associated JavaScript action, but the GetActionJavaScript() method has failed with the status: " + status.ToString() + vbCrLf
End If
End If
End If
End If
End If
Next
MessageBox.Show(ActionsJS, caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetActionJavaScript";
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 ActionsJS = "";
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.ActionTypeJavaScript)
{
string script = gdpicturePDF.GetActionJavaScript(ActionId);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
ActionsJS = ActionsJS + "Form Field Nr." + (x + 1).ToString() + " has associated JavaScript action with this script:\n" + script + "\n";
}
else
{
ActionsJS = ActionsJS + "Form Field Nr." + (x + 1).ToString() + " has associated JavaScript action, but the GetActionJavaScript() method has failed with the status: " + status.ToString() + "\n";
}
}
}
}
}
}
MessageBox.Show(ActionsJS, caption);
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();