/** * Create instance of document outline. * * @param title the text that shall be displayed on the screen for this item. * @param content Outline dictionary * @param parent parent outline. * {@link #addOutline(String, int)} and {@link #addOutline(String)} instead. */ PdfOutline(String title, PdfDictionary content, PdfOutline parent) { this.title = title; this.content = content; this.parent = parent; this.pdfDoc = parent.pdfDoc; content.makeIndirect(parent.pdfDoc); }
/** * Creates a new PdfOCProperties instance. * * @param document the document the optional content belongs to */ public PdfOCProperties(PdfDocument document) { this((PdfDictionary) new PdfDictionary().makeIndirect(document)); }
/** * Create a PdfDocumentInfo based on the passed PdfDictionary. * * @param pdfObject PdfDictionary containing PdfDocumentInfo */ PdfDocumentInfo(PdfDictionary pdfObject, PdfDocument pdfDocument) { infoDictionary = pdfObject; if (pdfDocument.getWriter() != null) { infoDictionary.makeIndirect(pdfDocument); } }
protected PdfCatalog(PdfDocument pdfDocument) { this((PdfDictionary) new PdfDictionary().makeIndirect(pdfDocument)); }
public PdfDictionary buildParentTree() { return (PdfDictionary)parentTree.buildTree().makeIndirect(structTreeRoot.getDocument()); }
/** * Creates a minimal {@link PdfFormField}. * * @param pdfDocument The document */ protected PdfFormField(PdfDocument pdfDocument) { this((PdfDictionary) new PdfDictionary().makeIndirect(pdfDocument)); PdfName formType = getFormType(); if (formType != null) { put(PdfName.FT, formType); } }
/** * Creates a minimal {@link PdfFormField}. * * @param pdfDocument The document */ protected PdfFormField(PdfDocument pdfDocument) { this((PdfDictionary) new PdfDictionary().makeIndirect(pdfDocument)); PdfName formType = getFormType(); if (formType != null) { put(PdfName.FT, formType); } }
public PdfStructTreeRoot(PdfDocument document) { this((PdfDictionary) new PdfDictionary().makeIndirect(document), document); getPdfObject().put(PdfName.Type, PdfName.StructTreeRoot); }
/** * 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); }
private static void cloneParents(PdfDictionary structElem, LastClonedAncestor lastCloned, PdfDocument document) { if (lastCloned.ancestor != structElem) { PdfDictionary structElemClone = (PdfDictionary) structElem.clone(ignoreKeysForClone).makeIndirect(document); PdfDictionary currClone = structElemClone; PdfDictionary currElem = structElem; while (currElem.get(PdfName.P) != lastCloned.ancestor) { PdfDictionary parent = currElem.getAsDictionary(PdfName.P); PdfDictionary parentClone = (PdfDictionary) parent.clone(ignoreKeysForClone).makeIndirect(document); currClone.put(PdfName.P, parentClone); parentClone.put(PdfName.K, currClone); currClone = parentClone; currElem = parent; } PdfStructElem.addKidObject(lastCloned.clone, -1, currClone); lastCloned.clone = structElemClone; lastCloned.ancestor = structElem; } }
/** * Gets the collection of the layers this layer membership operates with. */ public Collection<PdfLayer> getLayers() { final PdfObject layers = getPdfObject().get(PdfName.OCGs); if (layers instanceof PdfDictionary) { List<PdfLayer> list = new ArrayList<>(); list.add(new PdfLayer((PdfDictionary) ((PdfDictionary) layers).makeIndirect(getDocument()))); return list; } else if (layers instanceof PdfArray) { List<PdfLayer> layerList = new ArrayList<>(); for (int ind = 0; ind < ((PdfArray) layers).size(); ind++) { layerList.add(new PdfLayer(((PdfArray) (((PdfArray) layers).makeIndirect(getDocument()))).getAsDictionary(ind))); } return layerList; } return null; }
public PdfStructElem(PdfDocument document, PdfName role) { this((PdfDictionary) new PdfDictionary().makeIndirect(document)); getPdfObject().put(PdfName.Type, PdfName.StructElem); getPdfObject().put(PdfName.S, role); }
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); }
/** * Creates a form field as a parent of a {@link PdfWidgetAnnotation}. * * @param widget The widget which will be a kid of the {@link PdfFormField} * @param pdfDocument The document */ protected PdfFormField(PdfWidgetAnnotation widget, PdfDocument pdfDocument) { this((PdfDictionary) new PdfDictionary().makeIndirect(pdfDocument)); widget.makeIndirect(pdfDocument); addKid(widget); put(PdfName.FT, getFormType()); }
/** * Creates a form field as a parent of a {@link PdfWidgetAnnotation}. * * @param widget The widget which will be a kid of the {@link PdfFormField} * @param pdfDocument The document */ protected PdfFormField(PdfWidgetAnnotation widget, PdfDocument pdfDocument) { this((PdfDictionary) new PdfDictionary().makeIndirect(pdfDocument)); widget.makeIndirect(pdfDocument); addKid(widget); put(PdfName.FT, getFormType()); }
PdfLayer currentLayer = new PdfLayer((PdfDictionary) ocgs.getAsDictionary(ind).makeIndirect(getDocument()));
topClone.makeIndirect(document); clonedTops.add(topClone);
if (ocPropertiesDict != null) { if (getDocument().getWriter() != null) { ocPropertiesDict.makeIndirect(getDocument());
protected PdfPage(PdfDocument pdfDocument, PageSize pageSize) { this((PdfDictionary) new PdfDictionary().makeIndirect(pdfDocument)); PdfStream contentStream = (PdfStream) new PdfStream().makeIndirect(pdfDocument); getPdfObject().put(PdfName.Contents, contentStream); getPdfObject().put(PdfName.Type, PdfName.Page); getPdfObject().put(PdfName.MediaBox, new PdfArray(pageSize)); getPdfObject().put(PdfName.TrimBox, new PdfArray(pageSize)); if (pdfDocument.isTagged()) { setTabOrder(PdfName.S); } }
public PdfPages(int from, PdfDocument pdfDocument, PdfPages parent) { super(new PdfDictionary()); if (pdfDocument.getWriter() != null) { getPdfObject().makeIndirect(pdfDocument); } setForbidRelease(); this.from = from; this.count = new PdfNumber(0); this.kids = new PdfArray(); this.parent = parent; getPdfObject().put(PdfName.Type, PdfName.Pages); getPdfObject().put(PdfName.Kids, this.kids); getPdfObject().put(PdfName.Count, this.count); if (parent != null) { getPdfObject().put(PdfName.Parent, this.parent.getPdfObject()); } }