Page 1 of 1
Using the current PDF page in variables?
Posted: Mon Oct 17, 2022 4:33 pm
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!
Re: Using the current PDF page in variables?
Posted: Mon Oct 17, 2022 6:14 pm
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?
Re: Using the current PDF page in variables?
Posted: Fri Oct 21, 2022 9:48 am
by JuBaz
Yes thats my Problem. I want to use Switch variabels to fill the Datamatrix code.
Re: Using the current PDF page in variables?
Posted: Fri Oct 21, 2022 10:02 am
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.
Re: Using the current PDF page in variables?
Posted: Tue Oct 25, 2022 12:30 pm
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)"]
Re: Using the current PDF page in variables?
Posted: Tue Oct 25, 2022 2:52 pm
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.
Re: Using the current PDF page in variables?
Posted: Fri Oct 28, 2022 12:50 pm
by JuBaz
Yes thats better, works now. Thanks for your support!
Re: Using the current PDF page in variables?
Posted: Thu Jan 04, 2024 9:43 pm
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.
Re: Using the current PDF page in variables?
Posted: Mon Jan 08, 2024 12:13 pm
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.
Re: Using the current PDF page in variables?
Posted: Thu Jan 11, 2024 11:33 pm
by rgpepper
True, thanks for that.