Combine PDF Activity - Order of Documents

I am currently using the Combine PDF activity to enumerate through a network folder and combine all PDF’s inside the folder to a single PDF document, the activity is working fine however the order of the documents is something I haven’t been able to figure out.

The number of documents varies but is usually between 15 and 50, they are the same types of documents each time the process runs (I’m generating reports from multiple different web applications so its the same group/type of documents for each run) and it seems to be combining them in roughly the same order (some types move around in the ordering, for instance Document X might be the 5th document in one PDF and the 9th in another).

I can’t figure out how it is combining them though, they need to be in a specific order and there is not a discernable pattern I can find.

I have named the documents using multiple numbering systems (starting at 1. starting at 100. and starting with A.) and it has not had a noticeable impact in the way they are combined.

I was under the impression that since we are creating a list by enumerating through the file that it would be in a specific order(namely the order that they are listed in within the folder), is that not correct?

Has anyone had any experience with this or does anyone know exactly how they are combined?

Thanks!

Hy @mgeatches,

I recommend you to do the following:

  • Loop through the files in the folder using a ‘for each’ loop, use the Directory.GetFiles() to get all the files
  • Add the file names to a Data Table. Use the Path.GetFileName(item) to extract the file name
  • Sort the Data Table
  • Use the Combine PDF Activity combined with a ‘for each data row’ from this PDF names data table.

If you have any questions please let me know

Regards

1 Like

I’ll give that a shot, the process is curently doing all that minus the sort but that might be the ticket. Thanks!

1 Like

Hy @mgeatches, glad I could help

Please let me know if it worked

Adding the files to a data table to sort is working fine but I’m having an issue getting them back into a string array once sorted. Any tips for that? @William_Blech_Sister