/** * Create a new PdfArray. The PdfObjects in the iterable object will be added to the PdfArray. * * @param objects List of PdfObjects to be added to this PdfArray * @param initialCapacity Initial capacity of this PdfArray */ public PdfArray(Iterable<? extends PdfObject> objects, int initialCapacity) { list = new ArrayList<>(initialCapacity); for (PdfObject element : objects) add(element); }
private PdfExplicitRemoteGoToDestination add(PdfName type) { ((PdfArray)getPdfObject()).add(type); return this; } }
protected static PdfArray getNChannelCsArray(PdfArray names, PdfObject alternateSpace, PdfObject tintTransform, PdfDictionary attributes) { PdfArray nChannel = getDeviceNCsArray(names, alternateSpace, tintTransform); nChannel.add(attributes); return nChannel; }
private PdfArray getDashPatternArray(float[] dashArray, float phase) { PdfArray dashPatternArray = new PdfArray(); PdfArray dArray = new PdfArray(); if (dashArray != null) { for (float fl : dashArray) { dArray.add(new PdfNumber(fl)); } } dashPatternArray.add(dArray); dashPatternArray.add(new PdfNumber(phase)); return dashPatternArray; }
private PdfExplicitRemoteGoToDestination add(float value) { if (!Float.isNaN(value)) { ((PdfArray) getPdfObject()).add(new PdfNumber(value)); } return this; }
private static PdfArray getArrayFromStringList(String[] strings) { PdfArray arr = new PdfArray(); for (String string : strings) { arr.add(new PdfString(string)); } return arr; }
private static PdfArray buildArray(Object[] names) { PdfArray array = new PdfArray(); for (Object obj : names) { if (obj instanceof String) { array.add(new PdfString((String) obj)); } else if (obj instanceof PdfAnnotation) { array.add(((PdfAnnotation) obj).getPdfObject()); } else { throw new PdfException("The array must contain string or PDFAnnotation"); } } return array; }
/** * PDF 2.0. Sets halftone origin * * @param x X location of the halftone origin in the current coordinate system * @param y Y location of the halftone origin in the current coordinate system * @return this {@link PdfExtGState} instance */ public PdfExtGState setHalftoneOrigin(float x, float y) { PdfArray hto = new PdfArray(); hto.add(new PdfNumber(x)); hto.add(new PdfNumber(y)); return put(PdfName.HTO, hto); }
/** * Sets the /ByteRange. * * @param range an array of pairs of integers that specifies the byte range used in the digest calculation. A pair consists of the starting byte offset and the length */ public void setByteRange(int[] range) { PdfArray array = new PdfArray(); for (int k = 0; k < range.length; ++k) { array.add(new PdfNumber(range[k])); } put(PdfName.ByteRange, array); }
/** * Adds a {@link PdfNamespace} to the list of the namespaces used within the document. * <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p> * * @param namespace a {@link PdfNamespace} to be added. */ public void addNamespace(PdfNamespace namespace) { getNamespacesObject().add(namespace.getPdfObject()); setModified(); }
public void addPage(PdfDictionary page) { kids.add(page); incrementCount(); page.put(PdfName.Parent, getPdfObject()); }
/** * A list of font dictionaries representing fonts that were fauxed (replaced by substitute fonts) during the * generation of trap networks for the page. * * @param fauxedFonts a {@link List} of {@link PdfFont} objects. * @return this {@link PdfTrapNetworkAnnotation} instance. */ public PdfTrapNetworkAnnotation setFauxedFonts(List<PdfFont> fauxedFonts) { PdfArray arr = new PdfArray(); for (PdfFont f : fauxedFonts) arr.add(f.getPdfObject()); return setFauxedFonts(arr); }
/** * Sets the /ByteRange. * * @param range an array of pairs of integers that specifies the byte range used in the digest calculation. A pair consists of the starting byte offset and the length */ public void setByteRange(int[] range) { PdfArray array = new PdfArray(); for (int k = 0; k < range.length; ++k) { array.add(new PdfNumber(range[k])); } put(PdfName.ByteRange, array); }
/** * Creates a visibility expression. * @param operator should be either PdfName#And, PdfName#Or, or PdfName#Not */ public PdfVisibilityExpression(PdfName operator) { super(new PdfArray()); if (operator == null || !PdfName.Or.equals(operator) && !PdfName.And.equals(operator) && !PdfName.Not.equals(operator)) throw new IllegalArgumentException("Invalid operator"); getPdfObject().add(operator); }
public PdfUserPropertiesAttributes addUserProperty(PdfUserProperty userProperty) { getPdfObject().getAsArray(PdfName.P).add(userProperty.getPdfObject()); setModified(); return this; }
private PdfStructureDestination add(PdfStructElem elem) { if (elem.getPdfObject().getIndirectReference() == null) { throw new PdfException(PdfException.StructureElementInStructureDestinationShallBeAnIndirectObject); } ((PdfArray)getPdfObject()).add(elem.getPdfObject()); return this; }
public boolean addPage(int index, PdfPage pdfPage) { if (index < from || index > from + getCount()) return false; kids.add(index - from, pdfPage.getPdfObject()); pdfPage.getPdfObject().put(PdfName.Parent, getPdfObject()); incrementCount(); setModified(); return true; }
public void addPages(PdfPages pdfPages) { kids.add(pdfPages.getPdfObject()); count.setValue(count.intValue() + pdfPages.getCount()); pdfPages.getPdfObject().put(PdfName.Parent, getPdfObject()); setModified(); }