/** * Create a new PdfArray filled with the values in the double[] as {@link com.itextpdf.kernel.pdf.PdfNumber}. * * @param numbers values to be added to this PdfArray */ public PdfArray(double[] numbers) { list = new ArrayList<>(numbers.length); for (double f : numbers) { list.add(new PdfNumber(f)); } }
/** * Create a new PdfArray filled with the values in the int[] as {@link com.itextpdf.kernel.pdf.PdfNumber}. * * @param numbers values to be added to this PdfArray */ public PdfArray(int[] numbers) { list = new ArrayList<>(numbers.length); for (float i : numbers) { list.add(new PdfNumber(i)); } }
/** * A code specifying the form of quadding (justification) that is used in displaying the annotation's text: * 0 - Left-justified, 1 - Centered, 2 - Right-justified. Default value: 0 (left-justified). * @param justification a code specifying the form of quadding (justification). * @return this {@link PdfFreeTextAnnotation} instance. */ public PdfFreeTextAnnotation setJustification(int justification) { return (PdfFreeTextAnnotation) put(PdfName.Q, new PdfNumber(justification)); }
/** * PDF 2.0. When regenerating the annotation's appearance stream, this is the * opacity value that shall be used for stroking all visible * elements of the annotation in its closed state, including its background and border, but * not the popup window that appears when the annotation is opened. * * @param strokingOpacity opacity for stroking operations, including background and border * @return this {@link PdfAnnotation} object */ public PdfAnnotation setStrokingOpacity(float strokingOpacity) { return put(PdfName.CA, new PdfNumber(strokingOpacity)); }
/** * Sets the length of leader line extensions that extend from the line proper 180 degrees from the leader lines. * <b>This value shall not be set unless {@link PdfName#LL} is set.</b> * @param leaderLineExtension a non-negative float that represents the length of leader line extensions. * @return this {@link PdfLineAnnotation} instance. */ public PdfLineAnnotation setLeaderLineExtension(float leaderLineExtension) { return (PdfLineAnnotation) put(PdfName.LLE, new PdfNumber(leaderLineExtension)); }
/** * Sets the length of the leader line offset, which is the amount of empty space between the endpoints of the * annotation and the beginning of the leader lines. * @param leaderLineOffset a non-negative number that represents the length of the leader line offset. * @return this {@link PdfLineAnnotation} instance. */ public PdfLineAnnotation setLeaderLineOffset(float leaderLineOffset) { return (PdfLineAnnotation) put(PdfName.LLO, new PdfNumber(leaderLineOffset)); }
/** * Sets a flag, or combination of flags, for the form field. This method * <em>replaces</em> the previous value. Compare with {@link #setFieldFlag(int)} * which <em>adds</em> a flag to the existing flags. * * @param flags an <code>int</code> interpreted as a series of a binary flags * @return the edited field */ public PdfFormField setFieldFlags(int flags) { return put(PdfName.Ff, new PdfNumber(flags)); }
/** * This method sets the number of copies that shall be printed when the print dialog is opened for this file. * @param numCopies */ public PdfViewerPreferences setNumCopies(int numCopies) { return put(PdfName.NumCopies, new PdfNumber(numCopies)); }
/** * Sets the page rotation. * * @param degAngle the {@code int} number of degrees by which the page shall be rotated clockwise * when displayed or printed. Shall be a multiple of 90. * @return this {@link PdfPage} instance. */ public PdfPage setRotation(int degAngle) { put(PdfName.Rotate, new PdfNumber(degAngle)); return this; }
/** * Creates a new target object pointing to a file attachment annotation. * * @param pageNumber the number of the page in the current document, one-based * @param annotationIndex the index of the annotation in the Annots entry of the page, zero-based * @return created object */ public static PdfTarget createChildTarget(int pageNumber, int annotationIndex) { return PdfTarget.create(PdfName.C). put(PdfName.P, new PdfNumber(pageNumber - 1)). put(PdfName.A, new PdfNumber(annotationIndex)); }
/** * Sets the number of bits used to represent each colour component. * * @param bitsPerComponent the number of bits to be set. Shall be 1, 2, 4, 8, 12, or 16. */ public void setBitsPerComponent(int bitsPerComponent) { getPdfObject().put(PdfName.BitsPerComponent, new PdfNumber(bitsPerComponent)); setModified(); }
/** * Sets the number of bits used to represent each colour component. * * @param bitsPerComponent the number of bits to be set. Shall be 1, 2, 4, 8, 12, or 16. */ public void setBitsPerComponent(int bitsPerComponent) { getPdfObject().put(PdfName.BitsPerComponent, new PdfNumber(bitsPerComponent)); setModified(); }
/** * Sets the paint type. * * @param colored if {@code true} then the paint type will be set as {@link PaintType#COLORED}, * and {@link PaintType#UNCOLORED} otherwise. */ public void setColored(boolean colored) { getPdfObject().put(PdfName.PaintType, new PdfNumber(colored ? PaintType.COLORED : PaintType.UNCOLORED)); setModified(); }
/** * 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); }
protected PdfShading(PdfDictionary pdfObject, int type, PdfColorSpace colorSpace) { super(pdfObject); getPdfObject().put(PdfName.ShadingType, new PdfNumber(type)); if (colorSpace instanceof PdfSpecialCs.Pattern) { throw new IllegalArgumentException("colorSpace"); } getPdfObject().put(PdfName.ColorSpace, colorSpace.getPdfObject()); }
public PdfStructureAttributes addIntAttribute(String attributeName, int attributeValue) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); getPdfObject().put(name, new PdfNumber(attributeValue)); setModified(); return this; }
private PdfObjectStream(PdfDocument doc, java.io.OutputStream outputStream) { super(outputStream); //avoid reuse existed references, create new, opposite to get next reference makeIndirect(doc, doc.getXref().createNewIndirectReference(doc)); getOutputStream().document = doc; put(PdfName.Type, PdfName.ObjStm); put(PdfName.N, size); put(PdfName.First, new PdfNumber(0)); }
public PdfObjRef(PdfAnnotation annot, PdfStructElem parent, int nextStructParentIndex) { super(new PdfDictionary(), parent); annot.getPdfObject().put(PdfName.StructParent, new PdfNumber(nextStructParentIndex)); annot.setModified(); PdfDictionary dict = (PdfDictionary) getPdfObject(); dict.put(PdfName.Type, PdfName.OBJR); dict.put(PdfName.Obj, annot.getPdfObject()); }
public Shading(com.itextpdf.kernel.pdf.colorspace.PdfShading shading) { super(new PdfDictionary()); getPdfObject().put(PdfName.Type, PdfName.Pattern); getPdfObject().put(PdfName.PatternType, new PdfNumber(2)); getPdfObject().put(PdfName.Shading, shading.getPdfObject()); }