Class PDAnnotationFileAttachment
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationFileAttachment
-
- All Implemented Interfaces:
COSObjectable
public class PDAnnotationFileAttachment extends PDAnnotationMarkup
This is the class that represents a file attachment.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTACHMENT_NAME_GRAPHSee get/setAttachmentName.static java.lang.StringATTACHMENT_NAME_PAPERCLIPSee get/setAttachmentName.static java.lang.StringATTACHMENT_NAME_PUSH_PINSee get/setAttachmentName.static java.lang.StringATTACHMENT_NAME_TAGSee get/setAttachmentName.private PDAppearanceHandlercustomAppearanceHandlerstatic java.lang.StringSUB_TYPEThe type of annotation.-
Fields inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
RT_GROUP, RT_REPLY
-
-
Constructor Summary
Constructors Constructor Description PDAnnotationFileAttachment()Constructor.PDAnnotationFileAttachment(COSDictionary field)Creates a Link annotation from a COSDictionary, expected to be a correct object definition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconstructAppearances()Create the appearance entry for this annotation.voidconstructAppearances(PDDocument document)Create the appearance entry for this annotation.java.lang.StringgetAttachmentName()This is the name used to draw the type of attachment.PDFileSpecificationgetFile()Return the attached file.voidsetAttachmentName(java.lang.String name)Set the name used to draw the attachment icon.voidsetCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)Set a custom appearance handler for generating the annotations appearance streams.voidsetFile(PDFileSpecification file)Set the attached file.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
getBorderStyle, getConstantOpacity, getCreationDate, getExternalData, getInReplyTo, getIntent, getPopup, getReplyType, getRichContents, getSubject, getTitlePopup, setBorderStyle, setConstantOpacity, setCreationDate, setExternalData, setInReplyTo, setIntent, setPopup, setReplyType, setRichContents, setSubject, setTitlePopup
-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation
createAnnotation, equals, getAnnotationFlags, getAnnotationName, getAppearance, getAppearanceState, getBorder, getColor, getColor, getContents, getCOSObject, getModifiedDate, getNormalAppearanceStream, getOptionalContent, getPage, getRectangle, getStructParent, getSubtype, hashCode, isHidden, isInvisible, isLocked, isLockedContents, isNoRotate, isNoView, isNoZoom, isPrinted, isReadOnly, isToggleNoView, setAnnotationFlags, setAnnotationName, setAppearance, setAppearanceState, setBorder, setColor, setContents, setHidden, setInvisible, setLocked, setLockedContents, setModifiedDate, setModifiedDate, setNoRotate, setNoView, setNoZoom, setOptionalContent, setPage, setPrinted, setReadOnly, setRectangle, setStructParent, setSubtype, setToggleNoView
-
-
-
-
Field Detail
-
ATTACHMENT_NAME_PUSH_PIN
public static final java.lang.String ATTACHMENT_NAME_PUSH_PIN
See get/setAttachmentName.- See Also:
- Constant Field Values
-
ATTACHMENT_NAME_GRAPH
public static final java.lang.String ATTACHMENT_NAME_GRAPH
See get/setAttachmentName.- See Also:
- Constant Field Values
-
ATTACHMENT_NAME_PAPERCLIP
public static final java.lang.String ATTACHMENT_NAME_PAPERCLIP
See get/setAttachmentName.- See Also:
- Constant Field Values
-
ATTACHMENT_NAME_TAG
public static final java.lang.String ATTACHMENT_NAME_TAG
See get/setAttachmentName.- See Also:
- Constant Field Values
-
SUB_TYPE
public static final java.lang.String SUB_TYPE
The type of annotation.- See Also:
- Constant Field Values
-
customAppearanceHandler
private PDAppearanceHandler customAppearanceHandler
-
-
Constructor Detail
-
PDAnnotationFileAttachment
public PDAnnotationFileAttachment()
Constructor.
-
PDAnnotationFileAttachment
public PDAnnotationFileAttachment(COSDictionary field)
Creates a Link annotation from a COSDictionary, expected to be a correct object definition.- Parameters:
field- the PDF object to represent as a field.
-
-
Method Detail
-
getFile
public PDFileSpecification getFile() throws java.io.IOException
Return the attached file.- Returns:
- The attached file.
- Throws:
java.io.IOException- If there is an error creating the file spec.
-
setFile
public void setFile(PDFileSpecification file)
Set the attached file.- Parameters:
file- The file that is attached.
-
getAttachmentName
public java.lang.String getAttachmentName()
This is the name used to draw the type of attachment. See the ATTACHMENT_NAME_XXX constants.- Returns:
- The name that describes the visual cue for the attachment.
-
setAttachmentName
public void setAttachmentName(java.lang.String name)
Set the name used to draw the attachment icon. See the ATTACHMENT_NAME_XXX constants.- Parameters:
name- The name of the visual icon to draw.
-
setCustomAppearanceHandler
public void setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)
Set a custom appearance handler for generating the annotations appearance streams.- Parameters:
appearanceHandler- custom appearance handler
-
constructAppearances
public void constructAppearances()
Description copied from class:PDAnnotationCreate the appearance entry for this annotation. Not having it may prevent display in some viewers. This method is for overriding in subclasses, the default implementation does nothing.- Overrides:
constructAppearancesin classPDAnnotation
-
constructAppearances
public void constructAppearances(PDDocument document)
Description copied from class:PDAnnotationCreate the appearance entry for this annotation. Not having it may prevent display in some viewers. This method is for overriding in subclasses, the default implementation does nothing.- Overrides:
constructAppearancesin classPDAnnotation- Parameters:
document- the related document
-
-