Search in sources :

Example 66 with COSBase

use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.

the class PDFourColours method setColourByIndex.

/**
 * Sets the colour by edge index.
 *
 * @param index the edge index
 * @param colour the colour
 */
private void setColourByIndex(int index, PDGamma colour) {
    COSBase base;
    if (colour == null) {
        base = COSNull.NULL;
    } else {
        base = colour.getCOSArray();
    }
    this.array.set(index, base);
}
Also used : COSBase(com.tom_roush.pdfbox.cos.COSBase)

Example 67 with COSBase

use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.

the class PDStandardAttributeObject method setFourColors.

/**
 * Sets four colours.
 *
 * @param name the attribute name
 * @param value the four colours
 */
protected void setFourColors(String name, PDFourColours value) {
    COSBase oldValue = this.getCOSObject().getDictionaryObject(name);
    this.getCOSObject().setItem(name, value);
    COSBase newValue = value == null ? null : value.getCOSObject();
    this.potentiallyNotifyChanged(oldValue, newValue);
}
Also used : COSBase(com.tom_roush.pdfbox.cos.COSBase)

Example 68 with COSBase

use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.

the class PDStandardAttributeObject method setNumber.

/**
 * Sets a float number.
 *
 * @param name the attribute name
 * @param value the float number
 */
protected void setNumber(String name, float value) {
    COSBase oldBase = this.getCOSObject().getDictionaryObject(name);
    this.getCOSObject().setFloat(name, value);
    COSBase newBase = this.getCOSObject().getDictionaryObject(name);
    this.potentiallyNotifyChanged(oldBase, newBase);
}
Also used : COSBase(com.tom_roush.pdfbox.cos.COSBase)

Example 69 with COSBase

use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.

the class PDStandardAttributeObject method getArrayOfString.

/**
 * Gets an array of strings.
 *
 * @param name the attribute name
 * @return the array of strings
 */
protected String[] getArrayOfString(String name) {
    COSBase v = this.getCOSObject().getDictionaryObject(name);
    if (v instanceof COSArray) {
        COSArray array = (COSArray) v;
        String[] strings = new String[array.size()];
        for (int i = 0; i < array.size(); i++) {
            strings[i] = ((COSName) array.getObject(i)).getName();
        }
        return strings;
    }
    return null;
}
Also used : COSArray(com.tom_roush.pdfbox.cos.COSArray) COSBase(com.tom_roush.pdfbox.cos.COSBase) COSString(com.tom_roush.pdfbox.cos.COSString)

Example 70 with COSBase

use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.

the class PDStandardAttributeObject method setName.

/**
 * Sets a name value.
 *
 * @param name the attribute name
 * @param value the name value
 */
protected void setName(String name, String value) {
    COSBase oldBase = this.getCOSObject().getDictionaryObject(name);
    this.getCOSObject().setName(name, value);
    COSBase newBase = this.getCOSObject().getDictionaryObject(name);
    this.potentiallyNotifyChanged(oldBase, newBase);
}
Also used : COSBase(com.tom_roush.pdfbox.cos.COSBase)

Aggregations

COSBase (com.tom_roush.pdfbox.cos.COSBase)215 COSArray (com.tom_roush.pdfbox.cos.COSArray)108 COSDictionary (com.tom_roush.pdfbox.cos.COSDictionary)68 COSName (com.tom_roush.pdfbox.cos.COSName)50 COSObject (com.tom_roush.pdfbox.cos.COSObject)42 IOException (java.io.IOException)34 COSString (com.tom_roush.pdfbox.cos.COSString)33 COSNumber (com.tom_roush.pdfbox.cos.COSNumber)29 ArrayList (java.util.ArrayList)29 COSStream (com.tom_roush.pdfbox.cos.COSStream)20 COSArrayList (com.tom_roush.pdfbox.pdmodel.common.COSArrayList)14 MissingOperandException (com.tom_roush.pdfbox.contentstream.operator.MissingOperandException)11 HashMap (java.util.HashMap)11 COSInteger (com.tom_roush.pdfbox.cos.COSInteger)10 Map (java.util.Map)10 List (java.util.List)9 Operator (com.tom_roush.pdfbox.contentstream.operator.Operator)8 COSFloat (com.tom_roush.pdfbox.cos.COSFloat)7 COSObjectKey (com.tom_roush.pdfbox.cos.COSObjectKey)7 PDFStreamParser (com.tom_roush.pdfbox.pdfparser.PDFStreamParser)6