com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class StampAnnotation

  • All Implemented Interfaces:
    com.aspose.ms.System.ICloneable, com.aspose.pdf.engine.ITitledAnnotation


    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);
      
    • Constructor Detail

      • StampAnnotation

        public StampAnnotation(IDocument document)

        Constructor

        Parameters:
        document - Document where annotation will be created.
      • StampAnnotation

        public StampAnnotation(Page page,
                       Rectangle rect)

        Creates new Stamp annotation on the specified page.

        Parameters:
        page - The document's page where annotation should be created.
        rect - The annotation rectangle, defining the location of the annotation on the page.
    • Method Detail

      • getIcon

        public int getIcon()

        Gets icon for rubber stamp.

        Returns:
        StampIcon value
      • setIcon

        public void setIcon(int value)

        Sets icon for rubber stamp.

        Parameters:
        value - StampIcon value
      • getAnnotationType

        public int getAnnotationType()

        Gets type of annotation.

        Specified by:
        getAnnotationType in class Annotation
        Returns:
        AnnotationType element
        See Also:
        AnnotationType
      • accept

        public void accept(AnnotationSelector visitor)

        Acepts AnnotationSelector visitor when browsing annotation collection.

        Specified by:
        accept in class Annotation
        Parameters:
        visitor - Visitor object.
      • getImage

        public InputStream getImage()

        Gets image of the annotation.

        Returns:
        InputStream object
      • setImage

        public void setImage(InputStream value)

        Sets image of the annotation.

        Parameters:
        value - InputStream object