StampAnnotation
Inheritance: java.lang.Object, com.aspose.pdf.BaseParagraph, com.aspose.pdf.Annotation, com.aspose.pdf.MarkupAnnotation
public final class StampAnnotation extends MarkupAnnotation
Represents rubber stamp annotation. This type of annotation displays text or graphics intended to look as if they were stamped on the page with a rubber stamp.
Next code snippet demonstrates how to add 2 stamps into the first pdf document page.
Input document comes from inFile and changes are saved into the outFile.
The first stamp has icon NotForPublicRelease and the second comes with image from rubber.jpg.
Document document = new Document(inFile);
StampAnnotation stamp1 = new StampAnnotation(StampIcon.NotForPublicRelease);
stamp1.setRect ( new Rectangle(100, 100, 120, 120))
document.getPages().get(1).getAnnotations().add(stamp1);
StampAnnotation stamp2 = new StampAnnotation(new FileStream("rubber.jpg", FileMode.Open));
stamp2.setRect ( new Rectangle(200, 200, 220, 220))
document.getPages().get(1).getAnnotations().add(stamp2);
document.save(outFile);
Constructors
Constructor | Description |
---|---|
StampAnnotation(IDocument document) | Constructor |
StampAnnotation(Page page, Rectangle rect) | Creates new Stamp annotation on the specified page. |
Methods
Method | Description |
---|---|
getIcon() | Gets icon for rubber stamp. |
setIcon(int value) | Sets icon for rubber stamp. |
getAnnotationType() | Gets type of annotation. |
accept(AnnotationSelector visitor) | Acepts AnnotationSelector visitor when browsing annotation collection. |
getImage() | Gets image of the annotation. |
setImage(InputStream value) | Sets image of the annotation. |
setBase64SVGImage(String base64Svg) | Sets SVG image of the annotation in Base64 string. |
StampAnnotation(IDocument document)
public StampAnnotation(IDocument document)
Constructor
Parameters:
Parameter | Type | Description |
---|---|---|
document | IDocument | Document where annotation will be created. |
StampAnnotation(Page page, Rectangle rect)
public StampAnnotation(Page page, Rectangle rect)
Creates new Stamp annotation on the specified page.
Parameters:
Parameter | Type | Description |
---|---|---|
page | Page | The document’s page where annotation should be created. |
rect | Rectangle | The annotation rectangle, defining the location of the annotation on the page. |
getIcon()
public int getIcon()
Gets icon for rubber stamp.
Returns: int - StampIcon value
setIcon(int value)
public void setIcon(int value)
Sets icon for rubber stamp.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | StampIcon value |
getAnnotationType()
public AnnotationType getAnnotationType()
Gets type of annotation.
Returns: AnnotationType - AnnotationType element
accept(AnnotationSelector visitor)
public void accept(AnnotationSelector visitor)
Acepts AnnotationSelector visitor when browsing annotation collection.
Parameters:
Parameter | Type | Description |
---|---|---|
visitor | AnnotationSelector | Visitor object. |
getImage()
public InputStream getImage()
Gets image of the annotation.
Returns: java.io.InputStream - InputStream object
setImage(InputStream value)
public void setImage(InputStream value)
Sets image of the annotation.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.io.InputStream | InputStream object |
setBase64SVGImage(String base64Svg)
public void setBase64SVGImage(String base64Svg)
Sets SVG image of the annotation in Base64 string.
Parameters:
Parameter | Type | Description |
---|---|---|
base64Svg | java.lang.String | String of base64 svg image |