[luatex] [EXT] Iteration over the dictionary of a stream

Hans Hagen j.hagen at xs4all.nl
Wed Mar 31 18:52:28 CEST 2021


On 3/31/2021 5:41 PM, Andreas Matthias wrote:
> On Wed, Mar 31, 2021 at 5:10 PM Philip Taylor <P.Taylor at rhul.ac.uk> wrote:
>>
>>     for k, v in pairs (pdfe.dictionarytotable (doc.Pages [1])) do
> 
> Here, you are iterating over a /Page dictionary (doc.Pages[1]), which
> is a real dictionary.
> No issues when iterating over real dictionaries with pdfe.dictionarytotable().
> 
> But the /Contents entry of this dictionary refers to a stream. And the
> first part of
> a stream object is a dictionary. But you cannot use pdfe.dictionarytotable() in
> this case.
    local doc = pdfe.open ('h.pdf')
    local page = doc.Pages[1]
    local a = pdfe.dictionarytotable(page)
    print("page",a)
    local b = a.Contents
    print("contents",b[1],b[2],b[3])
    local c, d, e = pdfe.getfromreference(b[2])
    print("stream",c,d,e)
    local f = pdfe.dictionarytotable(e)
    print("whatever",f)

a stream object is a referenced object with a stream and a dictionary

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the luatex mailing list.