Dim status As GdPictureStatus = GdPictureStatus.OK
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
Dim annotXML As String = ""
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
If annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK Then
Dim annotIdx As Integer = annotationManager.GetAnnotationIdx(stamp)
If annotationManager.GetStat() = GdPictureStatus.OK Then
annotXML = annotationManager.GetAnnotationXML(annotIdx)
If annotationManager.GetStat() = GdPictureStatus.OK Then
status = annotationManager.SaveDocumentToPDF("source_stamped.pdf")
End If
Else
status = annotationManager.GetStat()
End If
Else
status = annotationManager.GetStat()
End If
stamp.Dispose()
End If
annotationManager.Close()
If status = GdPictureStatus.OK Then
If (annotationManager.InitFromFile("dest.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
Dim annot As GdPicture14.Annotations.Annotation = annotationManager.AddAnnotationFromXML(annotXML)
If annot IsNot Nothing Then status = annotationManager.SaveAnnotationsToPage()
If status = GdPictureStatus.OK Then
status = annotationManager.SaveDocumentToPDF("dest_stamped.pdf")
End If
Else
status = annotationManager.GetStat()
End If
End If
annotationManager.Close()
Else
status = annotationManager.GetStat()
End If
If status = GdPictureStatus.OK Then
MessageBox.Show("Done!", "AnnotationManager.GetAnnotationIdx")
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationIdx")
End If
annotationManager.Dispose()
GdPictureStatus status = GdPictureStatus.OK;
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK) &&
(annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
{
string annotXML = "";
GdPicture14.Annotations.AnnotationRubberStamp stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5f, 0.5f, 2, 1, "APPROVED");
if (stamp != null)
{
stamp.Rotation = 20;
if (annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK)
{
int annotIdx = annotationManager.GetAnnotationIdx(stamp);
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
annotXML = annotationManager.GetAnnotationXML(annotIdx);
if (annotationManager.GetStat() == GdPictureStatus.OK)
status = annotationManager.SaveDocumentToPDF("source_stamped.pdf");
}
else status = annotationManager.GetStat();
}
else status = annotationManager.GetStat();
stamp.Dispose();
}
annotationManager.Close();
if (status == GdPictureStatus.OK)
{
if ((annotationManager.InitFromFile("dest.pdf") == GdPictureStatus.OK) &&
(annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
{
GdPicture14.Annotations.Annotation annot = annotationManager.AddAnnotationFromXML(annotXML);
if (annot != null)
status = annotationManager.SaveAnnotationsToPage();
if (status == GdPictureStatus.OK)
status = annotationManager.SaveDocumentToPDF("dest_stamped.pdf");
}
else status = annotationManager.GetStat();
}
annotationManager.Close();
}
else status = annotationManager.GetStat();
if (status == GdPictureStatus.OK)
MessageBox.Show("Done!", "AnnotationManager.GetAnnotationIdx");
else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationIdx");
annotationManager.Dispose();