1 31 package org.pdfbox.pdmodel.fdf; 32 33 import java.util.ArrayList ; 34 import java.util.List ; 35 36 import org.pdfbox.cos.COSArray; 37 import org.pdfbox.cos.COSBase; 38 import org.pdfbox.cos.COSDictionary; 39 40 import org.pdfbox.pdmodel.common.COSArrayList; 41 import org.pdfbox.pdmodel.common.COSObjectable; 42 43 49 public class FDFPage implements COSObjectable 50 { 51 private COSDictionary page; 52 53 56 public FDFPage() 57 { 58 page = new COSDictionary(); 59 } 60 61 66 public FDFPage( COSDictionary p ) 67 { 68 page = p; 69 } 70 71 76 public COSBase getCOSObject() 77 { 78 return page; 79 } 80 81 86 public COSDictionary getCOSDictionary() 87 { 88 return page; 89 } 90 91 97 public List getTemplates() 98 { 99 List retval = null; 100 COSArray array = (COSArray)page.getDictionaryObject( "Templates" ); 101 if( array != null ) 102 { 103 List objects = new ArrayList (); 104 for( int i=0; i<array.size(); i++ ) 105 { 106 objects.add( new FDFTemplate( (COSDictionary)array.getObject( i ) ) ); 107 } 108 retval = new COSArrayList( objects, array ); 109 } 110 return retval; 111 } 112 113 118 public void setTemplates( List templates ) 119 { 120 page.setItem( "Templates", COSArrayList.converterToCOSArray( templates ) ); 121 } 122 123 128 public FDFPageInfo getPageInfo() 129 { 130 FDFPageInfo retval = null; 131 COSDictionary dict = (COSDictionary)page.getDictionaryObject( "Info" ); 132 if( dict != null ) 133 { 134 retval = new FDFPageInfo( dict ); 135 } 136 return retval; 137 } 138 139 144 public void setPageInfo( FDFPageInfo info ) 145 { 146 page.setItem( "Info", info ); 147 } 148 } | Popular Tags |