Page 1 of 1

Split PDF with script expression

Posted: Mon Oct 26, 2020 2:25 pm
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!

Re: Split PDF with script expression

Posted: Mon Oct 26, 2020 3:24 pm
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.

Re: Split PDF with script expression

Posted: Tue Oct 27, 2020 11:01 am
by krm
ThankĀ“s working well!