1 31 package org.pdfbox.pdmodel.interactive.annotation; 32 33 import org.pdfbox.cos.COSArray; 34 import org.pdfbox.cos.COSBase; 35 import org.pdfbox.cos.COSDictionary; 36 import org.pdfbox.cos.COSName; 37 import org.pdfbox.cos.COSStream; 38 39 import org.pdfbox.pdmodel.common.PDRectangle; 40 import org.pdfbox.pdmodel.common.COSObjectable; 41 42 import org.pdfbox.pdmodel.PDResources; 43 44 45 51 public class PDAppearanceStream implements COSObjectable 52 { 53 private COSStream stream = null; 54 55 56 61 public PDAppearanceStream( COSStream s ) 62 { 63 stream = s; 64 } 65 66 71 public COSStream getStream() 72 { 73 return stream; 74 } 75 76 79 public COSBase getCOSObject() 80 { 81 return stream; 82 } 83 84 90 public PDRectangle getBoundingBox() 91 { 92 PDRectangle box = null; 93 COSArray bbox = (COSArray)stream.getDictionaryObject( COSName.getPDFName( "BBox" ) ); 94 if( bbox != null ) 95 { 96 box = new PDRectangle( bbox ); 97 } 98 return box; 99 } 100 101 106 public void setBoundingBox( PDRectangle rectangle ) 107 { 108 COSArray array = null; 109 if( rectangle != null ) 110 { 111 array = rectangle.getCOSArray(); 112 } 113 stream.setItem( COSName.getPDFName( "BBox" ), array ); 114 } 115 116 121 public PDResources getResources() 122 { 123 PDResources retval = null; 124 COSDictionary dict = (COSDictionary)stream.getDictionaryObject( COSName.RESOURCES ); 125 if( dict != null ) 126 { 127 retval = new PDResources( dict ); 128 } 129 return retval; 130 } 131 132 137 public void setResources( PDResources resources ) 138 { 139 COSDictionary dict = null; 140 if( resources != null ) 141 { 142 dict = resources.getCOSDictionary(); 143 } 144 stream.setItem( COSName.RESOURCES, dict ); 145 } 146 } | Popular Tags |