I’m not entirely sure the category this falls into as unsure of how best to process a particular job, so I will explain the job in its entirety and hopefully some big brains will come to the rescue.
We have a job that comes in regularly, the job is supplied in PDF format with approximately 15 folders with a varied number of PDF files in each.
To help explain more simply, please see an example below;
Folder 1 - Contains 1 x PDF + 1 x 2pp KFD
Folder 2 - Contains 8 x PDF + 1 x 2pp KFD
Folder 3 - Contains 5 x PDF + 1 x 2pp KFD
Folder 4 -Contains 12 x PDF + 1 x 2pp KFD
Folder 5 - Contains 9 x PDF + 1 x 2pp KFD
And so on…
Each PDF needs to have the relevant KFD to follow after each PDF (Note the KFD’s are all different, hence why they are supplied with the PDF’s in the provided folders)
Also, a barcode needs to be added to the first page of every PDF but not the KFD’s
What’s a KFD file? And by extension, what’s a “2pp KFD” file?
What’s the expected output for that job? A single PDF that’s a concatenation of all the others? Or all separate PDFs but with a barcode on the first page of each?
Hi @Phil sorry my terminology has probably confused matters.
A 2pp KFD is a 2 page PDF
The expected output is to add each KFD to each PDF that has been supplied in separate folders.
E.g Using Folder 2 as an example it would need to add the KFD from Folder 2 to each of the PDF’s from Folder 2
Folder2 - PDF1 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF2 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF3 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF4 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF5 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF6 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF7 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Folder2 - PDF8 add KFD = Combined PDF (Then a Barcode is added to first page of this)
Using Workflow, this could be done fairly easily with a script that uses the AlambicEdit API to concatenate PDFs. But it can also be achieved without any scripting, using a series of standard tasks.
The process is set to run every 60 seconds and starts with a Create File task (which is just a dummy task in this instance)
A Branch is immediately created and starts with a Folder Capture set to capture all PDFs in all subfolders of the Root directory (I set it to “'C:\Tests\Forum\KFD” on my system). Having this inside a branch ensures that the process will loop through all PDF files before exiting back to the main trunk, where we’ll perform a final cleanup.
For each captured file, the name and folder of the file are saved in local variables
The catpured file is immediately copied as-is to an output folder (named “'C:\Tests\Forum\KFD-Output” on my system)
Then a Folder Listing task looks for any file with a KFD extension in the same folder that the PDF file was picked up from
The Load External file task loads the KFD as the new data file for the rest of the branch
We temporarily rename the file with a PDF extension so the next task understands what to do with it.
We then send the file to the same output folder as before, using the same file name, and making sure to tick the “Concatenate files” option, which, with PDF files, instructs the task to concatenate all pages from the current file (i.e. the renamed KFD file) to the existing PDF file we had copied earlier.
Once all files have been processed that way, we still need to erase the KFD files, and that’s what we do back on the trunk by using a Folder Capture task, set to look for all KFD files in all subfolders of our root folder, followed by a Delete task.
Now, you have an output folder full of concatenated files that you can then pass on to OL Connect in order to add a barcode to their first page.