Filter through even or odd number of pages

Post Reply
CGXTex
Newbie
Posts: 13
Joined: Tue Jan 11, 2011 5:03 pm

Filter through even or odd number of pages

Post by CGXTex »

I know you can filter a pdf based on a specific number of pages, but how do you filter based on even or odd number of pages?
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Filter through even or odd number of pages

Post by dkelly »

Hello, you could calculate the modulo of the page count in Javascript expression.



I used a "Sort Job" element with the following JavaScript expression. The output connections need to be named "0" for even page counts and "1" for odd.



job.getVariableAsNumber("[Stats.NumberOfPages]") % 1;





Dwight Kelly

Apago, Inc.

dkelly@apago.com
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Filter through even or odd number of pages

Post by dkelly »

Small but important typo in my post. "% 1" should be "% 2".



job.getVariableAsNumber("[Stats.NumberOfPages]") % 2;
Post Reply