How PDF Objects and References work
masterA PDF document is composed of various objects (Page objects, Root objects, Content objects, etc.).
Object Identification: Objects are identified by an object ID and a generation.
- Object ID: A unique number for the object.
- Generation: A value used to differentiate between different objects that happen to reuse the same ID (after an old object was freed). The generation increments every time an ID is reused.
Referencing Objects:
To reference an object, use the format [object ID] [generation] R. For example, to reference an object with ID 3 and generation 0, you write 3 0 R.
3 0 obj
...
endobj
// Reference example:
3 0 R