Dim caption As String = "Example: SetViewerOpenAction"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("testPDF.pdf", False)
If status = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
Dim actionID As Integer = gdpicturePDF.NewActionGoTo(PdfDestinationType.DestinationTypeXYZ, 10, 1, 0, 0, 5, 3)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SetViewerOpenAction(actionID)
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("open_action.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The PDF document with the specified OpenAction has been saved successfully.", caption)
Else
MessageBox.Show("The file can't be saved.", caption)
End If
Else
MessageBox.Show("The SetViewerOpenAction() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The NewActionGoTo() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: SetViewerOpenAction";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("testPDF.pdf", false);
if (status == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
int actionID = gdpicturePDF.NewActionGoTo(PdfDestinationType.DestinationTypeXYZ, 10, 1, 0, 0, 5, 3);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SetViewerOpenAction(actionID);
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("open_action.pdf") == GdPictureStatus.OK)
{
MessageBox.Show("The PDF document with the specified OpenAction has been saved successfully.", caption);
}
else
{
MessageBox.Show("The file can't be saved.", caption);
}
}
else
{
MessageBox.Show("The SetViewerOpenAction() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The NewActionGoTo() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();