private PdfObject getValueFromAppearance(PdfObject appearanceDict, PdfName key) { if (appearanceDict instanceof PdfDictionary) { return ((PdfDictionary)appearanceDict).get(key); } return null; }
private static String getOrdering(PdfDictionary cidFont) { PdfDictionary cidinfo = cidFont.getAsDictionary(PdfName.CIDSystemInfo); if (cidinfo == null) return null; return cidinfo.containsKey(PdfName.Ordering) ? cidinfo.get(PdfName.Ordering).toString() : null; }
/** * Returns the value associated to this key. * * @param key the key of which the associated value needs to be returned * @return the value associated with this key */ public PdfObject get(PdfName key) { return get(key, true); }
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; }
/** * Gets the color space in which colour values shall be expressed. * * @return {@link PdfObject} Color space */ public PdfObject getColorSpace() { return getPdfObject().get(PdfName.ColorSpace); }
/** * Gets the current value contained in the form field. * * @return the current value, as a {@link PdfObject} */ public PdfObject getValue() { return getPdfObject().get(PdfName.V); }
/** * Returns the value associated to this key as a PdfDictionary. If the value isn't a PdfDictionary, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfDictionary associated with this key */ public PdfDictionary getAsDictionary(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.DICTIONARY) return (PdfDictionary)direct; return null; }
/** * Returns the value associated to this key as a PdfStream. If the value isn't a PdfStream, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfStream associated with this key */ public PdfStream getAsStream(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.STREAM) return (PdfStream)direct; return null; }
/** * Gets the black-generation function value or {@code Default}, {@code BG2} key. * * @return a {@link PdfObject} value, should be either {@link PdfFunction} or {@link PdfName}. */ public PdfObject getBlackGenerationFunction2() { return getPdfObject().get(PdfName.BG2); }
/** * Gets the current value contained in the form field. * * @return the current value, as a {@link PdfObject} */ public PdfObject getValue() { return getPdfObject().get(PdfName.V); }
/** * Gets the default fallback value for the form field. * * @return the default value */ public PdfObject getDefaultValue() { return getPdfObject().get(PdfName.DV); }
/** * Returns the value associated to this key as a PdfArray. If the value isn't a PdfArray, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfArray associated with this key */ public PdfArray getAsArray(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.ARRAY) return (PdfArray)direct; return null; }
/** * Gets the function PdfObject that represents color transitions * across the shading geometry. * * @return {@link PdfObject} Function */ public PdfObject getFunction() { return getPdfObject().get(PdfName.Function); }
/** * Gets the <code>XFA</code> property on the AcroForm. * * @return an object representing the entire XDP. It can either be a * {@link PdfStream} or a {@link PdfArray}. */ public PdfObject getXFAResource() { return getPdfObject().get(PdfName.XFA); }
/** * Returns the value associated to this key as a PdfString. If the value isn't a PdfString, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfString associated with this key */ public PdfString getAsString(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.STRING) return (PdfString)direct; return null; }
/** * Gets the transfer function value, {@code TR} key. * * @return a {@link PdfObject}, should be either {@link PdfFunction}, * {@link PdfArray} or {@link PdfName}. */ public PdfObject getTransferFunction() { return getPdfObject().get(PdfName.TR); }
/** * Gets the transfer function value or {@code Default}, {@code TR2} key. * * @return a {@link PdfObject}, should be either {@link PdfFunction}, * {@link PdfArray} or {@link PdfName}. */ public PdfObject getTransferFunction2() { return getPdfObject().get(PdfName.TR2); }
/** * This method merges different fields from two dictionaries into the current one * @param other a dictionary whose fields should be merged into the current dictionary. */ public void mergeDifferent(PdfDictionary other){ for (PdfName key : other.keySet()){ if(!containsKey(key)) put(key, other.get(key)); } }
PdfTrueTypeFont(PdfDictionary fontDictionary) { super(fontDictionary); newFont = false; fontEncoding = DocFontEncoding.createDocFontEncoding(fontDictionary.get(PdfName.Encoding), toUnicode); fontProgram = DocTrueTypeFont.createFontProgram(fontDictionary, fontEncoding, toUnicode); embedded = ((IDocFontProgram) fontProgram).getFontFile() != null; subset = false; }
private boolean ensureElementPageEqualsKidPage(PdfStructElem elem, PdfDictionary kidPage) { PdfObject pageObject = elem.getPdfObject().get(PdfName.Pg); if (pageObject == null) { pageObject = kidPage; elem.getPdfObject().put(PdfName.Pg, kidPage); elem.setModified(); } return kidPage.equals(pageObject); }