1 package com.etymon.pjx.util; 2 3 import java.io.*; 4 import java.util.*; 5 import com.etymon.pjx.*; 6 7 13 public class PdfPageObjects extends PdfReferencedObjects { 14 15 18 protected PdfManager _mgr; 19 20 24 public PdfPageObjects(PdfManager manager) { 25 super(manager); 26 _mgr = manager; 27 } 28 29 36 public Set getReferenced(PdfObject obj) throws IOException, PdfFormatException { 37 synchronized (this) { 38 synchronized (_mgr) { 39 40 return super.getReferenced(obj); 41 42 } 43 } 44 } 45 46 50 protected static final PdfName PDFNAME_ANNOT = new PdfName("Annot"); 51 52 56 protected static final PdfName PDFNAME_P = new PdfName("P"); 57 58 62 protected static final PdfName PDFNAME_PAGE = new PdfName("Page"); 63 64 68 protected static final PdfName PDFNAME_PARENT = new PdfName("Parent"); 69 70 74 protected static final PdfName PDFNAME_TYPE = new PdfName("Type"); 75 76 84 public PdfObject preFilter(PdfObject obj) throws PdfFormatException { 85 86 if (obj instanceof PdfDictionary) { 88 89 Map map = ((PdfDictionary)obj).getMap(); 90 91 Object j = map.get(PDFNAME_TYPE); 93 if ( ( PdfNull.isNull(j) == false ) && 94 ( j instanceof PdfName ) && 95 ( ((PdfName)j).equals(PDFNAME_PAGE) ) ) { 96 97 Map newMap = new HashMap(map); 98 newMap.remove(PDFNAME_PARENT); 99 return new PdfDictionary(newMap); 100 } 101 102 j = map.get(PDFNAME_TYPE); 104 if ( ( PdfNull.isNull(j) == false ) && 105 ( j instanceof PdfName ) && 106 ( ((PdfName)j).equals(PDFNAME_ANNOT) ) ) { 107 108 Map newMap = new HashMap(map); 109 newMap.remove(PDFNAME_P); 110 return new PdfDictionary(newMap); 111 } 112 113 } 114 115 return obj; 116 } 117 118 } 119 | Popular Tags |