HTML to PDF API using AWS Lambda

Api2Pdf’s HTML to PDF API runs on AWS Lambda and supports the generation of PDFs with raw HTML using two PDF engines: wkhtmltopdf and Headless Chrome.  These two PDF engines are open source and each have their advantages and disadvantages. Depending on your use-case and HTML, you may find that one endpoint renders your HTML better than the other. We recommend you test both out to see which one works better for you.

Create an account and check out our documentation to get started for free.

HTML to PDF conversion on Lambda offers some huge benefits. First, we do not have any rate limits, unlike other services out there. Hit the API as many times as you wish. And second, the cost to service the API is substantially less, resulting in much lower fees than competing services.

To get the full power of HTML to PDF conversion, you can include HTML, CSS, and even javascript in the raw HTML that you POST. Here’s an example of raw HTML that you can POST to the API.

 

<html style="color:green;" lang="en">
<head>
<title>Getting Started with Api2Pdf.com</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<div class="row justify-content-md-center text-center">
<img src="https://www.api2pdf.com/wp-content/themes/api2pdf/assets/images/logo.png" />
</div>
<div class="page-header">
<h2> Quick Start Guide</h2>
</div>
<p class="lead"><a href="https://www.api2pdf.com/documentation">REST API</a> | <a href="https://pypi.org/project/api2pdf/">Python SDK</a> | <a href="https://www.nuget.org/packages/Api2Pdf">.NET SDK</a></p>
<h3>What is Api2Pdf.com?</h2>
<p>Api2Pdf.com is a REST API for instantly generating PDF documents from HTML, URLs, Microsoft Office Documents (Word, Excel, Powerpoint), and images. The API also supports merge / concatenation of two or more PDFs. Api2Pdf is a wrapper for popular libraries such as <strong>wkhtmltopdf</strong>, <strong>Headless Chrome</strong>, and <strong>LibreOffice</strong>.</p>
<h3>Acquire API Key</h3>
<p>
Create an account at <a href="https://portal.api2pdf.com/register">portal.api2pdf.com</a> to get your API key. It only takes a minute.
</p>
<h3>Test the API</h3>
<p>From the URL below, replace {YourApiKey} with your API key you acquired and then copy and paste the URL below into a new browser window to test a simple GET request.
</p>
<code>
https://v2018.api2pdf.com/chrome/url?url=https://www.github.com&apikey={YourApiKey}
</code>
<h3>Next Steps</h3>
<p>Check out the <a href="http://www.api2pdf.com/documentation">REST API docs</a> to see details on the other API calls available along with any advanced options and settings you can use. We also offer convenient packages in both <a href="https://github.com/Api2Pdf/api2pdf.python">Python</a> and <a href="https://github.com/Api2Pdf/api2pdf.dotnet">.NET</a>. If you have any questions or issues, please reach out to <strong>[email protected]</strong>
</div>
</body>
</html>

 

Advanced Options:

Both wkhtmltopdf and Headless Chrome have advanced options that allow you to specify margins, page layouts, and a host of other capabilities. We let you pass those options along.