Help

Re: PDF Document Generation; Going Around the Barn One Less Time

4105 1
cancel
Showing results for 
Search instead for 
Did you mean: 

On a recent task I reached my limit for the annoying and time-consuming implementation of a PDF document generation process for Airtable. I just had to find a way to eliminate lots of steps.

Lacking the use of integrated tool sets the likes of which @kuovonne and On to Air has created, most of mine have embraced a process like this. As you can see in the list, the workflow involves a lot of steps that are dependent on services all working perfectly as expected. Not to mention that there is a significant amount of processing time involved with all of these steps combined.

Airtable → Automation → Script → Webhook → Google Apps Script → Airtable API → Google Document (template) → Google Drive → Google Apps Script → Airtable API → Airtable

I really want this:

Airtable → Script Action → Airtable

This seems impossible, but it’s not. I have perfected this approach and it requires no external document storage service to host the final PDF document from for upload into Airtable’s attachment fields. It’s a “data-direct-to-attachment” concept that few people (if any) have discovered.

HTML Chassis

The key concept here is to do everything in HTML as the common underlayment for the document and then use tools to convert the final rendering into a PDF. HTML is easy to work with and generated even in Airtable formulas.

PDF Conversion

I tend to lean on an external [paid] service for PDF conversion from HTML. This is an insignificant cost; $10/mo gives you a thousand documents and they’re only a cent per document thereafter. Is it worth a penny per document to avoid all the complexity? This cost is minimal considering the significant reduction in complexity and overall ownership of the process and reduced dependencies on other big tech platforms.

Performance

Most important is the performance when processing documents in Airtable scripts. If you use Google Apps Script and Google Drive the generation and upload process is typically north of 10 seconds per document. With this new approach, it’s about 1.6 seconds from the moment the Airtable action script is triggered to the final PDF document uploaded in your attachment field.

Security

I know there are many services that allow you to generate PDFs from HTML but one thing I’m concerned with is the privacy of those documents which must be openly hosted to facilitate the attachment upload process into Airtable. This is not a complete list…

Whichever one you decide to go with, make sure you understand the disposition terms of the documents they generate for you.

image

Step 1 - Invoke the generation process; gather the data for the document.

Step 2 - Read the appropriate document template.

Step 3 - Merge the data into the template and generate the PDF.

Step 4 - Attach the final document to the Airtable record (optionally email as attachment, etc).

I’m exhausted from solving this the old ways; what’s your approach?

12 Replies 12

What made you think this was impossible?

@Justin_Barrett and I have been doing it this way (generate html => 3rd party service to turn html to pdf => attach pdf to record) for quite a while. Sometimes I generate the html using formula fields. Sometimes I generate the html using a template and scripting (or my Low Tech PDF extension).

I also privately have a system that uses the Low Tech PDF system with scripting so that I can have documents generated automatically, but that system isn’t yet polished enough to sell.

What services do you use to convert your html to pdf? I use either pdfshift or cloudconvert, depending on my mood.

There are some down sides. Crafting html templates can be a pain crafting the style sheets to get things to look right can be even more of a pain. Images from attachments have extra issues. Sorting things and formatting dates and numbers can also take extra care. But all of that is done in Airtable.

You also have to decide where you are going to store the template and what template type to use. Low Tech PDF stores the template in the extension itself. Sometimes I store the template in a [Resources] table. I also tend to use moustache templates, and not handlebars because I can get moustache to run in scripting/marketplace extensions, but handlebars uses eval, so it isn’t allowed in marketplace extensions or automation scripts.

I tried it your way. It was a great learning experience and powerful. And I learned a lot about Google Apps Script, Google Documents, etc. But ultimately it wasn’t fun, so I never leaned on it as extensively as you did.

This is partly because larger businesses want copies of PDFs in Drive. Mapping script into the Drive API is not fun either. So, there are some nuances that caused me to leverage Google a bunch and especially back when script automations were immature.

What service do you use?

I’ll post the details - away from systems right now. I do recall that PDFShift was 3x the cost of the one I prefer.

Because most PDF generation web services do not return a signed URL, thus creating a security risk.

Thanks. One of the main reasons why I picked PDFShift was because it lets you have unlimited free pdf files with their watermark. If a small organization doesn’t mind having the watermark for internal documents for the few documents they need, it is hard to beat free.

As you stated…all of this is accomplished with Google Documents in On2Air :grinning_face_with_big_eyes:

:heavy_check_mark: Auto-generated Google Drive files with Airtable data
:heavy_check_mark: PDFs into Airtable attachment fields
:heavy_check_mark: PDFs into Google Drive
:heavy_check_mark: Google Drive file URLs into Airtable URL/text fields
:heavy_check_mark: Speedy Fast

Starter plan is $10/month

______________________________________
Hannah - On2Air.com - Automated Backups for Airtable

I’ve grown fond of RestPack partly because of its ability to host a signed URL. But I think any of these systems work as well as the others.

That’s good to know. Do they erase the data from their servers after a brief period of time?