1 31 package org.pdfbox.pdmodel; 32 33 import org.pdfbox.cos.COSBase; 34 import org.pdfbox.cos.COSDictionary; 35 import org.pdfbox.pdmodel.common.COSObjectable; 36 37 43 public class PDDocumentNameDictionary implements COSObjectable 44 { 45 private COSDictionary nameDictionary; 46 private PDDocumentCatalog catalog; 47 48 53 public PDDocumentNameDictionary( PDDocumentCatalog cat ) 54 { 55 nameDictionary = new COSDictionary(); 56 catalog = cat; 57 } 58 59 65 public PDDocumentNameDictionary( PDDocumentCatalog cat, COSDictionary names ) 66 { 67 catalog = cat; 68 nameDictionary = names; 69 } 70 71 76 public COSBase getCOSObject() 77 { 78 return nameDictionary; 79 } 80 81 86 public COSDictionary getCOSDictionary() 87 { 88 return nameDictionary; 89 } 90 91 97 public PDDestinationNameTreeNode getDests() 98 { 99 PDDestinationNameTreeNode dests = null; 100 101 COSDictionary dic = (COSDictionary)nameDictionary.getDictionaryObject( "Dests" ); 102 103 if( dic == null ) 106 { 107 dic = (COSDictionary)catalog.getCOSDictionary().getDictionaryObject( "Dests" ); 108 } 109 110 if( dic != null ) 111 { 112 dests = new PDDestinationNameTreeNode( dic ); 113 } 114 115 116 return dests; 117 } 118 119 124 public void setDests( PDDestinationNameTreeNode dests ) 125 { 126 nameDictionary.setItem( "Dests", dests ); 127 catalog.getCOSDictionary().setItem( "Dests", (COSObjectable)null); 133 } 134 135 141 public PDEmbeddedFilesNameTreeNode getEmbeddedFiles() 142 { 143 PDEmbeddedFilesNameTreeNode retval = null; 144 145 COSDictionary dic = (COSDictionary)nameDictionary.getDictionaryObject( "EmbeddedFiles" ); 146 147 if( dic != null ) 148 { 149 retval = new PDEmbeddedFilesNameTreeNode( dic ); 150 } 151 152 return retval; 153 } 154 155 160 public void setEmbeddedFiles( PDEmbeddedFilesNameTreeNode ef ) 161 { 162 nameDictionary.setItem( "EmbeddedFiles", ef ); 163 } 164 } | Popular Tags |