Class CPDFAnnotation

java.lang.Object
com.compdfkit.core.annotation.CPDFAnnotation
Direct Known Subclasses:
CPDFCircleAnnotation, CPDFFreetextAnnotation, CPDFInkAnnotation, CPDFLineAnnotation, CPDFLinkAnnotation, CPDFMarkupAnnotation, CPDFMovieAnnotation, CPDFRedactAnnotation, CPDFSoundAnnotation, CPDFSquareAnnotation, CPDFStampAnnotation, CPDFTextAnnotation, CPDFWidget

public abstract class CPDFAnnotation extends Object
An annotation associates an object such as a note, sound, or movie with a location on a page of a PDF document, or provides a way to interact with the user by means of the mouse and keyboard. PDF includes a wide variety of standard annotation types. Class Annot is the base class for all kinds of PDF annotations. It offers the base functions to get/set annotation's common properties, to move an annotation or reset appearance stream of an annotation. For concrete annotation types, please refer to derived classes. To get the count of annotations or get/add/remove an annotation, please refer to class CPDFPage. This class object can also be used to construct objects of other classes in order to do some more operation in annotation or access specified information of annotation.
  • Method Details

    • getType

      public CPDFAnnotation.Type getType()
      Gets annotation type, more:CPDFAnnotation.Type
      Returns:
      Returns annotation type.
    • isValid

      public boolean isValid()
      Whether annotation object is valid.
      Returns:
      Returns whether annotations are valid.
    • setRect

      public boolean setRect(RectF rect)
      Sets annotation rectangle. The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up. The device coordinate system is device dependent. For screen device, its origin is at the left-top corner of the window.
      Parameters:
      rect - Rectangle on the page.
      Returns:
      Returns whether to successfully set annotation rectangle.
    • getRect

      public RectF getRect()
      Gets annotation rectangle. The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up. The device coordinate system is device dependent. For screen device, its origin is at the left-top corner of the window.
      Returns:
      Returns rectangle on the page.
    • setFlags

      public boolean setFlags(int flag)
      Sets annotation flag.
      Parameters:
      flag - Annotation flag.
      Returns:
      Returns whether to successfully set annotation flag.
    • getFlags

      public int getFlags()
      Gets annotation flags.
      Returns:
      Returns annotation flag.
    • setHidden

      public boolean setHidden(boolean isHidden)
      This is a convenience property that checks for `CPDFAnnotationFlagHidden` in `flags`.
      Parameters:
      isHidden - True is hide,false otherwise
      Returns:
      Returns whether the setting is successful
    • isHidden

      public boolean isHidden()
      This is a convenience property that checks for `CPDFAnnotationFlagHidden` in `flags`.
      Returns:
      Returns the result of 'CPDFAnnotationFlagHidden'
    • setLocked

      public boolean setLocked(boolean isLocked)
      This is a convenience property that checks for `CPDFAnnotationFlagLocked` in `flags`.
      Parameters:
      isLocked - True is locked,false is unlocked
      Returns:
      Returns whether the setting is successful
    • isLocked

      public boolean isLocked()
      This is a convenience property that checks for `CPDFAnnotationFlagLocked` in `flags`.
      Returns:
      Returns the result of 'CPDFAnnotationFlagLocked'
    • setContent

      public boolean setContent(String content)
      Sets annotation content.
      Parameters:
      content - Annotation content.
      Returns:
      Returns whether to successfully set annotation content.
    • getContent

      public String getContent()
      Gets annotation content.
      Returns:
      Returns annotation content.
    • setCreationDate

      public boolean setCreationDate(CPDFDate date)
      Sets the creation date of annotation.
      Parameters:
      date - Creation date of annotation.
      Returns:
      Returns whether to successfully set creation date of annotation.
    • getCreationDate

      public CPDFDate getCreationDate()
      Gets the creation date of annotation.
      Returns:
      Returns the creation date of annotation.
    • setRecentlyModifyDate

      public boolean setRecentlyModifyDate(CPDFDate date)
      Sets the modification date of annotation.
      Parameters:
      date - Modification date of annotation.
      Returns:
      Returns whether to successfully set the modification date of annotation.
    • getRecentlyModifyDate

      public CPDFDate getRecentlyModifyDate()
      Gets the modification date of annotation.
      Returns:
      Returns the modification date of annotation.
    • setTitle

      public boolean setTitle(String title)
      Not in use currently
    • getTitle

      public String getTitle()
      Not in use currently
    • setName

      public boolean setName(String name)
      Not in use currently
    • getName

      public String getName()
      Not in use currently
    • removeFromPage

      public boolean removeFromPage()
      Removes annotation from PDF page
      Returns:
      Returns whether to successfully remove annotation.
    • addToPage

      public boolean addToPage()
      Adds annotation into PDF page
      Returns:
      Returns whether to successfully add annotation.
    • hasAp

      public boolean hasAp()
      Whether annotation has appearance.
      Returns:
      Returns whether annotation has appearance.
    • isAllowCorrectAnnotationAp

      public boolean isAllowCorrectAnnotationAp()
      Whether to allow to correct annotation appearance
      Returns:
      Returns whether to allow to correct annotation appearance
    • setAllowCorrectAnnotationAp

      public void setAllowCorrectAnnotationAp(boolean allowCorrectAnnotationAp)
      Sets whether to allow to correct annotation appearance
      Parameters:
      allowCorrectAnnotationAp - Whether to allow to correct annotation appearance
    • close

      public void close()
      When the object is no longer in use, call this method to release resources.
    • createReplyAnnotation

      public CPDFAnnotation createReplyAnnotation()
    • createReplyStateAnnotation

      public CPDFAnnotation createReplyStateAnnotation(CPDFAnnotation.PSOAnnotationState state)
    • getReplies

      public List<CPDFAnnotation> getReplies()
    • getState

    • setState

      public boolean setState(CPDFAnnotation.PSOAnnotationState state)
    • isReplyAnnot

      public boolean isReplyAnnot()
    • isReviewStateAnnot

      public boolean isReviewStateAnnot()
    • isMarkedStateAnnot

      public boolean isMarkedStateAnnot()
    • removeFromPageIncludeReplyAnnot

      public boolean removeFromPageIncludeReplyAnnot()
    • setMarkedAnnotState

      public boolean setMarkedAnnotState(CPDFAnnotation.PSOAnnotationState state, String titleStr)
    • setReviewAnnotState

      public boolean setReviewAnnotState(CPDFAnnotation.PSOAnnotationState state, String titleStr)
    • getMainAnnotNM

      public String getMainAnnotNM(CPDFPage page)
    • isExitMainAnnot

      public boolean isExitMainAnnot(CPDFPage page)