# [NTG-context] Page count of PDF file from lua

Marco netuse at lavabit.com
Sun Feb 19 14:50:15 CET 2012

I can't figure out how to determine the number of pages of a PDF
file within lua. From the TeX side it works with
\getfiguredimensions

Can somebody give me a nudge in the right direction? Example:

\starttext

% Works
%\getfiguredimensions [somefile.pdf]

\startluacode
-- Does not work
context.getfiguredimensions({"somefile.pdf"})

local numpages = figures.get("used", "pages", 0)
context(numpages)
\stopluacode

\stoptext

Marco