Início

Endereço da API

https://pdf-api.co/pdf
                

API para gerar arquivos PDF a partir de conteúdo HTML fornecido por meio de uma solicitação POST.

Sua chave de API é:

Gerar PDF via HTML


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

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

Para gerar arquivos PDF via HTML faça uma chamada POST no endereço:
https://pdf-api.co/pdf


PARÂMETROS

Campo Tipo Descrição
apiKey String Sua chave da API
format String (optional) Formato de impressão "A4" (folha A4) ou "letter" (Carta).
landscape Boolean (optional) True para Landscape (paisagem) ou false para portrait (retrato).
html String Conteúdo HTML.

Nodejs - HTML to PDF


// exemplo usando nodejs e axios
const axios = require('axios');

const apiKey = 'SUA_CHAVE_API';
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));
                

Para gerar arquivos PDF a partir de HTML em NodeJS, instale a biblioteca axios e faça uma chamada POST para o URL:
https://pdf-api.co/pdf

Preço

Requisiçōes / Mês Preço
1000 De graça 🚀
+1000 ** R$ 3

** Te enviaremos um e-mail quando exceder o limite de requisiçōes gratuítas.