You'll find two kinds of HTML to PDF API repos on GitHub: libraries of commercial, online APIs and open-source HTML to PDF APIs.
Since you're looking for source code repos, you're probably looking for an open-source project. Frankly, these projects struggle with creating high-quality and complex PDFs, as we review in our open-source HTML to PDF guide. Still, they make work for you in some circumstances. Of the many open-source HTML to PDF libraries, only a few are available in an API format:
The most popular microservice wrapper for Headless Chrome via Node.js-based Puppeteer. Puppeteer provides cutting-edge CSS and JavaScript compatibility but has a reputation for using a lot of service resources. Additionally, it can't match the versatility and strength of commercial HTML to PDF converters with their superior support for the Paged Media CSS specifications and PDF-specific extensions. So while Puppeteer excels with basic documents, intricate documents or high-volume requirements may pose a challenge.
It's important to note that url-to-pdf-api contains significant security vulnerabilities and isn't advisable for public or unisolated environments. Other libraries built on Puppeteer, like the Docker-friendly puppeteer-html-to-pdf-converter, might present more secure alternatives. However, the majority of them don't provide API functionality.
Browsershot is a PHP/Laravel library for accessing Puppeteer. Sidecar is a Laravel library for deploying and executing AWS Lambda functions from Laravel. Put them together and you have an HTML to PDF API running on AWS Lambda. It obviously has the same advantages and disadvantages as all Headless Chrome-based libraries.
A Laravel-based microservice interface for the dompdf library. Notably, dompdf lacks support for JavaScript and doesn't use the Paged Media CSS standards or contemporary CSS features like flexbox. Additionally, it can't handle multi-page tables and inline SVGs. That said, these restrictions frequently result in superior performance and more efficient memory utilization compared to libraries based on Headless Chrome. Its swiftness can be attributed to its simplicity and the fact that it doesn't embed a complete modern browser.
There are many advantages to using an online HTML to PDF API, primarily reduced maintenance costs, better scalability, and greater redundancy. However, if you're the one building the API using one of the above open-source libraries, you obviously lose most of the advantages. The below repo collections are from commercial APIs that provide cross-platform agents in a variety of programming languages:
We're the only API that uses the commercial Prince HTML to PDF converter. That gives DocRaptor unique capabilities (such as forms, accessible PDFs, PDF-specific JavaScript, and more) that no other HTML to PDF API can match. DocRaptor's GitHub repo contains libraries for Ruby, PHP, C#, Java, and Python, as well as our free PDF templates.
ConvertAPI provides conversion services for a wide variety of file formats, including Word, Excel, PowerPoint, HTML, and PDF files. They're best for applications that need many types of files converted but require relatively simple PDFs. They provide agents for Python, Node, PHP, .NET, Java, Go, Ruby, and JavaScript.
Api2Pdf provides HTML to PDF conversion services for two open-source converters, Headless Chrome and wkhtmltopdf. As discussed above, Headless Chrome provides the most modern support (albeit lacking DocRaptor's PDF-specific functionality), while wkhtmltopdf is ancient, buggy, and unsupported (see our list of wkhtmltopdf alternatives). Api2Pdf has libraries for .NET, PHP, Node, Python, Salesforce, and Java. They also have plugins for CKEditor and TinyMCE.