Count of Pages in PDF

Post Reply
User avatar
foxpalace
Member
Posts: 33
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Count of Pages in PDF

Post by foxpalace »

Hi,
I think I am stupid, but how do I count the Pages of an PDF?
- mdls won't work - a) via spotlight via launchctl deactivatet b) the flow is too fast
- I tried exiftool, but

Code: Select all

	var getPages = ("/usr/bin/perl /usr/local/Cellar/exiftool/10.55/bin/exiftool -\"*Count\" " + OrigFile);
	s.log(1, "getPages: " + getPages);
	var doIt = Process.execute(getPages);
	s.log(1, "doIt: " + Process.stdout);
	var myOut = Process.stdout;
	s.log(1, "myOut: " + myOut);
doIt is empty - ok, I have to use there Switch 12 update 3 - mybe a bug there? If i paste getPages in Terminal I get my output, but in Switch is empty.
Is there a simple way to get the pagecount of my pdf?
r.zegwaard
Member
Posts: 93
Joined: Fri Jul 08, 2011 10:31 am
Location: The Netherlands

Re: Count of Pages in PDF

Post by r.zegwaard »

Hi foxpalace,

You can do it like this using the FileStatistics

Code: Select all

fs = new FileStatistics(job.getPath());
n = fs.getNumber('NumberOfPages');
s.log(-1,n);
User avatar
foxpalace
Member
Posts: 33
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Re: Count of Pages in PDF

Post by foxpalace »

Hi Zegwaard,

great - works like a charm :)
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Count of Pages in PDF

Post by Arthur »

May I kindly ask a small bit, as a newbie ?
How do I actually use / trigger the Filestatistics ? Am I right in thinking - this requires Scripting Module solely and cannot be used without it ?
I would be very much interested in this functionality, but have no scripting module ...
jan_suhr
Advanced member
Posts: 591
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Count of Pages in PDF

Post by jan_suhr »

You can get the number of pages as a variable in the Stats set.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
Post Reply