[Lazarus] Get the number of pages in a pdf file

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Sat Jun 15 13:56:18 CEST 2019


On 14/06/2019 6:19 pm, Rogério Martins via lazarus wrote:
> Is there a function for read info about a pdf file ?  I need to know the
> number of pages in a given pdf file.

I don't know of a Object Pascal library you can you, but there is an
alternative. The PDF fromat is a mixture of text and binary. You can
search for text as follows:

/Type /Pages
/Count 45

After the "/Type /Pages" there should be a "/Count <n>" line which
contains the page count. Hope that helps.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


More information about the lazarus mailing list