COS Object Model

COS Layer

The COS (Carousel Object System) layer represents the raw PDF object model as defined in ISO 32000-1:2008, §7.3. All high-level PDF structures are built on these primitives.

Core Types

ClassPDF type
COSDictionaryDictionary (<< >>)
COSArrayArray ([ ])
COSStreamStream with dictionary header
COSNameName object (/Name)
COSStringString (literal or hex)
COSIntegerInteger
COSBooleanBoolean

COSDictionary

COSDictionary maps COSName keys to COS values. Use set(name, value) to add entries and get(name) to retrieve them:

COSDictionary dict = new COSDictionary();
dict.set(COSName.of("Author"), new COSString("Jane Smith"));
COSString author = (COSString) dict.get(COSName.of("Author"));

COSArray

COSArray holds an ordered list of COS objects:

COSArray array = new COSArray();
array.add(COSInteger.valueOf(1));
array.add(COSInteger.valueOf(2));
int len = array.size(); // 2

Accessing the Document Catalog

The PDF catalog is accessible via Document.getCatalog(), which returns a COSDictionary representing the root catalog object.

See Also