Class AnnotationNote
- java.lang.Object
-
- org.faceless.pdf2.PDFAnnotation
-
- org.faceless.pdf2.AnnotationNote
-
- All Implemented Interfaces:
Cloneable
public final class AnnotationNote extends PDFAnnotation
This class represents the type ofPDFAnnotation
created by the "Note Tool" in Acrobat. This is normally represented by an icon on screen until the user clicks on it, at which point a window pops up and displays the contents.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description AnnotationNote()
Create a new Note of the default type - a yellow "Note".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
clone()
float[]
getClosedRectangle()
Return the Rectangle for this AnnotationNote when it's closed - simply callsPDFAnnotation.getRectangle()
float[]
getOpenRectangle()
Return the Rectangle for this AnnotationNote when it's openString
getRichTextContents()
Get the rich-text content of this annotation if specified, ornull
if only plain-text content is availableString
getStatus()
For Note annotations that are reviews of other Annotations, get the status of that review.String
getType()
Returns the type of Note.boolean
isOpen()
Return whether this Note is open by defaultvoid
putLiteral(String key, String tokens)
Put a literal token sequnce.void
rebuild()
Rebuild the annotation's appearance.void
setOpen(boolean open)
Set whether this Note is saved in it's opened or closed state.void
setOpenRectangle(float x1, float y1, float x2, float y2)
Set the Rectangle for this note in its open state.void
setRectangle(float x1, float y1, float x2, float y2)
Set the rectangle for the annotation - where it is on the page.void
setRichTextContents(String content)
Set the Rich-text contents of the annotation.void
setStatus(String status)
For Note Annotations that are reviews of other annotations, set the status of the review.void
setType(String type, Color color)
Set the type of the note, which affects the type of icon thats used to display it.String
toString()
-
Methods inherited from class org.faceless.pdf2.PDFAnnotation
addPropertyChangeListener, addReview, flatten, getAction, getAssociatedFiles, getAuthor, getColor, getContents, getCreationDate, getDefaultColorSpace, getInReplyTo, getLocale, getMetaData, getModifyDate, getOpacity, getOptionalContentDescriptor, getPage, getPopup, getRectangle, getReplies, getReviews, getSubject, getUniqueID, getUserData, getXMP, hasAppearanceState, isContentLocked, isPositionLocked, isPrintable, isReadOnly, isVisible, putUserData, removePropertyChangeListener, setAction, setAuthor, setColor, setContents, setCreationDate, setDefaultColorSpace, setInReplyTo, setLocale, setLocked, setMetaData, setModifyDate, setOpacity, setOptionalContentDescriptor, setPage, setPrintable, setReadOnly, setSubject, setUniqueID, setVisible
-
-
-
-
Method Detail
-
setType
public void setType(String type, Color color)
Set the type of the note, which affects the type of icon thats used to display it. In Acrobat 4 and 5, the types that were available are:- "Note" a post-it note, the default)
- "Comment" (a speech bubble)
- "Help" (a question mark)
- "Insert" (an upwards-pointing triangle)
- "Key" (a key)
- "NewParagraph" (a upwards pointing triangle with "NP" below it)
- "Paragraph" (a paragraph symbol)
- "Check" (a checkmark)
- "Cross" (a cross)
- "RightArrow" (a right-pointing arrow)
- "RightPointer" (a right-pointing triangle)
- "Star" (a five-pointed star)
- "UpArrow" (an upwards-pointing arrow)
- "UpLeftArrow" (an arrow pointing up and left)
Finally in Acrobat 7 the "Circle" type was added. All of these types will work in Acrobat 4.x and later, although attempting to edit the annotation type of an Acrobat 6.x annotation in an earlier release will probably result in the icon reverting to the original "Note" icon.
-
getType
public String getType()
Returns the type of Note. May be one of the values passed in to the constructor, but not guaranteed to be.- Overrides:
getType
in classPDFAnnotation
-
setRectangle
public void setRectangle(float x1, float y1, float x2, float y2)
Description copied from class:PDFAnnotation
Set the rectangle for the annotation - where it is on the page. Every annotation must have a rectangle set - if it's not set when the document is written, it's forced to (0,0,0,0).- For
AnnotationLink
andAnnotationStamp
annotations, this is the rectangle containing the hyperlink area or stamp. - For
AnnotationNote
annotations, whether this method adjusts the location of the icon or the popup window depends on whether the annotation is closed or open at the time of the call to this method. When closed, the icon is positioned at x1,y2
Note that all co-ordinates are in absolute page co-ordinates. This means they are measured in points from the bottom-left hand corner of the page, regardless of any calls to
PDFPage.rotate(float, float, double)
orPDFPage.setUnits(float, int)
that have been made. This restriction is part of the PDF specification.- Overrides:
setRectangle
in classPDFAnnotation
- Parameters:
x1
- the X co-ordinate of the bottom-left corner of the rectangley1
- the Y co-ordinate of the bottom-left corner of the rectanglex2
- the X co-ordinate of the top-right corner of the rectangley2
- the Y co-ordinate of the top-right corner of the rectangle
- For
-
setOpenRectangle
public void setOpenRectangle(float x1, float y1, float x2, float y2)
Set the Rectangle for this note in its open state. Note that all co-ordinates are in absolute page co-ordinates. This means they are measured in points from the bottom-left hand corner of the page, regardless of any calls to
PDFPage.rotate(float, float, double)
orPDFPage.setUnits(float, int)
that have been made. This restriction is part of the PDF specification.- Parameters:
x1
- the X co-ordinate of the bottom-left corner of the rectangley1
- the Y co-ordinate of the bottom-left corner of the rectanglex2
- the X co-ordinate of the top-right corner of the rectangley2
- the Y co-ordinate of the top-right corner of the rectangle- Since:
- 2.16
-
getOpenRectangle
public float[] getOpenRectangle()
Return the Rectangle for this AnnotationNote when it's open- Since:
- 2.11.22
-
getClosedRectangle
public float[] getClosedRectangle()
Return the Rectangle for this AnnotationNote when it's closed - simply callsPDFAnnotation.getRectangle()
- Since:
- 2.11.22
-
setOpen
public void setOpen(boolean open)
Set whether this Note is saved in it's opened or closed state. Default is false
-
isOpen
public boolean isOpen()
Return whether this Note is open by default
-
setStatus
public void setStatus(String status)
For Note Annotations that are reviews of other annotations, set the status of the review. See thePDFAnnotation.getReviews()
method for more information on reviews.- Parameters:
status
- the status to set the note to. Must be one of None, Accepted, Rejected, Cancelled, Completed, Marked or Unmarked. If not anIllegalArgumentException
is thrown.- Since:
- 2.4
- See Also:
PDFAnnotation.getReviews()
,getStatus()
-
getStatus
public String getStatus()
For Note annotations that are reviews of other Annotations, get the status of that review. See thePDFAnnotation.getReviews()
method for more information on reviews. For other Note annotations, this will returnnull
- Returns:
- one of the values listed in the
setStatus(java.lang.String)
method documentation, ornull
if this is not a review - Since:
- 2.4
- See Also:
PDFAnnotation.getReviews()
,setStatus(java.lang.String)
-
rebuild
public void rebuild()
Description copied from class:PDFAnnotation
Rebuild the annotation's appearance. This will be done automatically when required, usually just before saving the PDF or rasterizing it to a bitmap. However this method can be called explicitly if necessary, usually to ensure the rebuild (which may fire aPropertyChangeEvent
) is run on a specific thread.- Overrides:
rebuild
in classPDFAnnotation
-
setRichTextContents
public void setRichTextContents(String content)
Set the Rich-text contents of the annotation. See
AnnotationText.setRichTextContents(java.lang.String)
for details of the parameter.- Since:
- 2.24.3
-
getRichTextContents
public String getRichTextContents()
Get the rich-text content of this annotation if specified, ornull
if only plain-text content is available- Since:
- 2.24.3
-
toString
public String toString()
-
putLiteral
public void putLiteral(String key, String tokens)
Put a literal token sequnce. For debugging- Parameters:
key
- the keytokens
- the token sequence, eg "true" or "/foo" or "[/Foo/Bar]". No refs, just direct objects.
-
-