PdfObject value = dictionary.get(key);
boolean isInAP(PdfDictionary dic, PdfName check) { PdfDictionary appDic = dic.getAsDict(PdfName.AP); if (appDic == null) return false; PdfDictionary NDic = appDic.getAsDict(PdfName.N); return (NDic != null && NDic.get(check) != null); }
/** * Setter for property appendable. * * @param appendable * New value of property appendable. */ public void setAppendable(boolean appendable) { this.appendable = appendable; if (appendable) getPdfObject(trailer.get(PdfName.ROOT)); }
/** * Setter for property appendable. * @param appendable New value of property appendable. */ public void setAppendable(boolean appendable) { this.appendable = appendable; if (appendable) getPdfObject(trailer.get(PdfName.ROOT)); }
protected static PdfDictionary duplicatePdfDictionary(PdfDictionary original, PdfDictionary copy, PdfReader newReader) { if (copy == null) copy = new PdfDictionary(); for (Object o : original.getKeys()) { PdfName key = (PdfName) o; copy.put(key, duplicatePdfObject(original.get(key), newReader)); } return copy; }
boolean isInAP(PdfDictionary dic, PdfName check) { PdfDictionary appDic = dic.getAsDict(PdfName.AP); if (appDic == null) return false; PdfDictionary NDic = appDic.getAsDict(PdfName.N); return (NDic != null && NDic.get(check) != null); }
/** * Setter for property appendable. * @param appendable New value of property appendable. */ public void setAppendable(boolean appendable) { this.appendable = appendable; if (appendable) getPdfObject(trailer.get(PdfName.ROOT)); }
private void iterateBookmarks(PdfObject outlineRef, HashMap names) { while (outlineRef != null) { replaceNamedDestination(outlineRef, names); PdfDictionary outline = (PdfDictionary)getPdfObjectRelease(outlineRef); PdfObject first = outline.get(PdfName.FIRST); if (first != null) { iterateBookmarks(first, names); } outlineRef = outline.get(PdfName.NEXT); } }
private void pushPageAttributes(PdfDictionary nodePages) { PdfDictionary dic = new PdfDictionary(); if (!pageInh.isEmpty()) { dic.putAll((PdfDictionary)pageInh.get(pageInh.size() - 1)); } for (int k = 0; k < pageInhCandidates.length; ++k) { PdfObject obj = nodePages.get(pageInhCandidates[k]); if (obj != null) dic.put(pageInhCandidates[k], obj); } pageInh.add(dic); }
void readPages() throws IOException { if (refsn != null) return; refsp = null; refsn = new ArrayList(); pageInh = new ArrayList(); iteratePages((PRIndirectReference)reader.catalog.get(PdfName.PAGES)); pageInh = null; reader.rootPages.put(PdfName.COUNT, new PdfNumber(refsn.size())); }
void setOutlines() throws IOException { if (newBookmarks == null) return; deleteOutlines(); if (newBookmarks.isEmpty()) return; PdfDictionary catalog = reader.getCatalog(); boolean namedAsNames = (catalog.get(PdfName.DESTS) != null); writeOutlines(catalog, namedAsNames); markUsed(catalog); }
static boolean existsName(PdfDictionary dic, PdfName key, PdfName value) { PdfObject type = getPdfObjectRelease(dic.get(key)); if (type == null || !type.isName()) return false; PdfName name = (PdfName)type; return name.equals(value); }
void setOutlines() throws IOException { if (newBookmarks == null) return; deleteOutlines(); if (newBookmarks.isEmpty()) return; PdfDictionary catalog = reader.getCatalog(); boolean namedAsNames = (catalog.get(PdfName.DESTS) != null); writeOutlines(catalog, namedAsNames); markUsed(catalog); }
/** * Read, and comprehend the acroform * @param root the document root */ public void readAcroForm(PdfDictionary root) { if (root == null) return; hashMap = root.hashMap; pushAttrib(root); PdfArray fieldlist = (PdfArray)PdfReader.getPdfObjectRelease(root.get(PdfName.FIELDS)); iterateFields(fieldlist, null, null); }
private static String getNameString(PdfDictionary dic, PdfName key) { PdfObject obj = PdfReader.getPdfObject(dic.get(key)); if (obj == null || !obj.isString()) return null; return ((PdfString)obj).toUnicodeString(); }
private static String getNameString(PdfDictionary dic, PdfName key) { PdfObject obj = PdfReader.getPdfObject(dic.get(key)); if (obj == null || !obj.isString()) return null; return ((PdfString)obj).toUnicodeString(); }
/** * Read, and comprehend the acroform * @param root the document root */ public void readAcroForm(PdfDictionary root) { if (root == null) return; hashMap = root.hashMap; pushAttrib(root); PdfArray fieldlist = (PdfArray)PdfReader.getPdfObjectRelease(root.get(PdfName.FIELDS)); iterateFields(fieldlist, null, null); }
private PageRefs(PdfReader reader) throws IOException { this.reader = reader; if (reader.partial) { refsp = new IntHashtable(); PdfNumber npages = (PdfNumber)PdfReader.getPdfObjectRelease(reader.rootPages.get(PdfName.COUNT)); sizep = npages.intValue(); } else { readPages(); } }
void deleteOutlines() { PdfDictionary catalog = this.reader.getCatalog(); PRIndirectReference outlines = (PRIndirectReference)catalog.get(PdfName.OUTLINES); if (outlines == null) return; outlineTravel(outlines); PdfReader.killIndirect(outlines); catalog.remove(PdfName.OUTLINES); markUsed(catalog); }
void sweepKids(PdfObject obj) { PdfObject oo = PdfReader.killIndirect(obj); if (oo == null || !oo.isDictionary()) return; PdfDictionary dic = (PdfDictionary)oo; PdfArray kids = (PdfArray)PdfReader.killIndirect(dic.get(PdfName.KIDS)); if (kids == null) return; for (int k = 0; k < kids.size(); ++k) { sweepKids(kids.getPdfObject(k)); } }