Package com.snowtide.pdf.annot
Interface Annotation
-
- All Superinterfaces:
Bounded
,DocumentLocation
- All Known Implementing Classes:
FileAttachmentAnnotation
,FreeTextAnnotation
,LinkAnnotation
,TextAnnotation
public interface Annotation extends DocumentLocation
All PDF annotations define a range of base attributes, which are accessible using the functions this interface specifies. It should be noted that none of the attributes that are potentially available through the functions defined in this interface are required to be present for any particular annotation type.
Different types of annotations also carry specialized attributes; PDFxStream currently supports richer access to these annotation types:
- Text - simple notes attached to parts of a PDF document, implemented by
TextAnnotation
- FreeText - richly-styled notes that can become seamless parts of a PDF document's content,
implemented by
FreeTextAnnotation
- Link - hyperlink annotations that, when activated, indicate that the user's view should
jump to another location in the PDF document, or that the user should be directed to an external URI.
Implemented by
LinkAnnotation
. - Attachment - contains a reference to a file, the contents of which are usually embedded
within the PDF document. Implemented by
FileAttachmentAnnotation
Annotation types not listed above (which are primarily graphical in nature) are represented by PDFxStream using a basic
Annotation
implementation that allows access to those annotations' textual attributes.- Since:
- v1.3.5
- Version:
- ©2004-2024 Snowtide
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Page
getAppearance()
Returns aPage
containing this annotation's rendered "appearance stream", if it explicitly defines one, null otherwise.String
getContents()
Returns the text content of this annotation.String
getModificationDate()
Returns the date, in PDF date format, when this annotation was last modified.String
getName()
Returns the optional name for this annotation, which should uniquely identify it within a page.String
getTypeCd()
Returns a String indicating what type of annotation this this.-
Methods inherited from interface com.snowtide.pdf.DocumentLocation
pageNumber
-
-
-
-
Method Detail
-
getContents
String getContents()
Returns the text content of this annotation. Some annotation types do not encode any text content; in such cases, those annotation type implementations will either return null from this function, or return an alternative descriptive text string that may be used to indicate the value or nature of this annotation.
-
getName
String getName()
Returns the optional name for this annotation, which should uniquely identify it within a page.
-
getModificationDate
String getModificationDate()
Returns the date, in PDF date format, when this annotation was last modified. This date string may be parsed using thePDFDateParser
class. This function may return null if no modification date is present in the annotation data.
-
getTypeCd
String getTypeCd()
Returns a String indicating what type of annotation this this. These types are defined in Section 8.4.5 of the PDF Format Reference, and are returned with a leading forward slash.
-
getAppearance
Page getAppearance() throws IOException
Returns aPage
containing this annotation's rendered "appearance stream", if it explicitly defines one, null otherwise. (If an annotation does not define its own appearance explicitly, it is assumed that a PDF reader / consumer will provide a default rendering based on the annotation'stype
and associated data.) The contents of the page can be accessed and manipulated just like any "regular" page obtained from e.g.Document.getPage(int)
.- Throws:
IOException
- Since:
- 3.2.0
-
-