Using the current PDF page in variables?

Post Reply
JuBaz
Member
Posts: 20
Joined: Tue Dec 07, 2021 11:41 am

Using the current PDF page in variables?

Post by JuBaz »

Hi,
I've set up a Datamatrixcode which should use the current PDF page. So that if I have a PDF file which contains of for example five pages, on page one the Datamatrixcode should contain "Page 1" and on page two it should conatin "Page 2" and so on. Am I blind or is there no variable which can figure out and then use current PDF page?

Thak you and best regards!
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Using the current PDF page in variables?

Post by freddyp »

Next to the Value field in the "Add barcode" Action there is a "Variable" button that offers a set of internal variables and %Page Number% is one of them, so you specify "Page %Page Number%" as the value.

There is a limitation: you cannot combine these variables with the variables from a variable set. Is that your problem?
JuBaz
Member
Posts: 20
Joined: Tue Dec 07, 2021 11:41 am

Re: Using the current PDF page in variables?

Post by JuBaz »

Yes thats my Problem. I want to use Switch variabels to fill the Datamatrix code.
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Using the current PDF page in variables?

Post by freddyp »

It is not the nicest solution, but what you can do is split the PDF and ungroup the job. The page number is now at the end of the name proper, which means it is available in the variable [Job.NameProper:Search="\d+$"] (take the digits at the end of the name proper). You can combine this variable with other variables to create the value for the variable that will be used in the Action List. Follow up with Assemble job/Scheme - Ungrouped job/Merge PDF.
JuBaz
Member
Posts: 20
Joined: Tue Dec 07, 2021 11:41 am

Re: Using the current PDF page in variables?

Post by JuBaz »

Thanks for that tip, was a little bit tricky but now it works. Theres just one more problem, I need the page number as a two digit number, so it shouldn't be 1 but 01 ans so on. Because I have to make a calculation (to get the sheet number and not only the page number) I don't know how to solve this. Any ideas?
At the moment the variable looks like this

[Switch.Calculation:Expression="round([Job.NameProper:Search="\d+$"]/2)"]
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Using the current PDF page in variables?

Post by freddyp »

Is it not conceptually better to split the file in groups of 2 pages? If so, use the "Split PDF pages" app. This one has support for naming the files based on the group number as well as on the page number (see the documentation). Splitting in groups of 2 then means that the first 2 pages are called _01 (or _001) at the end, pages 3 and 4 _02, etc. You can then use those digits without a Switch.Calculation and the leading zeroes will not disappear.
JuBaz
Member
Posts: 20
Joined: Tue Dec 07, 2021 11:41 am

Re: Using the current PDF page in variables?

Post by JuBaz »

Yes thats better, works now. Thanks for your support!
rgpepper
Member
Posts: 80
Joined: Wed Oct 14, 2015 2:09 am

Re: Using the current PDF page in variables?

Post by rgpepper »

freddyp wrote: Mon Oct 17, 2022 6:14 pm Next to the Value field in the "Add barcode" Action there is a "Variable" button that offers a set of internal variables and %Page Number% is one of them, so you specify "Page %Page Number%" as the value.

There is a limitation: you cannot combine these variables with the variables from a variable set. Is that your problem?
And you can't combine a data set variable *and* static text either, which is what I hoped I could do. LAME.
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Using the current PDF page in variables?

Post by freddyp »

In PitStop you cannot combine a variable with static text but when defining the value of the variable in Switch you can combine any Switch variable with static text, so it is possible.
rgpepper
Member
Posts: 80
Joined: Wed Oct 14, 2015 2:09 am

Re: Using the current PDF page in variables?

Post by rgpepper »

True, thanks for that.
Post Reply