/** * Creates a new instance of PDPage for embedding. * * @param mediaBox The MediaBox of the page. */ public PDPage(PDRectangle mediaBox) { page = new COSDictionary(); page.setItem(COSName.TYPE, COSName.PAGE); page.setItem(COSName.MEDIA_BOX, mediaBox); }
/** * Constructor for embedding. */ public PDPageTree() { root = new COSDictionary(); root.setItem(COSName.TYPE, COSName.PAGES); root.setItem(COSName.KIDS, new COSArray()); root.setItem(COSName.COUNT, COSInteger.ZERO); document = null; }
/** * Sets the value of a given named resource. */ private void put(COSName kind, COSName name, COSObjectable object) { COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind); if (dict == null) { dict = new COSDictionary(); resources.setItem(kind, dict); } dict.setItem(name, object); }
/** * Add an OutputIntent to the list. If there is not OutputIntent, the list is created and the * first element added. * * @param outputIntent the OutputIntent to add. */ public void addOutputIntent(PDOutputIntent outputIntent) { COSArray array = (COSArray)root.getDictionaryObject(COSName.OUTPUT_INTENTS); if (array == null) { array = new COSArray(); root.setItem(COSName.OUTPUT_INTENTS, array); } array.add(outputIntent.getCOSObject()); }
/** * Returns the document's article threads. */ public List<PDThread> getThreads() { COSArray array = (COSArray)root.getDictionaryObject(COSName.THREADS); if (array == null) { array = new COSArray(); root.setItem(COSName.THREADS, array); } List<PDThread> pdObjects = new ArrayList<>(); for (int i = 0; i < array.size(); i++) { pdObjects.add(new PDThread((COSDictionary)array.getObject(i))); } return new COSArrayList<>(pdObjects, array); }
/** * {@inheritDoc} */ @Override public COSBase getCOSObject() { COSDictionary dict = new COSDictionary(); COSArray arr = new COSArray(); for (Entry<Integer, PDPageLabelRange> i : labels.entrySet()) { arr.add(COSInteger.get(i.getKey())); arr.add(i.getValue()); } dict.setItem(COSName.NUMS, arr); return dict; }
/** * Sets the bounding box. * * @param bbox the bounding box */ public void setBBox(PDRectangle bbox) { String name = BBOX; COSBase oldValue = this.getCOSObject().getDictionaryObject(name); this.getCOSObject().setItem(name, bbox); COSBase newValue = bbox == null ? null : bbox.getCOSObject(); this.potentiallyNotifyChanged(oldValue, newValue); }
/** * Set the highest value for the key in the map. * * @param upper The new highest value for a key in the map. */ private void setUpperLimit( String upper ) { COSArray arr = (COSArray)node.getDictionaryObject( COSName.LIMITS ); if( arr == null ) { arr = new COSArray(); arr.add( null ); arr.add( null ); node.setItem(COSName.LIMITS, arr); } arr.setString( 1, upper ); }
/** * This will set the changes along the y-axis. * * @param changeYs changes along the y-axis */ public void setChangeYs(PDNumberFormatDictionary[] changeYs) { COSArray array = new COSArray(); for (PDNumberFormatDictionary changeY : changeYs) { array.add(changeY); } this.getCOSObject().setItem("Y", array); }
/** * Constructor. */ public PDAnnotation() { dictionary = new COSDictionary(); dictionary.setItem(COSName.TYPE, COSName.ANNOT); }
/** * Sets the crypt filter with the given name. * * @param cryptFilterName the name of the crypt filter * @param cryptFilterDictionary the crypt filter to set */ public void setCryptFilterDictionary(COSName cryptFilterName, PDCryptFilterDictionary cryptFilterDictionary) { COSDictionary cfDictionary = (COSDictionary)dictionary.getDictionaryObject( COSName.CF ); if (cfDictionary == null) { cfDictionary = new COSDictionary(); dictionary.setItem(COSName.CF, cfDictionary); } cfDictionary.setItem(cryptFilterName, cryptFilterDictionary.getCOSDictionary()); }
/** * This will set the horizontal offset of the caption. * * @param offset the horizontal offset of the caption */ public final void setCaptionHorizontalOffset(float offset) { COSArray array = (COSArray) annot.getDictionaryObject(COSName.CO); if (array == null) { array = new COSArray(); array.setFloatArray(new float[] { offset, 0.f }); annot.setItem(COSName.CO, array); } else { array.set(0, new COSFloat(offset)); } }
/** * This will set start and end coordinates of the line (or leader line if LL entry is set). * * @param line array of 4 floats [x1, y1, x2, y2] line start and end points in default user space. */ public final void setLine(float[] line) { COSArray newLine = new COSArray(); newLine.setFloatArray(line); annot.setItem(COSName.L, newLine); }
/** * Constructor. * * @param doc The document that this form is part of. */ public PDAcroForm(PDDocument doc) { document = doc; dictionary = new COSDictionary(); dictionary.setItem(COSName.FIELDS, new COSArray()); }
/** * Sets a colour. * * @param name the attribute name * @param value the colour */ protected void setColor(String name, PDGamma value) { COSBase oldValue = this.getCOSObject().getDictionaryObject(name); this.getCOSObject().setItem(name, value); COSBase newValue = value == null ? null : value.getCOSObject(); this.potentiallyNotifyChanged(oldValue, newValue); }
/** * Set the lowest value for the key in the map. * * @param lower The new lowest value for a key in the map. */ private void setLowerLimit( String lower ) { COSArray arr = (COSArray)node.getDictionaryObject( COSName.LIMITS ); if( arr == null ) { arr = new COSArray(); arr.add( null ); arr.add( null ); node.setItem(COSName.LIMITS, arr); } arr.setString( 0, lower ); } }
/** * This will set the sloaps of a line. * * @param lineSloaps the sloaps of a line */ public void setLineSloaps(PDNumberFormatDictionary[] lineSloaps) { COSArray array = new COSArray(); for (PDNumberFormatDictionary lineSloap : lineSloaps) { array.add(lineSloap); } this.getCOSObject().setItem("S", array); }
/** * Default constructor. */ public PDSignature() { dictionary = new COSDictionary(); dictionary.setItem(COSName.TYPE, COSName.SIG); }