Using annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("test.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
Dim stamp As GdPicture14.Annotations.AnnotationRubberStamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5F, 0.5F, 2, 1, "APPROVED")
If stamp IsNot Nothing Then
stamp.Rotation = 20
Dim oFileStream As System.IO.FileStream = New System.IO.FileStream("test_approved.pdf", System.IO.FileMode.Create)
If (annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK) AndAlso
(annotationManager.BurnAnnotationsToPage(True) = GdPictureStatus.OK) AndAlso
(annotationManager.SaveDocumentToPDF(oFileStream) = GdPictureStatus.OK) Then
MessageBox.Show("Finished successfully!", "AnnotationManager.SaveDocumentToPDF")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveDocumentToPDF")
End If
oFileStream.Dispose()
stamp.Dispose()
Else
MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveDocumentToPDF")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveDocumentToPDF")
End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
if ((annotationManager.InitFromFile("test.pdf") == GdPictureStatus.OK) &&
(annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
{
GdPicture14.Annotations.AnnotationRubberStamp stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5f, 0.5f, 2, 1, "APPROVED");
if (stamp != null)
{
stamp.Rotation = 20;
System.IO.FileStream oFileStream = new System.IO.FileStream("test_approved.pdf", System.IO.FileMode.Create);
if ((annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK) &&
(annotationManager.BurnAnnotationsToPage(true) == GdPictureStatus.OK) &&
(annotationManager.SaveDocumentToPDF(oFileStream) == GdPictureStatus.OK))
MessageBox.Show("Finished successfully!", "AnnotationManager.SaveDocumentToPDF");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveDocumentToPDF");
oFileStream.Dispose();
stamp.Dispose();
}
else
MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveDocumentToPDF");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveDocumentToPDF");
}