1 31 package org.pdfbox.pdmodel.interactive.viewerpreferences; 32 33 import org.pdfbox.cos.COSBase; 34 import org.pdfbox.cos.COSDictionary; 35 36 import org.pdfbox.pdmodel.common.COSObjectable; 37 38 44 public class PDViewerPreferences implements COSObjectable 45 { 46 49 public static final String NON_FULL_SCREEN_PAGE_MODE_USE_NONE = "UseNone"; 50 53 public static final String NON_FULL_SCREEN_PAGE_MODE_USE_OUTLINES = "UseOutlines"; 54 57 public static final String NON_FULL_SCREEN_PAGE_MODE_USE_THUMBS = "UseThumbs"; 58 61 public static final String NON_FULL_SCREEN_PAGE_MODE_USE_OPTIONAL_CONTENT = "UseOC"; 62 63 66 public static final String READING_DIRECTION_L2R = "L2R"; 67 70 public static final String READING_DIRECTION_R2L = "R2L"; 71 72 75 public static final String BOUNDARY_MEDIA_BOX = "MediaBox"; 76 79 public static final String BOUNDARY_CROP_BOX = "CropBox"; 80 83 public static final String BOUNDARY_BLEED_BOX = "BleedBox"; 84 87 public static final String BOUNDARY_TRIM_BOX = "TrimBox"; 88 91 public static final String BOUNDARY_ART_BOX = "ArtBox"; 92 93 94 private COSDictionary prefs; 95 96 101 public PDViewerPreferences( COSDictionary dic ) 102 { 103 prefs = dic; 104 } 105 106 111 public COSDictionary getDictionary() 112 { 113 return prefs; 114 } 115 116 121 public COSBase getCOSObject() 122 { 123 return prefs; 124 } 125 126 131 public boolean hideToolbar() 132 { 133 return prefs.getBoolean( "HideToolbar", false ); 134 } 135 136 141 public void setHideToolbar( boolean value ) 142 { 143 prefs.setBoolean( "HideToolbar", value ); 144 } 145 146 151 public boolean hideMenubar() 152 { 153 return prefs.getBoolean( "HideMenubar", false ); 154 } 155 156 161 public void setHideMenubar( boolean value ) 162 { 163 prefs.setBoolean( "HideMenubar", value ); 164 } 165 166 171 public boolean hideWindowUI() 172 { 173 return prefs.getBoolean( "HideWindowUI", false ); 174 } 175 176 181 public void setHideWindowUI( boolean value ) 182 { 183 prefs.setBoolean( "HideWindowUI", value ); 184 } 185 186 191 public boolean fitWindow() 192 { 193 return prefs.getBoolean( "FitWindow", false ); 194 } 195 196 201 public void setFitWindow( boolean value ) 202 { 203 prefs.setBoolean( "FitWindow", value ); 204 } 205 206 211 public boolean centerWindow() 212 { 213 return prefs.getBoolean( "CenterWindow", false ); 214 } 215 216 221 public void setCenterWindow( boolean value ) 222 { 223 prefs.setBoolean( "CenterWindow", value ); 224 } 225 226 231 public boolean displayDocTitle() 232 { 233 return prefs.getBoolean( "DisplayDocTitle", false ); 234 } 235 236 241 public void setDisplayDocTitle( boolean value ) 242 { 243 prefs.setBoolean( "DisplayDocTitle", value ); 244 } 245 246 251 public String getNonFullScreenPageMode() 252 { 253 return prefs.getNameAsString( "NonFullScreenPageMode", NON_FULL_SCREEN_PAGE_MODE_USE_NONE); 254 } 255 256 261 public void setNonFullScreenPageMode( String value ) 262 { 263 prefs.setName( "NonFullScreenPageMode", value ); 264 } 265 266 271 public String getReadingDirection() 272 { 273 return prefs.getNameAsString( "Direction", READING_DIRECTION_L2R); 274 } 275 276 281 public void setReadingDirection( String value ) 282 { 283 prefs.setName( "Direction", value ); 284 } 285 286 291 public String getViewArea() 292 { 293 return prefs.getNameAsString( "ViewArea", BOUNDARY_CROP_BOX); 294 } 295 296 301 public void setViewArea( String value ) 302 { 303 prefs.setName( "ViewArea", value ); 304 } 305 306 311 public String getViewClip() 312 { 313 return prefs.getNameAsString( "ViewClip", BOUNDARY_CROP_BOX); 314 } 315 316 321 public void setViewClip( String value ) 322 { 323 prefs.setName( "ViewClip", value ); 324 } 325 326 331 public String getPrintArea() 332 { 333 return prefs.getNameAsString( "PrintArea", BOUNDARY_CROP_BOX); 334 } 335 336 341 public void setPrintArea( String value ) 342 { 343 prefs.setName( "PrintArea", value ); 344 } 345 346 351 public String getPrintClip() 352 { 353 return prefs.getNameAsString( "PrintClip", BOUNDARY_CROP_BOX); 354 } 355 356 361 public void setPrintClip( String value ) 362 { 363 prefs.setName( "PrintClip", value ); 364 } 365 } | Popular Tags |