'Can a name object be an indirect reference in a PDF file?
According to the PDF 1.7 (ISO32000-1:2008) specification, a PDF file is composed of eight basic types of objects: Boolean values, Integer and Real numbers, Strings, Names, Arrays, Dictionaries, Streams, and the null object.
Additionally, an object can be labeled and referenced as an indirect object. In the specification, they give the following example:
7 0 obj
<< /Length 8 0 R >> % An indirect reference to object 8
stream
BT
/F1 12 Tf
72 712 Td
( A stream with an indirect length ) Tj
ET
endstream
endobj
8 0 obj
77 % The length of the preceding stream
endobj
Of course, this is an obvious example, the PDF dictionary object is composed of a Name (Key) and a value, which can be an indirect reference. What I'm wondering is if the name itself can be an indirect reference, for example:
1 0 obj
/Length
endobj
2 0 obj
<< 1 0 R 77 >>
...
endobj
In this case, the name itself is an indirect reference.
Solution 1:[1]
For pdf dictionary objects the keys are always direct pdf name objects.
Solution 2:[2]
Although ISO 32000-1:2008 section 7.3.10 specified that "except were documented to the contrary any object value may be a direct or an indirect reference; the semantics are equivalent", and name objects are not generally "documented to the contrary" by the specification, they nevertheless seem de-facto to be required to be direct objects.
At least Adobe Acrobat Reader doesn't accept indirect references for dictionary keys, and also not for other name objects. If, for example, you take the "Simple Text String Example" from section H.3 of the spec and replace either the /MediaBox
name or /Helvetica
by an indirect reference to an additional indirect object containing the respective name (and also adjust the xref section and all file offsets appropriately), then the resulting PDF file doesn't render accordingly anymore.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | jht |
Solution 2 | nmatt |