Fixes cairo issue #907.
In the xref table, the generation number is limited to 65535 (2^16 - 1)
and it's used to identify objects in object streams.
When generating a pdf with more than 65536 objects in object streams,
the generation number overflows and restarts at 0, which causes
invalid references in the xref table.