Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (gdpicturePDF.LoadFromFile("annots.pdf", False) = GdPictureStatus.OK) AndAlso
(annotationManager.InitFromGdPicturePDF(gdpicturePDF) = GdPictureStatus.OK) Then
For p As Integer = 1 To gdpicturePDF.GetPageCount()
If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
Dim annot As GdPicture14.Annotations.Annotation = Nothing
Dim annotCount As Integer = annotationManager.GetAnnotationCount()
For i As Integer = 0 To annotCount - 1
annot = annotationManager.GetAnnotationFromIdx(i)
If (annotationManager.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Tag = "changed by GdPicture"
Else
Exit For
End If
Next
If annotationManager.GetStat() = GdPictureStatus.OK Then
If annotationManager.SaveAnnotationsToPage() <> GdPictureStatus.OK Then Exit For
End If
Else
Exit For
End If
Next
If (annotationManager.GetStat() = GdPictureStatus.OK) AndAlso
(annotationManager.SaveDocumentToPDF("annots_changed.pdf") = GdPictureStatus.OK) Then MessageBox.Show("Finished successfully!", "AnnotationManager.InitFromGdPicturePDF")
If annotationManager.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("The example has failed. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromGdPicturePDF")
annotationManager.Close()
Else
MessageBox.Show("Objects can't be initialized properly.", "AnnotationManager.InitFromGdPicturePDF")
End If
annotationManager.Dispose()
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
AnnotationManager annotationManager = new AnnotationManager();
if ((gdpicturePDF.LoadFromFile("annots.pdf", false) == GdPictureStatus.OK) &&
(annotationManager.InitFromGdPicturePDF(gdpicturePDF) == GdPictureStatus.OK))
{
for (int p = 1; p <= gdpicturePDF.GetPageCount(); p++)
{
if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
{
GdPicture14.Annotations.Annotation annot = null;
int annotCount = annotationManager.GetAnnotationCount();
for (int i = 0; i < annotCount; i++)
{
annot = annotationManager.GetAnnotationFromIdx(i);
if ((annotationManager.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Tag = "changed by GdPicture";
}
else break;
}
if (annotationManager.GetStat() == GdPictureStatus.OK)
if (annotationManager.SaveAnnotationsToPage() != GdPictureStatus.OK) break;
}
else break;
}
if ((annotationManager.GetStat() == GdPictureStatus.OK) &&
(annotationManager.SaveDocumentToPDF("annots_changed.pdf") == GdPictureStatus.OK))
MessageBox.Show("Finished successfully!", "AnnotationManager.GetAnnotationFromIdx");
if (annotationManager.GetStat() != GdPictureStatus.OK)
MessageBox.Show("The example has failed. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFromIdx");
annotationManager.Close();
}
else
MessageBox.Show("Objects can't be initialized properly.", "AnnotationManager.GetAnnotationFromIdx");
annotationManager.Dispose();
gdpicturePDF.Dispose();