Split PDF with script expression

Post Reply
krm
Newbie
Posts: 3
Joined: Wed Jun 03, 2020 8:12 am

Split PDF with script expression

Post by krm »

Hi,

I need a script expression that split my PDF in x pages per file.

Filename: Abcdef_Copies24.pdf

x = [Stats.NumberOfPages] / [Job.NameProper:After="Copies"]

Can someone help me with a script for this. I have never used the script expression before.

Thanks!
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Split PDF with script expression

Post by freddyp »

You do not need a script expression for that:

Code: Select all

[Switch.Calculation:Expression="[Stats.NumberOfPages] / [Job.NameProper:After="Copies"]"]
for the "Pages per file" property should do it.

However, you probably also want to make sure that the number of pages of the PDF is a multiple of the number after "Copies". Put a condition before the splitting of the PDF that checks that:

Code: Select all

[Switch.Calculation:Expression="[Stats.NumberOfPages] % [Job.NameProper:After="Copies"]"]
This calculation gives the remainder of the division of the number of pages by the value after "Copies". If the remainder is 0, you are good to go. If not, then the file is not correct.
krm
Newbie
Posts: 3
Joined: Wed Jun 03, 2020 8:12 am

Re: Split PDF with script expression

Post by krm »

Thank´s working well!
Post Reply