Dim caption As String = "Example: GetAnnotationName"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim annotname As String = Nothing
Dim annotCount As Integer = 0
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
For i As Integer = 1 To pageCount
If gdpicturePDF.SelectPage(i) <> GdPictureStatus.OK Then Exit For
annotCount = gdpicturePDF.GetAnnotationCount()
If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then Exit For
If annotCount = 0 Then Continue For
For j As Integer = 0 To annotCount - 1
annotname = gdpicturePDF.GetAnnotationName(j)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If annotname.Equals("required_annotation_name") Then status = gdpicturePDF.SetAnnotationOpacity(j, 0)
If status <> GdPictureStatus.OK Then Exit For
ElseIf gdpicturePDF.GetStat() <> GdPictureStatus.PropertyNotFound Then
'The annotation name attribut is optional.
Exit For
End If
Next
If (gdpicturePDF.GetStat() <> GdPictureStatus.OK) AndAlso (gdpicturePDF.GetStat() <> GdPictureStatus.PropertyNotFound) Then Exit For
Next
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_annotnames.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
Else
MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The example has failed. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetAnnotationName";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
string annotname = null;
int annotCount = 0;
int pageCount = gdpicturePDF.GetPageCount();
for (int i = 1; i <= pageCount; i++)
{
if (gdpicturePDF.SelectPage(i) != GdPictureStatus.OK) break;
annotCount = gdpicturePDF.GetAnnotationCount();
if (gdpicturePDF.GetStat() != GdPictureStatus.OK) break;
if (annotCount == 0) continue;
for (int j = 0; j < annotCount; j++)
{
annotname = gdpicturePDF.GetAnnotationName(j);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (annotname.Equals("required_annotation_name"))
status = gdpicturePDF.SetAnnotationOpacity(j, 0);
if (status != GdPictureStatus.OK) break;
}
else
//The annotation name attribut is optional.
if (gdpicturePDF.GetStat() != GdPictureStatus.PropertyNotFound) break;
}
if ((gdpicturePDF.GetStat() != GdPictureStatus.OK) &&
(gdpicturePDF.GetStat() != GdPictureStatus.PropertyNotFound))
break;
}
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_annotnames.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
else
MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
}
else
MessageBox.Show("The example has failed. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
gdpicturePDF.Dispose();