Сreate PDF from multiple files arranged by ID number

Case

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 worker: employee personal record form and attachments to store information like resume, contract, payroll records and other files associated with 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 a 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?

Merge multiple files to combined PDF with main document in the beginning

Solution

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 even if they have various formats
  • 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 combined by a certain parameter in their filenames e.g. ID number. As a result, you'll get 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 a certain parameter (e.g., file type or name) regardless of how and when they get into the Hot Folder!

Video instruction

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

Instruction

Let's split the configuration into two steps — first Action Set and second Action Set. We need to keep Employee_information files always at the beginning of the document in the first Action Set, and append the remaining files in the second Action Set.

Action 1Action 2Action 3
Action Set IFilter by filename
Process only "Employee_information*"
Rename Document
Rename to "{srcfilename("(\d+)$")}-Personnel_file"
Convert to PDF
+ Insert before existing PDF file
Action Set IIFilter by filename
Process all, except "Employee_information*"
Rename Document
Rename to "{srcfilename("(\d+)$")}-Personnel_file"
Convert to PDF
+ Append to existing PDF file

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 only documents  option, then click OK:
    Filename Filter Action parameters
  3. Add Rename document as a second Action. Replace {srcfilename} with a regular expression. A regular expression is an in-built macro which renames files automatically. Since our source 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:
    {srcfilename("(\d+)$")}-Personnel_file
    Click OK and proceed to the next step.
  4. Add Convert to PDF as a third Action and choose Insert before existing PDF file option:
    Convert to PDF as 3rd Action in the Action Set
    Convert to PDF Action parameters in FolderMill

Click OK — and your first Action is complete. 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 first page (Employee_information page).

  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 Process all documents those:
    Filter files by filenames in FolderMill
  3. Add Rename document as a second Action and configure it exactly like in the first Action Set: {srcfilename("(\d+)$")}-Personnel_file (see First Action Set, step 3).
  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 Processor.

Summary

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

Hot Folder configuration overview

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 banks, 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