/** * Checks if this <CODE>PdfObject</CODE> is of the type * <CODE>PdfDictionary</CODE>. * * @return <CODE>true</CODE> or <CODE>false</CODE> */ public boolean isDictionary() { return getType() == DICTIONARY; }
/** * Checks if this <CODE>PdfObject</CODE> is of the type * <CODE>PdfStream</CODE>. * * @return <CODE>true</CODE> or <CODE>false</CODE> */ public boolean isStream() { return getType() == STREAM; }
/** * Checks if this <CODE>PdfObject</CODE> is of the type * <CODE>PdfNumber</CODE>. * * @return <CODE>true</CODE> or <CODE>false</CODE> */ public boolean isNumber() { return getType() == NUMBER; }
/** * Checks if this <CODE>PdfObject</CODE> is of the type * <CODE>PdfLiteral</CODE>. * * @return <CODE>true</CODE> if this is a literal, * otherwise <CODE>false</CODE> */ public boolean isLiteral() { return getType() == LITERAL; }
/** * 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; }
/** * Returns the element at the specified index as a PdfName. If the element isn't a PdfName, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfName */ public PdfName getAsName(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.NAME) return (PdfName) direct; return null; }
/** * Returns the element at the specified index as a PdfBoolean. If the element isn't a PdfBoolean, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfBoolean */ public PdfBoolean getAsBoolean(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.BOOLEAN) return (PdfBoolean) direct; return null; }
/** * 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; }
/** * Returns the element at the specified index as a PdfArray. If the element isn't a PdfArray, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfArray */ public PdfArray getAsArray(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.ARRAY) return (PdfArray) direct; return null; }
/** * Returns the element at the specified index as a PdfStream. If the element isn't a PdfStream, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfStream */ public PdfStream getAsStream(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.STREAM) return (PdfStream) direct; return null; }
/** * Returns the value associated to this key as a PdfName. If the value isn't a PdfName, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfName associated with this key */ public PdfName getAsName(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.NAME) return (PdfName)direct; return null; }
/** * Returns the element at the specified index as a PdfDictionary. If the element isn't a PdfDictionary, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfDictionary */ public PdfDictionary getAsDictionary(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.DICTIONARY) return (PdfDictionary) direct; return null; }
/** * Returns the element at the specified index as a PdfString. If the element isn't a PdfString, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfString */ public PdfString getAsString(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.STRING) return (PdfString) direct; return null; }
/** * Returns the value associated to this key as a PdfNumber. If the value isn't a PdfNumber, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfNumber associated with this key */ public PdfNumber getAsNumber(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.NUMBER) return (PdfNumber)direct; return null; }
/** * Returns the value associated to this key as a PdfBoolean. If the value isn't a PdfBoolean, null is returned. * * @param key the key of which the associated value needs to be returned * @return PdfBoolean associated with this key */ public PdfBoolean getAsBoolean(PdfName key) { PdfObject direct = get(key, true); if (direct != null && direct.getType() == PdfObject.BOOLEAN) return (PdfBoolean)direct; return null; }
/** * Returns the element at the specified index as a PdfNumber. If the element isn't a PdfNumber, null is returned. * * @param index position of the element to be returned * @return the element at the index as a PdfNumber */ public PdfNumber getAsNumber(int index) { PdfObject direct = get(index, true); if (direct != null && direct.getType() == PdfObject.NUMBER) return (PdfNumber) direct; return null; }
/** * 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; }
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; }
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; }