When the job has less than or equal to 8 pages it is never split, so the variable $FFwfJob.documentGroupCount$ is zero.
You could place a Route first that checks if the job has 8 pages or less and in that case hard code letter sets to 1 in another watermark.
I'm not familar with the Python scripting, so I use this first method you suggested, this worked pretty good however in the case when the input batch file has only 1 set of letter in it, the result shows 0 but not 1, how can I fix this?
Alternatively you can do this with a script. Please see attached. It uses Python that needs to be installed with pikepdf and reportlab (pip install from cmd as admin). Point to the batch file in an External Process in a workflow using the parameters:
"$FFin$" "$FFout$" "$FFwfJob.jobName$"
Check the paths to Python and the FreeFlow Core Scripts folder in the batch file. The Python script assumes there is a C:\Temp\ folder.
This line in the Python script controls what will be printed on the first page and where on the page it will be printed:
can.drawString(200, 450, "Number of letter sets: " + str(int(numberofpages/8)))
I have to print a PDF that contains certain number of sets of letter, each set has the same number of pages, how can I use the variables to calculate the number of sets and print the result on the first page of the pdf?
For example a pdf is dropped in the hot folder, the total number of pages is defined by the variable $FFwfDoc.pages$, that is 72 and it's already known that each set of letter contains 8 pages, so there should be 9 sets of letter, my question is how can I use the variable to calculate the result and print it on the first page of the pdf. I use a watermark node with the contents as text “Number of letter sets: $FFwfDoc.pages$/8”, but when it prints out it doesn’t show the result of 9, instead it just show the formular that I entered in the watermark node, is there a way to do as what I expected?