It's easy to find the page count of a PDF document from the command line:
pdfinfo sample.pdf | grep ^Pages:
... but I haven't been able to find a similar method for odt
files and other office documents.
Is there a way to programmatically determine the page count of these documents?
Thanks for all the answers, everyone. With your help I was able to compile a list of commands that can extract the page count from almost all relevant office documents:
DOCX/PPTX
Note:
unzip
can be installed withsudo apt-get install unzip
.DOC/PPT
Note:
wvSummary
(case-sensitive!) is part of thewv
package. Install it withsudo apt-get install wv
.ODT
PDF
Note:
pdfinfo
is part ofpoppler-utils
and should come preinstalled on Ubuntu.DJVU
Note:
djvused
is part of thedjvulibre-bin
package and may be installed withsudo apt-get install djvulibre-bin
.I didn't find a way to extract
odt
file info aspdfinfo
does, but you can create a fast script to usepdfinfo
with theodt
files, converting each odt file to PDF and later deleting the converted file if you are not going to use it:Hope that this helped you.
See here for more reference.