Сreate PDF from multiple files arranged by ID number


We have sets of documents, and we need to convert multiple files to PDF by a certain parameter - the ID number. For instance, we have a set of documents for each employee: employee personal record form and attachments to store information like resume, contract, payroll records and other files associated to the individual.

The idea is to join 5 different documents (Word files, PDFs, scanned images, etc.) together and save them as a single multipage PDF document for each person. In our case, these documents are "Employee_information-434443", "Resume-434443", "Employment_agreement-434443", "Social_security_number-434443" and "Form_I9-434443". 434443 is an employee's ID number.

The documents should be combined into PDF titled as "[ID number]-Personnel_file" for each employee. They must be merged in this way: Employee_information page is placed at the beginning of the document, and other files are added after it as attachments. Is it possible to merge pages into one PDF with FolderMill like this?


FolderMill can help you fully automate PDF merging and perform these tasks at the same time:

  • automatically combine several Word documents by ID number contained in the filename
  • place the main document (or cover page) at the very beginning
  • convert all document pages into PDF format if they have another format
  • merge multiple documents and create a multipage PDF for each document set

You can easily set up FolderMill so that image or text files are arranged by a certain parameter in their filenames e.g. ID number. Then the program converts them into a multipage PDF. Besides, the main document (employee information form) is inserted at the beginning of the output PDF.

Let's say you're bulk copying around 1000 files to a Hot Folder at once, so it's important to set up a rule which would make sure they don't get mixed up. Just configure your Hot Folder so that it has a corresponding Action Set for each document set you want to get. Eventually, your new pages will be grouped by certain characteristics regardless of how and when they get into the Hot Folder!

Please watch this short video tutorial on how to set up FolderMill for this task:


Let's split the configuration into two steps - first Action Set and second Action Set. We will set up adding Employee_information files always at the beginning of the document in the first Action Set, and configure appending of the remaining files in the second Action Set.

First Action Set

  1. Create a new Hot Folder. Add a new Action Set and select Filter by filename Action: Сonvert multiple files to PDF starting with Filter by filename
  2.  Enter the name of document which should go first - Employee_information*. This file will be inserted at the beginning of the output document. Select Process files by mask option, then click OK: Filename Filter Action parameters
  3. Add Rename document as a second Action. Select {Name} and replace it with a regular expression. A regular expression is an in-built macro which renames files automatically. Since our files are titled as "[File Name]-[ID Number]", we'll use the Take digits from the end regular expression: Use various macros to rename files in FolderMill
    We want to have our output PDF files renamed as "[ID Number]-Personnel_file", so just type "-Personnel_file" after the regular expression. The whole expression should be as follows:


    Take digits from the end as part of the output filename
    Click OK and proceed to the next step.
  4. Add Convert to PDF as a third Action:
Convert to PDF as 3rd Action in the Action Set

Select Insert before existing PDF file option in the Action parameters and click OK:

Convert to PDF Action parameters in FolderMill

Thus, the first Action Set will process only files containing "Employee_information" in their filename and place them at the beginning of the resulting PDF files.

Second Action Set

The second string of Actions will process additional files, all except for the cover pages (Cover_page-[ID Number]).

  1. Add another Action Set in the same Hot Folder: Create a 2nd Action Set in FolderMill
  2. Add Filter by filename Action as the first Action and input Employee_information* again, but this time select Exclude files by mask: Filter files by filenames in FolderMill
  3. Add Rename document as a second Action and configure it exactly like for the first Action Set. Use Take digits from the end regular expression and type "-Personnel_file" instead of {Name}: {rexp((\d+)$)}-Personnel_file.{Ext} and click OK.
  4. Add Convert to PDF as a third Action and select Append to existing PDF file:

Append to existing PDF file in FolderMill

Therefore, all files except Employee_information will be appended to the multipage file one by one. All set! Click OK, Apply changes and start FolderMill.


In the end, your Hot Folder Settings should look as follows:   

Hot Folder configuration overview

Action 1 Action 2 Action 3
Action Set I Filter by filename
Process only "Employee_information*"
Rename Document
Rename to "{rexp((\d+)$)}-Personnel_file.{Ext}"
Convert to PDF
+ Insert before existing PDF file
Action Set II Filter by filename
Process all, except "Employee_information*"
Rename Document
Rename to "{rexp((\d+)$)}-Personnel_file.{Ext}"
Convert to PDF
+ Append to existing PDF file

Our Hot Folder is now configured so that the first Action Set will pick only Employee_information files and always place them at the beginning of the output multipage file, whereas the second Action Set will process all other files and append them to the resulting file. Therefore, the main document (cover page) will always go first, regardless of the sequence in which the incoming files arrive in the Hot Folder.

You can use this solution in various cases: when creating catalogs, price quotations, collecting documents for bank, correspondence history or in any other situation when you need to collect data into one multi-document file. This way you can combine images, JPEGs, Excel files into PDF and combine PDF files into one. Each and every case is individual, so please contact us if something doesn't work for you. We'll do our best to help!

Download FolderMill