Overview
The PDF Generator API allows you to create PDF documents from HTML content. Use it to generate reports, invoices, or any other documents you need in PDF format.
Endpoint
POST /api/generate-pdf
Request
Send a JSON payload with the following structure:
{
"encodedHtml": "Hello, PDF!
",
"options": {
"format": "A4",
"printBackground": true
},
"filename": "document.pdf"
}
Required Fields:
- html: The HTML content to be converted into a PDF.
Optional Fields:
- options: PDF configuration options (e.g., page size, margins).
- filename: The name of the generated PDF file.
Response
On success, the API returns a binary PDF file. The Content-Type is set to application/pdf. Example response:
HTTP/1.1 200 OK Content-Type: application/pdf Content-Disposition: attachment; filename="document.pdf" (Binary PDF Content)