PHP code for converting html to PDFs using Api2Pdf now released

July 18th, 2018 / by api2pdf / No Comments

We released the full code and documentation on Github: https://github.com/Api2Pdf/api2pdf.php.

As Api2Pdf gains in popularity due to its low-cost and simple to use API for converting HTML to PDFs, we have started to get requests for libraries and packages in other languages. The most heavily requested is PHP. Therefore, we wrote the PHP code for Api2Pdf which hits all of our endpoints: HTML to PDF, URL to PDF, Office Docs to PDF, and Merge PDFs.

Api2Pdf is a wrapper for wkhtmltopdf, Headless Chrome, and LibreOffice and proudly runs on AWS Lambda to allow for extremely low cost PDF conversions with no rate limits or file size limits.

As an aside, PHP is still a gross language, but I digress.

For those that are looking for some quick and dirty PHP code to use with Api2Pdf, you can see this snippet below which connects to the wkhtmltopdf endpoint, converting HTML to PDF. It uses cURL.

Usage is simple:

For those looking for the full code and sample usage of all methods and endpoints supported by Api2Pdf, please see our Github (https://github.com/Api2Pdf/api2pdf.php) page.

Any and all feedback is welcome.

Tags: , , , , , , , , , , , , , , , , , , , ,

Comments are closed.