1 31 package org.pdfbox.pdmodel.interactive.documentnavigation.destination; 32 33 import org.pdfbox.cos.COSArray; 34 import org.pdfbox.cos.COSBase; 35 import org.pdfbox.cos.COSDictionary; 36 import org.pdfbox.cos.COSNumber; 37 38 import org.pdfbox.pdmodel.PDPage; 39 40 46 public abstract class PDPageDestination extends PDDestination 47 { 48 51 protected COSArray array; 52 53 57 protected PDPageDestination() 58 { 59 array = new COSArray(); 60 } 61 62 67 protected PDPageDestination( COSArray arr ) 68 { 69 array = arr; 70 } 71 72 80 public PDPage getPage() 81 { 82 PDPage retval = null; 83 if( array.size() > 0 ) 84 { 85 COSBase page = array.getObject( 0 ); 86 if( page instanceof COSDictionary ) 87 { 88 retval = new PDPage( (COSDictionary)page ); 89 } 90 } 91 return retval; 92 } 93 94 99 public void setPage( PDPage page ) 100 { 101 array.set( 0, page ); 102 } 103 104 112 public int getPageNumber() 113 { 114 int retval = -1; 115 if( array.size() > 0 ) 116 { 117 COSBase page = array.getObject( 0 ); 118 if( page instanceof COSNumber ) 119 { 120 retval = ((COSNumber)page).intValue(); 121 } 122 } 123 return retval; 124 } 125 126 131 public void setPageNumber( int pageNumber ) 132 { 133 array.set( 0, pageNumber ); 134 } 135 136 141 public COSBase getCOSObject() 142 { 143 return array; 144 } 145 146 151 public COSArray getCOSArray() 152 { 153 return array; 154 } 155 } 156 | Popular Tags |