[luatex] epdf: <Catalog>:getDests() returns null

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sun Apr 24 21:34:17 CEST 2016


Hello,

I am currently trying to replace the Java Code of pax to Lua
to get a more portable version, which is easier to install.
Therefore, I am experimenting with the epdf library of LuaTeX

BTW, the manual has a typo:
   <Catalog>:isOK() => <Catalog>:isOk()

The main problem is getting the destinations of a PDF document:

<Catalog>:getDests() *always* returns the null object:

Test file "getdests.lua":

   filename = arg[1]
   print('filename:      ' .. filename)
   doc = epdf.open(filename)
   catalog = doc:getCatalog()
   dests = catalog:getDests()
   print('type(dests):   ' .. type(dests))
   print('getType():     ' .. dests:getType())
   print('getTypeName(): ' .. dests:getTypeName())

Running: texlua getdests.lua filetotest.pdf

filetotest.tex, generated by "luatex --ini filetotest.tex":

   \catcode`\{=1
   \catcode`\}=2
   \ifx\directlua\undefined
   \else
     \directlua{tex.enableprimitives('', tex.extraprimitives())}
   \fi
   \pdfoutput=1
   \pdfobjcompresslevel=0
   \shipout\hbox{%
     \pdfdest name{mydest} xyz\relax\vrule width 10bp height 10bp\relax
   }
   \end

filetotest.pdf contains:

   6 0 obj
   <</Names[(mydest) 4 0 R]/Limits[(mydest) (mydest)]>>
   endobj
   7 0 obj
   <</Dests 6 0 R>>
   endobj
   8 0 obj
   <</Type/Catalog/Pages 5 0 R/Names 7 0 R>>
   endobj

Why does getDests() returns the null object?
Do I have to parse the destination name tree manually to get
the destination names?

Yours sincerely
   Heiko Oberdiek


More information about the luatex mailing list