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

ConstructorDescription
StampAnnotation(IDocument document)Constructor
StampAnnotation(Page page, Rectangle rect)Creates new Stamp annotation on the specified page.

Methods

MethodDescription
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:

ParameterTypeDescription
documentIDocumentDocument 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:

ParameterTypeDescription
pagePageThe document’s page where annotation should be created.
rectRectangleThe 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:

ParameterTypeDescription
valueintStampIcon 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:

ParameterTypeDescription
visitorAnnotationSelectorVisitor 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:

ParameterTypeDescription
valuejava.io.InputStreamInputStream object

setBase64SVGImage(String base64Svg)

public void setBase64SVGImage(String base64Svg)

Sets SVG image of the annotation in Base64 string.

Parameters:

ParameterTypeDescription
base64Svgjava.lang.StringString of base64 svg image