Using A360, I am struggling to merge multiple pdf documents. The exact number of documents is variable. Therefore, the activity PDF: Merge Documents is not suitable because it requires the bot developer to declare ahead of time the documents to merge. I’ve even tries the bot store PDFUtils. The “Merge all PDF files” action works, however I can’t sort which order the documents should be merged into, so the final file shows out of page order. I’ve also tried the PDFUtils: Merge PDF files but receive an error as if the package is not working correctly.
Thank you very much for any help and advice! It is greatly appreciated as this issue has stalled bot development for our use case.
Page 1 / 1
Hi Jaye,
You can try to use the Merge Documents action in a loop. Iterate through the directory containing your files that you would like merged and add an if else statement “If <merged document path> does not exist, copy the current file in the iteration to the merged doc path; else merge documents: merged doc path + current file in iteration.
Although this runs slowly, it works. Also, you would have to already have your files in the directory listed in the order that you wanted.
On another note, I saw your post as I was looking for information the PDF Utilities Merge All PDFs action. Whenever I use this, it just copies the first PDF over and over so I have a merged file of just the first PDF repeated. Have you encountered this using that action?
Thanks
@jaye check my comment here:
We solved for this by determining the max number of possible pdf files and then created a taskbot with that number of input variables to hold the names of the files. In this task bot we check for the number of files coming an and use an IF statement to determine the merge action that runs. Under each IF there is a merge action with than number of files to be merged and the input variables.
We call that taskbot from our main bot and map in the number of files and the file names (with paths) into the input variables.
It’s a nice solution and we can re-use this taskbot in all of our BOTs that need this kind of thing!
I suppose you could do a similar thing like I outlined above in a loop if you passed back the full path and name of the resulting merged file.
Pass in two files to start
Bring back the full path to the merged file in an output variable
Use that file name and the NEXT file to be merged as new input back into the taskbot
Repeat until you have looped through all files that need to be merged
Taskbot that loops through a folder of PDF files:
Main Taskbot is mapped to merge taskbot like this: