Package com.snowtide.pdf.annot
Class FileAttachmentAnnotation
- java.lang.Object
-
- com.snowtide.pdf.annot.FileAttachmentAnnotation
-
- All Implemented Interfaces:
Annotation,DocumentLocation,Bounded
public class FileAttachmentAnnotation extends Object
An
Annotationimplementation that represents a PDF annotation of typeFileAttachment. Attachment annotations contain a reference to a file, the contents of which are usually embedded within the PDF document.- Since:
- v3.0.0
- Version:
- ©2004-2025 Snowtide
-
-
Constructor Summary
Constructors Constructor Description FileAttachmentAnnotation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Regionbounds()PagegetAppearance()Returns aPagecontaining this annotation's rendered "appearance stream", if it explicitly defines one, null otherwise.EmbeddedFilegetAttachment()Returns theEmbeddedFileassociated with this annotation.StringgetContents()Returns the text content of this annotation.StringgetIconName()Returns the name of the icon that is associated with this file annotation; this is generally displayed in the PDF as the clickable target that will open the file attachment.StringgetModificationDate()Returns the date, in PDF date format, when this annotation was last modified.StringgetName()Returns the optional name for this annotation, which should uniquely identify it within a page.StringgetTitle()Returns the title associated with this file annotation.StringgetTypeCd()Returns a String indicating what type of annotation this this.intpageNumber()This page number is 0-indexed, and may be used to retrieve aPageobject representing the page's content using theDocument#getPage(int)function.
-
-
-
Method Detail
-
getIconName
public String getIconName()
Returns the name of the icon that is associated with this file annotation; this is generally displayed in the PDF as the clickable target that will open the file attachment. Known "standard" icon names include:Graph Paperclip PushPin Tag
-
getTitle
public String getTitle()
Returns the title associated with this file annotation.
-
getAttachment
public EmbeddedFile getAttachment()
Returns theEmbeddedFileassociated with this annotation.
-
getContents
public String getContents()
Description copied from interface:AnnotationReturns 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.- Specified by:
getContentsin interfaceAnnotation
-
pageNumber
public int pageNumber()
Description copied from interface:DocumentLocationThis page number is 0-indexed, and may be used to retrieve aPageobject representing the page's content using theDocument.getPage(int)function.If a page number is not available for some reason, then this method will return -1.
- Specified by:
pageNumberin interfaceDocumentLocation
-
getName
public String getName()
Description copied from interface:AnnotationReturns the optional name for this annotation, which should uniquely identify it within a page.- Specified by:
getNamein interfaceAnnotation
-
getModificationDate
public String getModificationDate()
Description copied from interface:AnnotationReturns the date, in PDF date format, when this annotation was last modified. This date string may be parsed using thePDFDateParserclass. This function may return null if no modification date is present in the annotation data.- Specified by:
getModificationDatein interfaceAnnotation
-
getTypeCd
public String getTypeCd()
Description copied from interface:AnnotationReturns 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.- Specified by:
getTypeCdin interfaceAnnotation
-
getAppearance
public Page getAppearance() throws IOException
Description copied from interface:AnnotationReturns aPagecontaining 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'stypeand associated data.) The contents of the page can be accessed and manipulated just like any "regular" page obtained from e.g.Document.getPage(int).- Specified by:
getAppearancein interfaceAnnotation- Throws:
IOException
-
-