Split PDF with script expression

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

Split PDF with script expression

Post by krm » Mon Oct 26, 2020 2:25 pm

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: 609
Joined: Thu Feb 09, 2012 3:53 pm

Re: Split PDF with script expression

Post by freddyp » Mon Oct 26, 2020 3:24 pm

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: 2
Joined: Wed Jun 03, 2020 8:12 am

Re: Split PDF with script expression

Post by krm » Tue Oct 27, 2020 11:01 am

Thank´s working well!

Post Reply