Apply TXT over PDF with FolderMill


We cooperate with our customers under contract and often send invoices to them. We have an A4-sized sales invoice image that I want to overlay with a text file to produce a finalized invoice I can send to a customer. The background PDF template stays the same, but we need to make unique text contents for each order. It would be good if we could specify a merge PDF with TXT task for each folder – so we could send text invoices to one folder, statements to another, quotes to another, etc. Is it possible to automate this process with FolderMill?


FolderMill is able to render your text files and overlay it upon a PDF file. With our application you can merge a text file with a template PDF file as a foreground image. You can make this process automatic on a regular basis.


You have an invoice template in image or PDF format:

Invoice template in PDF or image format

If your sales invoice template is an image file (JPG, PNG, BMP, PSD or any other file type supported by FolderMill), convert it into PDF first: use "Convert to PDF" action in the actions set of a Hot Folder.

Sales invoice data for a specific order may be in plain text (.TXT) format and look like this:

Sales invoice data in TXT format

Apply TXT over PDF step-by-step

  1. Download our add-on MPDFHelper utility here:
  2. Extract the .zip file to any folder, e.g.
    C:\FolderMill Data\tools\pdftxtapply
  3. Place your template PDF to FolderMill’s tools folder:
    C:\FolderMill Data\tools\[TemplateFilename].pdf
  4. Launch FolderMill, create a Hot folder and click "Start" button:
    Create new Hot folder and Start FolderMill
  5. Create new "Run custom application" action:
    Select "Run custom application" action
  6. Enter path to MPDFHelper.exe in Path to application or script file field:

    Run application or script in FolderMill

    C:\FolderMill Data\tools\pdftxtapply\MPDFHelper.exe

    Enter the following command line in the Command line parameters field:

    -verb textfile2pdfletterhead -stxt "{Doc}" -slh "C:\FolderMill Data\tools\[TemplateFilename].pdf" -outdir "C:\FolderMill Data\Hot Folders\1\Output" -fontname "Courier New" -fontsize 7 -linespacing 1.74 -leftmargin 0.02 -topmargin 0.125

    Where you can specify values for:
    -slh - path to the background PDF titled with [TemplateFilename].pdf (see above, p. 3)
    -outdir - output folder path
    -fontname - font type
    -fontsize - font size
    -linespacing - interline spacing
    -leftmargin, -topmargin - text placement over the background PDF

  7. Mark the "Run in hidden mode" checkbox.
  8. Click "OK" and "Apply changes":
    Apply changes to Hot folder
  9. Run FolderMill by pressing the "Start" button.

Now every time you place a new TXT file into this Hot folder’s Incoming folder you will get the output merged PDF+TXT file in the Output (-outdir) folder.

Congratulations! With the text applied over PDF, you get an invoice ready to be sent to your customer:

Apply text over PDF complete

If you have any questions or difficulty on using this feature, please feel free to contact us. If this guide doesn’t work for you for some reason, we will find an alternative solution!

Download FolderMill