Batch fill PDF

primuspaul

Board Regular
Joined
Dec 23, 2015
Messages
75
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
I need to batch fill a bunch (sometimes 1-2, other times 100-200) of PDF files with multiple pieces of data from an excel table. Each row on the excel table contains info for one of the PDFs so if I need to fill out 200 of a particular form, that excel file will have 200 rows and however many columns as there are fields on the form.

I have done this in the past with VBA. It was basically done by laying out fields linked via offset() to the table and each time it printed the document to PDF, it would add one to the offset, do until offset number reached number of rows. Then I had the same VB script batch execute a command line program that pasted a PDF file over a "background" (blank template of the form).

It worked, but the method is incredibly clunky, mostly because the process always involves guessing the location of fields and arranging/resizing fields on the excel sheet to match (often taking close to 100 attempts of printing to PDF print, merging, viewing, repeating). Often it's not even worth it unless I need hundreds of forms filled out.

I tried paste-linking in a word file (with the PDF as a watermark), but the formatting keeps resetting when the fields change regardless of whether I link unformatted or formatted text.

Is there a better way of doing this?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
After messing around with all sorts of tools for a few hours, it seems mail merge with a PDF file in the background (saved as a PNG file from Acrobat) and text boxes linked to those entries in the excel file (with formatting applied using Toggle Field Codes) is the best way to go.

Some minor problems:


  • Text boxes can span multiple fields vertically with the help of paragraph spacing between lines, but they cannot span multiple fields horizontally due to displacement of text.
  • Word mail merge cannot use fields starting with a number. Start field names in your excel file with a letter always!
  • Moving files around seems to break the link, which requires you to relink the file, but you keep the field locations (good).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top