Actions108
- AI Actions
- Transcribe
- Detect Brand
- Extract Contact Information
- Mood Detection
- Detect Adult Content
- Enitity Detection
- Language Detection
- Too Long To Read
- Check Content Policy
- Detect Faces
- Generate Python Code
- Picture Text Recognition
- Detect Color
- Generate Image
- PDF OCR
- Translation
- Detect Email Type
- Generate Javascript Code
- Picture Object Recognition
- Business Actions
- Calculate Actions
- Code Actions
- Convert Actions
- Crypto Actions
- Date & Time Actions
- Generate Actions
- Image Actions
- Operator Actions
- PDF Actions
- Storage Actions
- Text Actions
- User Actions
Overview
The node provides a versatile "HTML to Image" conversion feature within the broader "Image" resource. It allows users to convert either raw HTML code or a URL pointing to an HTML page into an image file. This is useful for scenarios such as generating previews of web pages, creating snapshots of dynamic HTML content, or automating the creation of images from HTML templates.
For example, you could use this node to:
- Convert a marketing email's HTML code into an image for quick visual sharing.
- Capture a screenshot of a live webpage by providing its URL.
- Generate images from custom HTML content dynamically created in a workflow.
Properties
| Name | Meaning |
|---|---|
| Type of Data | Choose whether the input is a direct HTML string (HTML) or a URL pointing to an HTML page (URL). |
| HTML | The raw HTML code to convert into an image. Only shown if "Type of Data" is set to HTML. |
| URL | The URL of the HTML page to convert into an image. Only shown if "Type of Data" is set to URL. |
| Options HTML to Image | JSON object specifying options for the conversion process. Defaults include image type (png), full page capture (false), disabling animations (true), emulating device (iPhone X), and enabling dark mode (true). |
| File Name | Optional filename for the resulting image. Can be used to name the output file. |
| Get File as URL | Boolean flag indicating whether to return the resulting image as a URL (true) or as binary data (false). |
| Code Variables | A collection of code variables that can be passed to the conversion function, allowing dynamic substitution of values in the HTML or URL context. Each variable has a name/ID and a value. |
Output
The node outputs JSON data representing the result of the HTML to image conversion. The exact structure depends on the underlying service response but typically includes:
- The image data itself, either as a URL (if "Get File as URL" is true) or as binary data.
- Metadata about the generated image, such as format, size, or filename if provided.
If binary data is returned, it represents the actual image file generated from the HTML content or URL.
Dependencies
- Requires an API key credential for authentication with the external "0CodeKit" service that performs the HTML to image conversion.
- The node relies on the external 0CodeKit API endpoint under the path
/image/html. - No additional environment variables are explicitly required beyond the API key credential.
Troubleshooting
Common issues:
- Invalid or unreachable URL when "Type of Data" is set to URL may cause failures.
- Malformed or invalid HTML code can lead to unexpected results or errors.
- Incorrect JSON format in the "Options HTML to Image" property may cause parsing errors.
- Missing or invalid API key credential will prevent successful API calls.
Error messages:
- Network or timeout errors indicate connectivity issues with the external API.
- Authentication errors suggest problems with the provided API key.
- Validation errors may occur if required properties are missing or incorrectly formatted.
Resolutions:
- Verify URLs are accessible and correct.
- Validate HTML code before input.
- Ensure JSON options are well-formed.
- Confirm API key credentials are correctly configured in n8n.
Links and References
- n8n Expressions Documentation — for using expressions in variable names.
- 0CodeKit API documentation (not publicly linked here) for detailed options on HTML to image conversion parameters.