5 APIs for Automating PDF Generation

PDFs are a little like Marmite: you either love them (or at least tolerate them) or hate them. Common complaints about PDFs include poor readability, problems with integration, limited version control, and the inability to edit them without a dedicated app like Adobe Acrobat Reader. So why do we still use them?

Well, however you feel about them, there’s no denying that the Portable Document Format (PDF) has strong benefits. Like, the fact that PDFs can be created from almost any document type and preserve that content on whatever device or program they’re opened with. Given the focus the world of APIs has on compatibility and inter-communication, it’s not surprising that PDFs are prevalent in these areas.

Below we’ll be looking at a few services capable of accepting API calls to generate PDFs. We’ll consider why a developer may need this functionality, and try to determine if any solutions stand out.

What Does a PDF API Do?

If you have data that you want to convey in a specific format, but don’t know what device or software it’ll be used on, you might choose to export it as a PDF to make things easier for your recipient.

A PDF API does a similar thing, i.e., converts data to PDF, but does it automatically. You could use one, for example, to export information from a webpage as a PDF or generate a standardized form from the information you already have.

In fact, many PDF generation APIs seem to fall into one of these camps:

  • HTML-driven (e.g., Paperplane, PDFmyURL, PDFBlade): The focus here is the conversion of a URL or HTML to a PDF with an API call, offering a more user-friendly snapshot of a website than trying to save it manually as a web archive or by screenshotting it using your laptop or desktop.
  • Template-driven (e.g., Anvil, PDF Generator): By enabling the conversion of JSON objects to PDFs, these APIs place more emphasis on creating reusable templates, customizable fields, etc. Some feature drag-and-drop editors designed to reduce barriers to entry for end-users.

A notable example of the latter would be automatic invoice generation from data entered into a piece of accounting software, creating a PDF that can then be emailed or printed by users. Such tools could empower non-technical team members to make tweaks to templates without the need to enlist developers or designers’ help.

1. Anvil

Anvil’s website puts its purpose pretty simply: “post JSON, receive PDF.” Its REST endpoint enables you to fill a templatized PDF using the data you provide. You’ll also need to create a PDF template that holds the configuration for a single PDF file.

Building PDF templates doesn’t, however, require any code – Anvil finds fields automatically so anyone can add, remove, or tweak fields. It doesn’t lock users into long contracts or plans, but that flexibility is reflected in a high “per conversion” price point.

Some other points of note include:

  • Free sandbox environment
  • Unlimited development filled PDFs
  • Unlimited PDF templates

Interestingly, Anvil features Anvil Workflows heavily on its homepage. This is a product to “convert your PDF forms into simple, intuitive websites that fill the PDFs and gather signatures for you.” Offering integrations with services like DocuSign and CRM software, it feels very much like Anvil is using their PDF filling API as a stepping stone to a more comprehensive workflow automation service.

2. Paperplane

The focus of Paperplane is HTML to PDF conversion via a REST API powered by Google Chrome. It’s one of the simpler options for the job out there, with a slick live demo on the website that works well.

Despite that simplicity, it’s probably not one we’d recommend for those looking to facilitate things for non-technical team members; Paperplane is developer-focused. Code samples are available in curl, Ruby, Python, PHP, Node.js, Java, C#, and Go for testing.

Paperplane has a tiered pricing plan, with most features included in all plans:

  • Customizable headers and footers, including page numbers
  • Standard page sizes or custom sizes
  • Custom margins
  • Direct download of PDFs
  • All PDFs uploaded to S3 bucket

From what we’ve seen, it’s one of the cheaper options on the market. The service offers a tiered pricing package based on volume, with the lowest tier allowing generation of up to 2,500 PDFs per month.

3. PDF Generator API

PDF Generator API remains a hugely popular alternative to adding a document generation layer to your software. A big selling point here is the browser-based drag and drop template editor, making it much easier for non-developers to use. Some users, however, have complained that the editor can be a bit clunky, saying “the user interface is a little slow when building with the editor” and that “formatting the PDF is a little difficult over the API.”

The documentation available here is really comprehensive, which, as we’ve written about before, is a best practice. It includes tons of information about templates and responses, as well as automatically generated PHP, Java, Ruby, Python, and JavaScript client libraries.

Again, PDF Generator API relies on tiered pricing, and its starter tier also allows up to 2,500 PDFs per month.

4. PDFBlade

PDFBlade’s API allows for the conversion of URLs and plain HTML into PDF files. It’s pretty customizable, with various options for outputting PDFs including:

  • 12+ different page formats
  • Custom headers and CSS styles
  • Disable images and/or JavaScript

File layouts are customizable and stored on Amazon S3, with all accounts served over HTTPS and limited to 50MB per PDF. The ability to purchase credits on the fly is great for infrequent users. However, the fact that credit purchases are one-time transactions could prove problematic for users who experience unpredictable bursts of PDF conversion activity.

5. Instant PDF

With no dedicated website, just a listing on RapidAPI, Instant PDF (stylized as instant PDF) feels more like a side project than a fully-fledged product. The API is designed to allow PDF generation using JSON markup, accepting HTTP POST requests, and returning PDF documents.

Last updated 9 months ago, there are various unanswered posts in its Discussion section: “Invalid JSON – followed the example but still received an error about SRC property being invalid,” writes sohjiawei. Amitshukla30 simply says “broken. not working.”

With high latency and issues like the above, you’re unlikely to want to rely on this API for commercial purposes. That said, the price – indicated as freemium on RapidAPI – is right if you’re just looking for a cost-effective tool to play around with.

Honorable Mentions

Did we leave out a helpful PDF API? Feel free to comment below and we’ll consider adding it here.

Final Thoughts

There are a few key differences between these PDF generation APIs. Each tends to place more emphasis on a specific format or protocol – e.g., JSON vs. HTTP – and some seem more interested in empowering end-users, as opposed to direct customers, than others.

There’s also a significant variation in payment plans. You’ll undoubtedly get a different feeling from each of the product websites linked above, and it’s well worth clicking around before you move forward with a service.

Choosing a tool for automating PDF generation might even come down to documentation, the thoroughness of which varies considerably from product to product. It seems like Anvil has loftier ambitions than some of the other services we’ve mentioned but, right now, there’s no obvious “one size fits all” PDF generation API that stands head and shoulders above the rest.

Then again, where the uninspiring old Portable Document Format is involved, maybe we shouldn’t be too surprised by that!