[reportlab-users] Count pages in PDF?
Jerome Alet
reportlab-users@reportlab.com
Wed, 17 Mar 2004 22:46:32 +0100
On Wed, Mar 17, 2004 at 04:20:36PM -0500, Hancock, David (DHANCOCK) wrote:
> Great solution! When I tried it, though, I discovered that (with my version
> of GhostScript, at least), I need to tell pd2ps to send its output to
> stdout:
Sorry for this, I just looked at the manpage :
pdf2ps [ options ] input.pdf [ output.ps ]
and misunderstood what no output file would do : it creates
a .ps file named from input.pdf
> pdf2ps -sOutputFile=- test.pdf | grep -c "%%Page: "
>
> That was the easy part. Remembering and trying pdf2ps was beyond me until
> this posting; THANKS!
Beware of n-up documents ! Not sure result is correct.
psselect is often used too, but the CPU intensive part is the pdf to
ps conversion anyway.
<plug mode="shameless">
And while we are at counting pages, if any of you ever needs a GPLed
hardware and software print quota and accounting solution written in
Python, please look there :
http://www.librelogiciel.com/software/PyKota/action_Presentation
</plug>
bye
Jerome Alet