Overview
This node converts HTML content into a PDF document. It is useful when you need to generate PDF files dynamically from HTML input, such as creating reports, invoices, or formatted documents from web content or templates. For example, you can input an HTML string representing an invoice layout and get back a PDF file ready for download or email attachment.
Properties
| Name | Meaning |
|---|---|
| HTML Input | The HTML content to convert to PDF. This should be a valid HTML string representing the document you want to transform into a PDF file. |
Output
The node outputs the original JSON data unchanged and adds a binary data field named data containing the generated PDF file. This binary data represents the PDF document created from the provided HTML input.
Output structure example:
{
"json": { /* original input JSON */ },
"binary": {
"data": {
"data": "<Buffer ...>", // PDF file content in binary form
"mimeType": "application/pdf",
"fileName": "output.pdf"
}
}
}
Dependencies
- Requires an external API service accessible at
https://e.customjs.io/__js1-<apiKey>, which performs the HTML to PDF conversion. - Needs an API key credential to authenticate requests to this external service.
- Uses a helper method to prepare the binary PDF data for output.
Troubleshooting
- Invalid or missing API key: If the API key credential is not set or invalid, the request to the external service will fail. Ensure the API key is correctly configured.
- Malformed HTML input: Providing invalid or incomplete HTML may result in an error or an improperly generated PDF. Validate your HTML before input.
- Network issues: Since the conversion relies on an external API, network connectivity problems can cause failures.
- Error responses from the API: If the external service returns an error, check the response message for details and verify that the API endpoint and credentials are correct.
Links and References
- No direct links available from the source code. For more information about HTML to PDF conversion, consider general resources like: