Reference to Indirect text/string object from within a text stream

24 Views Asked by At

Even though i'm relatively "rookie" in pdf's "from-the-scratch" composing, i already reached decent results. One thing i wasn't able to achieve is finding the correct syntax to refer to an indirect string/ascii object from within a text stream. In the following example i tried to refer to obj n. 13 from within the text stream of the obj n. 12

11 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources 5 0 R
/Contents 12 0 R
/Rotate 0
>>
endobj

12 0 obj
<<
/Length 14 0 R
>>
stream
BT
0 0 0 rg
/STANDARD 5 Tf
1 0 0 1 5 5 Tm
(page: 1) Tj 
<<13 0 R>> Tj % i tried every possible syntax combinations but i'm missing something for sure
ET
endstream
endobj

13 0 obj % string (ascii) indirect object to be called from above
( of 14)
endobj`

I tried every possible syntax combinations but i'm missing something for sure

What am i missing? Thanks in advance

1

There are 1 best solutions below

0
mkl On

This simply is not possible.

You want to refer to an indirect PDF object in an operand in a content stream. But according to the PDF spec:

An operand is a direct object belonging to any of the basic PDF data types except a stream. Dictionaries shall be permitted as operands only by certain specific operators. Indirect objects and object references shall not be permitted at all.

(ISO 32000-2, section 7.8.2 "Content streams")

The only way to refer to objects defined outside the content stream itself, is by name to a resource, and that way is only allowed for specific operators and object types, in particular never for text drawing instructions and string objects.