/** * Indicates if the catalog has any outlines * * @return {@code true}, if there are outlines and {@code false} otherwise. */ boolean hasOutlines() { return getPdfObject().containsKey(PdfName.Outlines); }
public PdfName getPageLayout() { return getPdfObject().getAsName(PdfName.PageLayout); }
public PdfString getLang() { return getPdfObject().getAsString(PdfName.Lang); }
/** * Returns files associated with PDF document. * * @return associated files array. */ public PdfArray getAssociatedFiles() { checkClosingStatus(); return catalog.getPdfObject().getAsArray(PdfName.AF); }
private void updateValueInMarkInfoDict(PdfName key, PdfObject value) { PdfDictionary markInfo = catalog.getPdfObject().getAsDictionary(PdfName.MarkInfo); if (markInfo == null) { markInfo = new PdfDictionary(); catalog.getPdfObject().put(PdfName.MarkInfo, markInfo); } markInfo.put(key, value); }
public PdfViewerPreferences getViewerPreferences() { PdfDictionary viewerPreferences = getPdfObject().getAsDictionary(PdfName.ViewerPreferences); if (viewerPreferences != null) { return new PdfViewerPreferences(viewerPreferences); } else { return null; } }
/** * This method returns the NumberTree of Page Labels * * @return returns {@link PdfNumTree} */ public PdfNumTree getPageLabelsTree(boolean createIfNotExists) { if (pageLabels == null && (getPdfObject().containsKey(PdfName.PageLabels) || createIfNotExists)) { pageLabels = new PdfNumTree(this, PdfName.PageLabels); } return pageLabels; }
public PdfCatalog put(PdfName key, PdfObject value) { getPdfObject().put(key, value); setModified(); return this; }
public PdfCatalog remove(PdfName key) { getPdfObject().remove(key); setModified(); return this; }
/** * Gets collection dictionary that a conforming reader shall use to enhance the presentation of file attachments * stored in the PDF document. * * @return {@link PdfCollection} wrapper of collection dictionary. */ public PdfCollection getCollection() { PdfDictionary collectionDictionary = getPdfObject().getAsDictionary(PdfName.Collection); if (collectionDictionary != null) { return new PdfCollection(collectionDictionary); } return null; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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; } }
/** * 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; } }
public PdfDocument setTagged() { checkClosingStatus(); if (structTreeRoot == null) { structTreeRoot = new PdfStructTreeRoot(this); catalog.getPdfObject().put(PdfName.StructTreeRoot, structTreeRoot.getPdfObject()); updateValueInMarkInfoDict(PdfName.Marked, PdfBoolean.TRUE); structParentIndex = 0; } return this; }
protected PdfCatalog(PdfDictionary pdfObject) { super(pdfObject); if (pdfObject == null) { throw new PdfException(PdfException.DocumentHasNoPdfCatalogObject); } ensureObjectIsAddedToDocument(pdfObject); getPdfObject().put(PdfName.Type, PdfName.Catalog); setForbidRelease(); pageTree = new PdfPagesTree(this); }
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 void ensureTreeRootAddedToNames(PdfObject treeRoot, PdfName treeType) { PdfDictionary names = catalog.getPdfObject().getAsDictionary(PdfName.Names); if (names == null) { names = new PdfDictionary(); catalog.put(PdfName.Names, names); names.makeIndirect(this); } names.put(treeType, treeRoot); }
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; }