Skip to main content

Hi All,

 

I have a dictionary variable with a pdf name as key and some other pdf names as a string values separated by coma ( , ), now i want to merge those documents ( Key and the all the files name in value ) in a single pdf file with the name of the key. But I can’t find any activity to do so.

 

This is the Dictionary variable structure 


 

Check this out from our Bot Store:

https://botstore.automationanywhere.com/bot/merge-multiple-pdf-documents-into-single-document

There are others, too, so check them out.


You can use the String: Split action to extract all the file names in the dictionary value and save them as a list.

Then, you can use make a copy of the first item in the newly generated list, which is located at index 0, and give the copy the name of the dictionary key.
Note: Don't forget to add '.pdf’ to the dictionary key.

Next, iterate over each one of the values in the list from index 1 to index List:size -1.

  • The loop must start from index 1 to skip the first item in the list because that's the file that will be copied and used as the base.
  • The size of the list minus 1 is equal to the last index of the list.

Finally, use the PDF: Merge documents action as shown in the following image:

You can find the source code of the bot shown in the image in the next link: 
A360-Merge_PDFs_from_dictionary.json - GitHub Gist
You can use this extension to import the source code to a task bot: 
Bot Assistant - Chrome Web Store (google.com)


I suggest using this bot store package. 

https://botstore.automationanywhere.com/bot/pdf-utilities-package then use this action: 

  • Merge all PDF files in a directory
     

     


@AryanGuru did any of the above suggestions help? Please mark as best answer if they did! 


Reply