Manual do Gerador de PDF

Base URL: http://html-to-pdf.integ.ro

Endpoint principal

POST /generate

Formato da requisição

Content-Type: application/json

{
  "content": "...conteúdo do PDF...",
  "header": "
...opcional...
", "footer": "
...opcional...
", "output": "buffer", "filename": "meu-arquivo.pdf", "page_orientation": "portrait", "margin": { "top": "20px", "bottom": "20px", "left": "20px", "right": "20px" }, "scale": 0.95 }

Parâmetros

Resposta

Se output = "buffer" (padrão), a resposta é o binário do PDF:

Se output = "file", a resposta é JSON com URL pública do arquivo:

{
  "status": "success",
  "url": "http://html-to-pdf.integ.ro/generador/files/<hash_ou_filename>.pdf",
  "filename": "<hash_ou_filename>.pdf"
}

Exemplos

Gerar e receber o PDF em buffer:

curl -X POST http://html-to-pdf.integ.ro/generate \
  -H "Content-Type: application/json" \
  -d '{"content":"<html><body>Olá</body></html>"}' \
  --output arquivo.pdf

Gerar e receber uma URL do PDF:

curl -X POST http://html-to-pdf.integ.ro/generate \
  -H "Content-Type: application/json" \
  -d '{"content":"<html><body>Olá</body></html>","output":"file"}'

Manual del Generador de PDF

URL base: http://html-to-pdf.integ.ro

Endpoint principal

POST /generate

Formato de la solicitud

Content-Type: application/json

{
  "content": "...contenido del PDF...",
  "header": "
...opcional...
", "footer": "
...opcional...
", "output": "buffer", "filename": "mi-archivo.pdf", "page_orientation": "portrait", "margin": { "top": "20px", "bottom": "20px", "left": "20px", "right": "20px" }, "scale": 0.95 }

Parámetros

Respuesta

Si output = "buffer" (predeterminado), la respuesta es el binario del PDF:

Si output = "file", la respuesta es JSON con una URL pública del archivo:

{
  "status": "success",
  "url": "http://html-to-pdf.integ.ro/generador/files/<hash_o_filename>.pdf",
  "filename": "<hash_o_filename>.pdf"
}

Ejemplos

Generar y recibir el PDF en buffer:

curl -X POST http://html-to-pdf.integ.ro/generate \
  -H "Content-Type: application/json" \
  -d '{"content":"<html><body>Hola</body></html>"}' \
  --output archivo.pdf

Generar y recibir una URL del PDF:

curl -X POST http://html-to-pdf.integ.ro/generate \
  -H "Content-Type: application/json" \
  -d '{"content":"<html><body>Hola</body></html>","output":"file"}'

PDF Generator Manual

Base URL: http://html-to-pdf.integ.ro

Main endpoint

POST /generate

Request format

Content-Type: application/json

{
  "content": "...PDF content...",
  "header": "
...optional...
", "footer": "
...optional...
", "output": "buffer", "filename": "my-file.pdf", "page_orientation": "portrait", "margin": { "top": "20px", "bottom": "20px", "left": "20px", "right": "20px" }, "scale": 0.95 }

Parameters

Response

If output = "buffer" (default), the response is the PDF binary:

If output = "file", the response is JSON with a public file URL:

{
  "status": "success",
  "url": "http://html-to-pdf.integ.ro/generador/files/<hash_or_filename>.pdf",
  "filename": "<hash_or_filename>.pdf"
}

Examples

Generate and receive the PDF as a buffer:

curl -X POST http://html-to-pdf.integ.ro/generate \
  -H "Content-Type: application/json" \
  -d '{"content":"<html><body>Hello</body></html>"}' \
  --output file.pdf

Generate and receive a PDF URL:

curl -X POST http://html-to-pdf.integ.ro/generate \
  -H "Content-Type: application/json" \
  -d '{"content":"<html><body>Hello</body></html>","output":"file"}'