protected void addDeveloperExtension(PdfDeveloperExtension extension) { document.getCatalog().addDeveloperExtension(extension); }
protected void addDeveloperExtension(PdfDeveloperExtension extension) { document.getCatalog().addDeveloperExtension(extension); }
/** * Use this method to set a collection of optional content groups * whose states are intended to follow a "radio button" paradigm. * That is, the state of at most one optional content group * in the array should be ON at a time: if one group is turned * ON, all others must be turned OFF. * @param document the <CODE>PdfDocument</CODE> * @param group the radio group */ public static void addOCGRadioGroup(PdfDocument document, List<PdfLayer> group) { document.getCatalog().getOCProperties(true).addOCGRadioGroup(group); }
private PdfOCProperties fetchOCProperties() { return getDocument().getCatalog().getOCProperties(true); } }
/** * Init ParentTreeHandler. On init the parent tree is read and stored in this instance. */ ParentTreeHandler(PdfStructTreeRoot structTreeRoot) { this.structTreeRoot = structTreeRoot; parentTree = new PdfNumTree(structTreeRoot.getDocument().getCatalog(), PdfName.ParentTree); registerAllMcrs(); pageToStructParentsInd = new HashMap<>(); }
/** * Return the XFA Object, could be an array, could be a Stream. * Returns null if no XFA Object is present. * * @param pdfDocument a PdfDocument instance * @return the XFA object */ private static PdfObject getXfaObject(PdfDocument pdfDocument) { PdfDictionary af = pdfDocument.getCatalog().getPdfObject().getAsDictionary(PdfName.AcroForm); return af == null ? null : af.get(PdfName.XFA); }
/** * Gets the Outline root in {@link PdfOutline#pdfDoc}'s catalog entry * * @return The {@link PdfDictionary} of the document's Outline root, or {@code null} if it can't be found. */ private PdfDictionary getOutlineRoot() { if (!pdfDoc.hasOutlines()) { return null; } return pdfDoc.getCatalog().getPdfObject().getAsDictionary(PdfName.Outlines); }
/** * Creates a new layer by its name and document. * @param name the layer name * @param document the PdfDocument which the layer belongs to */ public PdfLayer(String name, PdfDocument document) { this(document); setName(name); document.getCatalog().getOCProperties(true).registerLayer(this); }
/** * Creates a title layer. A title layer is not really a layer but a collection of layers * under the same title heading. * @param title the title text * @param document the <CODE>PdfDocument</CODE> * @return the title layer */ public static PdfLayer createTitle(String title, PdfDocument document) { PdfLayer layer = createTitleSilent(title, document); document.getCatalog().getOCProperties(true).registerLayer(layer); return layer; }
/** * Return the XFA Object, could be an array, could be a Stream. * Returns null if no XFA Object is present. * * @param pdfDocument a PdfDocument instance * @return the XFA object */ private static PdfObject getXfaObject(PdfDocument pdfDocument) { PdfDictionary af = pdfDocument.getCatalog().getPdfObject().getAsDictionary(PdfName.AcroForm); return af == null ? null : af.get(PdfName.XFA); }
/** * Merges the validation with any validation already in the document or creates a new one. * @throws IOException */ public void merge() throws IOException { if (used || validated.size() == 0) return; used = true; PdfDictionary catalog = document.getCatalog().getPdfObject(); PdfObject dss = catalog.get(PdfName.DSS); if (dss == null) createDss(); else updateDss(); }
/** * Merges the validation with any validation already in the document or creates a new one. * @throws IOException */ public void merge() throws IOException { if (used || validated.size() == 0) return; used = true; PdfDictionary catalog = document.getCatalog().getPdfObject(); PdfObject dss = catalog.get(PdfName.DSS); if (dss == null) createDss(); else updateDss(); }
/** * This method gets outlines of a current page * * @return return all outlines of a current page */ public List<PdfOutline> getOutlines(boolean updateOutlines) { getDocument().getOutlines(updateOutlines); return getDocument().getCatalog().getPagesWithOutlines().get(getPdfObject()); }
/** * Removes the XFA stream from the document. */ public void removeXfaForm() { if (hasXfaForm()) { PdfDictionary root = document.getCatalog().getPdfObject(); PdfDictionary acroform = root.getAsDictionary(PdfName.AcroForm); acroform.remove(PdfName.XFA); xfaForm = null; } }
/** * This constructor creates root outline in the document. * * @param doc {@link PdfDocument} */ PdfOutline(PdfDocument doc) { content = new PdfDictionary(); content.put(PdfName.Type, PdfName.Outlines); this.pdfDoc = doc; content.makeIndirect(doc); doc.getCatalog().addRootOutline(this); }
/** * Removes the XFA stream from the document. */ public void removeXfaForm() { if (hasXfaForm()) { PdfDictionary root = document.getCatalog().getPdfObject(); PdfDictionary acroform = root.getAsDictionary(PdfName.AcroForm); acroform.remove(PdfName.XFA); xfaForm = null; } }
private PdfObject getInheritedValue(PdfName pdfName, int type) { if (this.parentPages == null) { this.parentPages = getDocument().getCatalog().getPageTree().findPageParent(this); } PdfObject val = getInheritedValue(this.parentPages, pdfName); return val != null && val.getType() == type ? val : null; }
private PdfObject getAcroFormKey(PdfName key, int type) { PdfObject acroFormKey = null; PdfDocument document = getDocument(); if (document != null) { PdfDictionary acroFormDictionary = document.getCatalog().getPdfObject().getAsDictionary(PdfName.AcroForm); if (acroFormDictionary != null) { acroFormKey = acroFormDictionary.get(key); } } return (acroFormKey != null && acroFormKey.getType() == type) ? acroFormKey : null; }
private PdfObject getAcroFormKey(PdfName key, int type) { PdfObject acroFormKey = null; PdfDocument document = getDocument(); if (document != null) { PdfDictionary acroFormDictionary = document.getCatalog().getPdfObject().getAsDictionary(PdfName.AcroForm); if (acroFormDictionary != null) { acroFormKey = acroFormDictionary.get(key); } } return (acroFormKey != null && acroFormKey.getType() == type) ? acroFormKey : null; }
private boolean isEqualSameNameDestExist(Map<PdfPage, PdfPage> page2page, PdfDocument toDocument, String srcDestName, PdfArray srcDestArray, PdfPage oldPage) { PdfArray sameNameDest = (PdfArray) toDocument.getCatalog().getNameTree(PdfName.Dests).getNames().get(srcDestName); boolean equalSameNameDestExists = false; if (sameNameDest != null && sameNameDest.getAsDictionary(0) != null) { PdfIndirectReference existingDestPageRef = sameNameDest.getAsDictionary(0).getIndirectReference(); PdfIndirectReference newDestPageRef = page2page.get(oldPage).getPdfObject().getIndirectReference(); if (equalSameNameDestExists = existingDestPageRef.equals(newDestPageRef) && sameNameDest.size() == srcDestArray.size()) { for (int i = 1; i < sameNameDest.size(); ++i) { equalSameNameDestExists = equalSameNameDestExists && sameNameDest.get(i).equals(srcDestArray.get(i)); } } } return equalSameNameDestExists; }