Package com.compdfkit.core.annotation
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
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic interfaceA set of flags specifying various characteristics of the annotation.static enumstatic enumAnnotation types -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds annotation into PDF pagevoidclose()When the object is no longer in use, call this method to release resources.Gets annotation content.Gets the creation date of annotation.intgetFlags()Gets annotation flags.getMainAnnotNM(CPDFPage page) getName()Not in use currentlyGets the modification date of annotation.getRect()Gets annotation rectangle.getState()getTitle()Not in use currentlygetType()Gets annotation type, more:CPDFAnnotation.TypebooleanhasAp()Whether annotation has appearance.booleanWhether to allow to correct annotation appearancebooleanisExitMainAnnot(CPDFPage page) booleanisHidden()This is a convenience property that checks for `CPDFAnnotationFlagHidden` in `flags`.booleanisLocked()This is a convenience property that checks for `CPDFAnnotationFlagLocked` in `flags`.booleanbooleanbooleanbooleanisValid()Whether annotation object is valid.booleanRemoves annotation from PDF pagebooleanvoidsetAllowCorrectAnnotationAp(boolean allowCorrectAnnotationAp) Sets whether to allow to correct annotation appearancebooleansetContent(String content) Sets annotation content.booleansetCreationDate(CPDFDate date) Sets the creation date of annotation.booleansetFlags(int flag) Sets annotation flag.booleansetHidden(boolean isHidden) This is a convenience property that checks for `CPDFAnnotationFlagHidden` in `flags`.booleansetLocked(boolean isLocked) This is a convenience property that checks for `CPDFAnnotationFlagLocked` in `flags`.booleansetMarkedAnnotState(CPDFAnnotation.PSOAnnotationState state, String titleStr) booleanNot in use currentlybooleanSets the modification date of annotation.booleanSets annotation rectangle.booleansetReviewAnnotState(CPDFAnnotation.PSOAnnotationState state, String titleStr) booleanbooleanNot in use currently
-
Method Details
-
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
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
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
Sets annotation content.- Parameters:
content- Annotation content.- Returns:
- Returns whether to successfully set annotation content.
-
getContent
Gets annotation content.- Returns:
- Returns annotation content.
-
setCreationDate
Sets the creation date of annotation.- Parameters:
date- Creation date of annotation.- Returns:
- Returns whether to successfully set creation date of annotation.
-
getCreationDate
Gets the creation date of annotation.- Returns:
- Returns the creation date of annotation.
-
setRecentlyModifyDate
Sets the modification date of annotation.- Parameters:
date- Modification date of annotation.- Returns:
- Returns whether to successfully set the modification date of annotation.
-
getRecentlyModifyDate
Gets the modification date of annotation.- Returns:
- Returns the modification date of annotation.
-
setTitle
Not in use currently -
getTitle
Not in use currently -
setName
Not in use currently -
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
-
createReplyStateAnnotation
-
getReplies
-
getState
-
setState
-
isReplyAnnot
public boolean isReplyAnnot() -
isReviewStateAnnot
public boolean isReviewStateAnnot() -
isMarkedStateAnnot
public boolean isMarkedStateAnnot() -
removeFromPageIncludeReplyAnnot
public boolean removeFromPageIncludeReplyAnnot() -
setMarkedAnnotState
-
setReviewAnnotState
-
getMainAnnotNM
-
isExitMainAnnot
-