Sample of the Week:
With the imminent demise of Adobe’s FormsCentral, I’ve been playing with Google Forms and Google Apps Script to see if I can get them to talk to the Datalogics WebAPI to fill PDF forms. Since you’re reading this, it’s probably obvious by now that I could… though it ended up being much easier than I was expecting.
Google Apps Script makes it pretty straightforward to create a PDF file based on some boilerplate text and a set of fields that you pull from a Google Spreadsheet, pour into a Google Doc and then save as a PDF. But if you want to fill an existing PDF Form, you need to integrate another tool. A developer can easily call another script using UrlFetchApp that can leverage the Datalogics PDF WebAPI.
The Google Form embedded into this post below executes a script when the form is submitted. The script massages the data entered into a parameter string and then calls another script to generate a single PDF file and then mail it to you. But it’s just as easy to iterate over multiple records in a Google Spreadsheet and populate multiple PDF forms as a batch operation. The free WebAPI accounts can only create one form at a time but a paid account can use FillForm to send multiple records to create multiple PDF files in a single request and supports CSV, TSV, and a JSON array as inputs.
This form and the resulting PDF is a very basic proof-of-concept so don’t expect to see any code this time around but keep your eyes on this space for future developments.
2 thoughts on “Using the Google Apps Script to Populate PDF Forms with the Datalogics WebAPI”
Hi there,
I am interested in learning more about populating pdf forms via google app script. Is there any simple example to take a look? Thanks a lot
Ernan:
The sample that this blog post refers to leverages a product that we are no longer supporting. However, I am working on a sample that will leverage the Datalogics PDF Java Toolkit to do the same thing.