Scroll Top
  • Home
  • Articles
  • Generating PDFs Programmatically: Build or Buy

Table of Content

PDFs are actually complicated

Flexible Design is hard

Which PDF exactly?

What about libraries?

Consider buying a software or a service to generate PDF

Conclusion

ARTICLE

Generating PDFs programmatically: Build or buy

Generating PDFs with programming languages like Python, C#, and JavaScript has become a necessary and common practice. Whether it’s generating documents, reports, or contracts, creating PDFs programmatically is an essential requirement for many businesses and organisations. This is even more true in the financial industry, where PDF is the de-facto standard for exchanging information.

However, generating PDFs is usually not a straightforward process, especially so if it’s important that generated PDFs look attractive. In this post, we will explore the challenges of generating PDFs programmatically, discuss some possible libraries like ReportLab and jsPDF, and suggest potentially better options than writing code.

Share

PDFs are actually complicated

One of the main challenges with generating PDFs with code is that PDFs are a complex file format with many different features and options.

A PDF file can not just contain text, but images, vector graphics, tables, graphs, complex fonts and even forms, and each of these elements have their own complexity.

For example, understanding fonts can be a very challenging topic in itself. In general, to generate perfect PDFs with code, you need to have a good understanding of the PDF file format and all of its features.

Flexible design is hard

As everything that involves design, dealing with the necessary flexibility can be a huge challenge. It will probably take quite a bit of code to generate a perfect multi-page contract in a certain design.

However, your design team may decide that in a year or so to change the design completely, making it necessary to rewrite part of the code again, which will take time. This can make it difficult to iterate quickly on your PDF designs and can slow down your development process.

Which PDF exactly?

Finally, generating PDFs with code can be a challenge because of the huge array of actual PDF formats available.

PDFs are reasonably standardised, however you may be asked to generate sub-versions like PDF/A for archiving or a PDF with an XFA (XML Forms Architecture) to make fields on the PDF editable.

This will create additional complexities and force you to potentially change libraries altogether, as your preferred one may not support the creation of PDF/A. From my personal experience I can tell you that both of these things seem simple but can consume weeks of development time to get right.

What about libraries?

One popular library for generating PDFs with Python is ReportLab. It is widely used and provides a range of features, including text formatting, image placement, and table creation.

ReportLab is an excellent choice for generating PDFs with Python; however, the library is relatively old (it does not follow PEP8 since it was created before this python coding standard was introduced) and it can be complicated to use. It’s also not helpful that its documentation is extensive but often unclear about important details.

If you are using JavaScript, another popular library is jsPDF. It provides a range of features, including text formatting, image placement, and font support. However, it lacks some of the advanced features available in ReportLab, and its design capabilities are limited.

While libraries like ReportLab and jsPDF provide developers with an excellent starting point for generating PDFs, they have their limitations. For example, they may not support all the features required by a specific use case, and it can be challenging to implement complex layouts or design templates.

Additionally, creating a design template in code can be time-consuming and requires a considerable amount of expertise.

Consider buying a software or a service to generate PDF

Instead of relying solely on programming languages and libraries to generate PDFs, businesses and organisations can consider buying a tool or service that can generate PDFs. As developers, we often forget that other people have already invested a lot of time building something and we tend to underestimate the time it takes us to build something from scratch.

There is already a large number of existing cloud-based services that can generate PDFs, either as their main purpose or included with it like in an onboarding tool, an invoicing tool or a process orchestration software. Sure, these services usually come with a subscription fee, but the cost is often negligible compared to the time and effort saved.

We at Atfinity had the same challenge when building our process orchestration software. The PDF generation was at least three times as complicated as we thought it would be and took five times the time we hoped. We are happy with the result and since this is a very important pillar of our process orchestration software, it was probably worth it, but it took very long to get here.

Conclusion

Most likely, generating PDFs is not your core business. When looking at the challenge to generate PDFs, especially in environments where the design will change a few times, it could be a good idea to look around and see if buying something could be better than building something yourself.

If you are generating contracts for Onboardings, KYC, Loan Origination or similar problems, consider dropping us a line and we are happy to help you generate attractive contracts next to solving a few other problems.

Share

Join the Future of Banking

Book your demo today and see why leading financial institutions
worldwide trust Atfinity to drive their digital transformation.

Join the Future of Banking

Book your demo today and see why leading financial institutions worldwide trust Atfinity to drive their digital transformation.

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.