Get started

API Endpoint

https://pdf-api.co/pdf
                

API to generate PDF files from HTML content provided via a POST request.

Congratulations! Your API key is:

Generate PDF from HTML


# Here is a curl example
curl \
-X POST https://pdf-api.co/pdf \
-H 'Content-Type: application/json' \
-d '{ "apiKey": "YOUR_API_KEY","html":"<body>helloworld</body>" }'
                

# Here is a curl example
curl \
-X POST https://pdf-api.co/pdf \
-H 'Content-Type: application/json' \
-d '{ "apiKey": "","html":"<body>helloworld</body>" }'
                

To generate pdf files from HTML make a POST call to the following url :
https://pdf-api.co/pdf


BODY PARAMETERS

Field Type Description
apiKey String Your API key
format String (optional) The format to be used between "A4" and "letter".
landscape Boolean (optional) Switches between landscape and portrait.
html String The HTML content to be used during PDF generation.

Nodejs - HTML to PDF


// an example using nodejs and axios
const axios = require('axios');

const apiKey = 'YOUR_API_KEY';
const html = '<body>helloworld</body>';

axios.post('https://pdf-api.co/pdf', {
  apiKey: apiKey,
  html: html
}, {
  headers: {
    'Content-Type': 'application/json'
  },
  responseType: 'arraybuffer'
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
                

// an example using nodejs and axios
const axios = require('axios');

const apiKey = '';
const html = '<body>helloworld</body>';

axios.post('https://pdf-api.co/pdf', {
  apiKey: apiKey,
  html: html
}, {
  headers: {
    'Content-Type': 'application/json'
  },
  responseType: 'arraybuffer'
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
                

To generate pdf files from HTML in NodeJS, install axios and make a POST call to the url
https://pdf-api.co/pdf

Pricing

Requests / Month Price
1000 Free 🚀
+1000 ** $3

** We will contact you once you exceed your subscription threshold.