Dim gdpicturePDF As New GdPicturePDF()
Dim failedMethod As String = "NewPDF()"
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
failedMethod = "NewPage() or SelectPage()"
If (gdpicturePDF.NewPage(21, 29.7F) = GdPictureStatus.OK) AndAlso (gdpicturePDF.SelectPage(1) = GdPictureStatus.OK) Then
failedMethod = "AddStandardFont()"
Dim fontResName As String = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontCourier)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
failedMethod = "AddPushButtonFormField()"
Dim fieldID As Integer = gdpicturePDF.AddPushButtonFormField(1, 1, 5, 1, "Submit", "Open http://www.gdpicture.com", fontResName, 6, 255, 0, 0)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
failedMethod = "NewActionURI()"
Dim actionID As Integer = gdpicturePDF.NewActionURI("http://www.gdpicture.com", False)
If (gdpicturePDF.GetStat() = GdPictureStatus.OK) Then
failedMethod = "SetFormFieldAction() or SaveToFile()"
If (gdpicturePDF.SetFormFieldAction(fieldID, actionID) = GdPictureStatus.OK) AndAlso (gdpicturePDF.SaveToFile("button_action.pdf") = GdPictureStatus.OK) Then
failedMethod = ""
MessageBox.Show("The PDF document containing the button associated with the URI action has been saved successfully.", "Example: NewActionURI")
End If
End If
End If
End If
End If
End If
If failedMethod <> "" Then
MessageBox.Show("The " + failedMethod + " method has failed. The presumed status: " + gdpicturePDF.GetStat().ToString(), "Example: NewActionURI")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
string failedMethod = "NewPDF()";
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
failedMethod = "NewPage() or SelectPage()";
if ((gdpicturePDF.NewPage(21, 29.7f) == GdPictureStatus.OK) &&
(gdpicturePDF.SelectPage(1) == GdPictureStatus.OK))
{
failedMethod = "AddStandardFont()";
string fontResName = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontCourier);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
failedMethod = "AddPushButtonFormField()";
int fieldID = gdpicturePDF.AddPushButtonFormField(1, 1, 5, 1, "Submit", "Open http://www.gdpicture.com", fontResName, 6, 255, 0, 0);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
failedMethod = "NewActionURI()";
int actionID = gdpicturePDF.NewActionURI("http://www.gdpicture.com", false);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
failedMethod = "SetFormFieldAction() or SaveToFile()";
if ((gdpicturePDF.SetFormFieldAction(fieldID, actionID) == GdPictureStatus.OK) &&
(gdpicturePDF.SaveToFile("button_action.pdf") == GdPictureStatus.OK))
{
failedMethod = "";
MessageBox.Show("The PDF document containing the button associated with the URI action has been saved successfully.", "Example: NewActionURI");
}
}
}
}
}
}
if (failedMethod != "")
MessageBox.Show("The " + failedMethod + " method has failed. The presumed status: " + gdpicturePDF.GetStat().ToString(), "Example: NewActionURI");
gdpicturePDF.Dispose();