1 31 package org.pdfbox.pdmodel.interactive.annotation; 32 33 import java.io.IOException ; 34 35 import org.pdfbox.cos.COSDictionary; 36 import org.pdfbox.cos.COSName; 37 import org.pdfbox.pdmodel.common.filespecification.PDFileSpecification; 38 39 45 public class PDAnnotationFileAttachment extends PDAnnotation 46 { 47 50 public static final String ATTACHMENT_NAME_PUSH_PIN = "PushPin"; 51 54 public static final String ATTACHMENT_NAME_GRAPH = "Graph"; 55 58 public static final String ATTACHMENT_NAME_PAPERCLIP = "Paperclip"; 59 62 public static final String ATTACHMENT_NAME_TAG = "Tag"; 63 64 67 public static final String SUB_TYPE = "FileAttachment"; 68 69 72 public PDAnnotationFileAttachment() 73 { 74 super(); 75 getDictionary().setItem( COSName.SUBTYPE, COSName.getPDFName( SUB_TYPE ) ); 76 } 77 78 84 public PDAnnotationFileAttachment(COSDictionary field) 85 { 86 super( field ); 87 } 88 89 96 public PDFileSpecification getFile() throws IOException 97 { 98 return PDFileSpecification.createFS( getDictionary().getDictionaryObject( "FS" ) ); 99 } 100 101 106 public void setFile( PDFileSpecification file ) 107 { 108 getDictionary().setItem( "FS", file ); 109 } 110 111 117 public String getAttachmentName() 118 { 119 return getDictionary().getNameAsString( "Name", ATTACHMENT_NAME_PUSH_PIN ); 120 } 121 122 128 public void setAttachementName( String name ) 129 { 130 getDictionary().setName( "Name", name ); 131 } 132 } | Popular Tags |