Here are some best free HTML to PDF API to convert webpages to PDF. These HTML to PDF conversion APIs can be used in your applications to add the functionality of converting a webpage to PDF. You can generate an API key for you from any of these websites and then use that from the terminal or from the browser to convert a webpage to PDF. When you get the API key, you will need to create the API call URL to use for HTML to PDF conversion. The free version in all these websites give you certain number of credits for a month to convert HTML to PDF.
APIs are good for the web and mobile applications. They make the work simple by just writing a few lines of code. We have already published posts related to free APIs for weather, IP location, and QR code, etc. And now in this post, I will list some free APIs that you can use to easily convert a web page using its URL to PDF. You just have to use your API key and URL of the target page in API call to get the PDF from a webpage.
Free HTML to PDF API to Convert Webpages to PDF:
PDFShift
PDFShift offers you 250 free API calls per month to create a PDF from any webpage. It gives you some pre ready code snippets corresponding to different programming languages as well that you can use. After creating an account, it gives you an API key that you can use to convert a webpage to HTML anytime. If you have cURL installed on your PC or if you use Linux or MAC then you can execute a simple command to easily convert any webpage to PDF. In the API call, it takes a few parameters such as API key, source URL, orientation of PDF, and some others. You can get all the details from the documentation page.
Go to the homepage of PDFShift using the above link and then sign up for a free account. It will then send you an API key with an example command of cURL that you can use. Or, from its API documentation page, you can copy any code snippet and then modify that according to your needs. In my case, I will be using the Python code snippet to convert a webpage to PDF. You can see the above screenshot. Just specify API key, source webpage URL, and execute the script. It will save the PDF file in current folder.
Pdflayer
Pdflayer in the free plan, gives you 100 credits per month to convert a webpage to PDF using its URL. And the best part is that, you can use it from your browser. You just have to construct an API URL and then use that. In the API call, you have to specify the URL of the source webpage, API secret key, and some other additional parameters. You can see the documentation page on the website to see the custom use of the API.
To use this API, first you will have to obtain a API key for you. You can sign up for a free account and then copy the API key from your account’s dashboard. Next, start constructing the API call URL and then use that in your browser. See the syntax and usage of the URL below.
Syntax: http://api.pdflayer.com/api/convert?access_key=YourAPIKey&document_url=URL
Example: http://api.pdflayer.com/api/convert?access_key=knxxxx48&document_url=https://xyz.com/ice.html
You can put the API URL in your browser and then you can wait for a couple of seconds. It will process the input webpage and then finally the PDF will start downloading automatically. After getting the PDF file, you can do whatever you want.
Neutrino API
Neutrino API is actually a collection of various APIs that you can use to convert HTML webpages to PDF. Here it offers you 10 conversions per day which is good. So, in a month, you will get total of 300 HTML to PDF conversions. You can create an account to get an API key and then start making the API calls to convert HTML to PDF. You will find some really nice examples and API documentation on the website that will help you learn how to use it. You just have to create API call request to get the job done. Alternatively, you can use its web interface to create the API call URL.
Obtain an API key from this website by creating a free account. One good thing about signing up on this website is that you will not have to use your email address for registration. You can choose a desired user ID and then it will give you an API key. But you will have to keep the ID and API key safe as they are the credentials for logging in.
Now, you can go to the HTML Renderer page of this website and then construct the API URL. After that, test that, and it will give you the PDF output. You can specify a lot of options in the API call to customize the PDF output. And you can learn about them all on its documentation page.
HTML to PDF Rocket
HTML to PDF Rocket is another handy website that provides a free HTML to PDF converter API. In the free plan, it offers you 200 credits per month and the PDF file should not be more than 5MB in size. You can make API calls to this service from your browser and then get the corresponding PDF file. You just have to create a free account on the website to get API key and then you can create API call URL. You can either embed the API call in your website or in your other applications painlessly.
Just create a free account and then it will email you the API key. Next, you can build the API call URL and then use that in your browser. See below the syntax and example API call URL for this website.
Syntax: http://api.html2pdfrocket.com/pdf?value=”InputURL“&apikey=”YourAPIKey”
Example: http://api.html2pdfrocket.com/pdf?value=http://www.google.co.nz&apikey=ABCD-1234
You can create the API call URL in the specified format. And you can then put that URL in the address bar of your browser. If everything goes right, a PDF file will start downloading automatically.
ConvertAPI
ConvertAPI is the last free website in this list that also offers you a free API for different file conversion. And one of those conversions is HTML to PDF. It works in a different way than any other website in this list. Instead of using number of conversions or credits, it uses seconds. It gives you 1500 seconds per month and then the time taken in one conversion will be deducted from your free quota.
Just like other websites in this list, you can sign up for a free account and then get an API key for yourself. After that, you can read the docs and then use the API for converting HTML to PDF. To construct the API URL, you can use this link and then generate the cURL command or the code snippet in any of the supported programming languages.
You can generate the cURL URL or you can use also generate a code snippet and then use that. While testing I used its Python code from here to convert a URL to PDF. You can also use the same script and then easily convert any webpage to PDF right from your terminal.
Final thoughts
If you need some HTML to PDF APIs for your applications or any other work then try any one from the above list. You just have to create a free account to generate a API key for you to use. And I really like the fact that some of these websites provide pre-ready code snippets in different programming languages to save your time. You just have to modify them and then you can get the PDF from any webpage URL.