AddRubberStampAnnot Method (AnnotationManager)
In This Topic
Adds a new GdPicture/XMP rubber stamp annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. This annotation shows a stamp mark of the specified stamp within the defined rectangle area.
The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeRubberStamp. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationRubberStamp class right after the successful creation of the annotation object.
Be aware that annotations are always treated relative to the currently selected page.
Adds a new GdPicture/XMP rubber stamp annotation on the selected page of the document currently handled by this AnnotationManager object.
Syntax
'Declaration
Public Function AddRubberStampAnnot( _
ByVal As Color, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As String _
) As AnnotationRubberStamp
public AnnotationRubberStamp AddRubberStampAnnot(
Color ,
float ,
float ,
float ,
float ,
string
)
public function AddRubberStampAnnot(
: Color;
: Single;
: Single;
: Single;
: Single;
: String
): AnnotationRubberStamp;
public function AddRubberStampAnnot(
: Color,
: float,
: float,
: float,
: float,
: String
) : AnnotationRubberStamp;
public: AnnotationRubberStamp* AddRubberStampAnnot(
Color ,
float ,
float ,
float ,
float ,
string*
)
public:
AnnotationRubberStamp^ AddRubberStampAnnot(
Color ,
float ,
float ,
float ,
float ,
String^
)
Parameters
- BorderColor
- A color object that defines the required border color of the newly added rubber stamp annotation.
- Left
- The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
- Top
- The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
- Width
- The width of the annotation bounding box, in inches.
- Height
- The height of the annotation bounding box, in inches.
- Text
- The content of the newly added rubber stamp, that means the text to be displayed in the annotation bounding box.
Return Value
A GdPicture/XMP AnnotationRubberStamp object. The newly added GdPicture/XMP rubber stamp annotation.
Example
How to permanently add a rubber stamp annotation to the currently selected page of the handled document.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("image.jpg") = 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
If (annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK) AndAlso
(annotationManager.BurnAnnotationsToPage(True) = GdPictureStatus.OK) Then
If annotationManager.SaveDocumentToJPEG("image_approved.jpg", 75) = GdPictureStatus.OK Then
MessageBox.Show("Finished successfully!", "AnnotationManager.AddRubberStampAnnot")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
Else
MessageBox.Show("Annotations can't be saved or burned. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
stamp.Dispose()
Else
MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("image.jpg") == 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;
if ((annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK) &&
(annotationManager.BurnAnnotationsToPage(true) == GdPictureStatus.OK))
{
if (annotationManager.SaveDocumentToJPEG("image_approved.jpg", 75) == GdPictureStatus.OK)
MessageBox.Show("Finished successfully!", "AnnotationManager.AddRubberStampAnnot");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
}
else
MessageBox.Show("Annotations can't be saved or burned. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
stamp.Dispose();
}
else
MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
annotationManager.Dispose();
Example
How to permanently add a rubber stamp annotation to the currently selected page of the handled document.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("image.jpg") = 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
If (annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK) AndAlso
(annotationManager.BurnAnnotationsToPage(True) = GdPictureStatus.OK) Then
If annotationManager.SaveDocumentToJPEG("image_approved.jpg", 75) = GdPictureStatus.OK Then
MessageBox.Show("Finished successfully!", "AnnotationManager.AddRubberStampAnnot")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
Else
MessageBox.Show("Annotations can't be saved or burned. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
stamp.Dispose()
Else
MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("image.jpg") == 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;
if ((annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK) &&
(annotationManager.BurnAnnotationsToPage(true) == GdPictureStatus.OK))
{
if (annotationManager.SaveDocumentToJPEG("image_approved.jpg", 75) == GdPictureStatus.OK)
MessageBox.Show("Finished successfully!", "AnnotationManager.AddRubberStampAnnot");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
}
else
MessageBox.Show("Annotations can't be saved or burned. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
stamp.Dispose();
}
else
MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddRubberStampAnnot");
annotationManager.Dispose();
See Also