Page 1 of 1
page count of a pdf file
Posted: 2006-11-02T20:14:52-07:00
by sonusdream
i was wondering if there is a way to check for the number of pages of a pdf file without extracting the pages and counting the number of jpg files it generated.
thanks in advance
regards,
sonus
Posted: 2006-11-02T20:40:31-07:00
by magick
To get the number of pages in a PDF document, use this command:
- identify -format %n image.pdf
Re: page count of a pdf file
Posted: 2019-01-15T09:36:47-07:00
by ddodson001
I just tried this and was happy to see the number of pages, however, it was a repeating string of the number of pages.
Code: Select all
$ identify -format %n test.pdf
16161616161616161616161616161616
Any idea how I get this to return just '16'?
Thank you,
David
Re: page count of a pdf file
Posted: 2019-01-15T09:41:44-07:00
by bratpit
pdfinfo sample.pdf | grep -a Pages | cut -d : -f 2
Re: page count of a pdf file
Posted: 2019-01-15T10:13:35-07:00
by snibgo
Or:
Code: Select all
identify -format %n\n in.pdf |head -n1
Re: page count of a pdf file
Posted: 2019-01-15T12:40:02-07:00
by GeeMack
ddodson001 wrote: ↑2019-01-15T09:36:47-07:00Any idea how I get this to return just '16'?
Try something like this...
Code: Select all
convert document.pdf -set option:totpages %[n] -delete 1--1 -format "%[totpages]\n" info: