1001fx - NoCode functions icon

1001fx - NoCode functions

1001fx is a set of functions for any automation platform. Our functions are simple, very well tested, scalable and offer features that most automation platforms do not offer.

Actions74

images → Convert HTML String or URL to an Image

AI-generated

Overview

This node operation converts either an HTML string or a URL into an image (PNG or JPEG). It is useful for automating the generation of images from dynamic HTML content, such as rendering reports, invoices, certificates, or visualizing web pages/screenshots. You can specify custom dimensions, full-page capture, and perform variable replacements within your HTML before rendering.

Practical examples:

  • Generating branded certificates from HTML templates.
  • Creating social media share images from dynamic content.
  • Capturing website screenshots for monitoring or archiving.
  • Rendering invoices or receipts as images for email attachments.

Properties

Name Meaning
HTML HTML to render as an image. Supports Tailwind classes via <tw> tags and several font families (Alegreya, Barlow, Inter, Lato, Montserrat, OpenSans, Oswald, Poppins, PTSans, Raleway, Roboto).
URL URL to render as an image.
Screenshot Full Page If enabled, captures the entire page in the screenshot; otherwise, only the visible viewport. Defaults to false.
Output Format The desired output format. Options: png, jpeg.
Width Desired output width (in pixels).
Height Desired output height (in pixels).
Replacements Input Mode How to provide key-value pairs for replacements in your HTML. Options: Expression (JSON input), Manual (form-based entry).
Replacements Key-value pairs to replace placeholders (e.g., {{KEY}}) in your HTML. Provided as JSON (if "Expression" mode) or as a list of entries (if "Manual" mode).
Binary Property Name of the binary property where the resulting image will be stored. Required. Default: data.

Output

  • Binary Data:
    The node outputs the generated image as binary data under the property name specified by "Binary Property".
    • The binary field contains the image file (PNG or JPEG).
    • Any existing binary properties on the input item are preserved.
  • JSON Output:
    The original JSON data from the input is preserved alongside the new binary property.

Example output structure:

{
  "json": { /* original input fields */ },
  "binary": {
    "data": {
      "data": "<base64-encoded image>",
      "fileName": "output.png",
      "mimeType": "image/png"
    }
  }
}

(The property name under "binary" may differ if you set a custom value for "Binary Property")

Dependencies

  • External Service: Requires access to the 1001fx API.
  • API Credentials: You must configure the 1001fxApi credential in n8n.
  • Environment: No special environment variables required beyond standard n8n setup.

Troubleshooting

  • Common Issues:

    • Missing or Invalid Credentials: Ensure the 1001fxApi credential is correctly configured.
    • Invalid HTML or URL: Malformed HTML or unreachable URLs may result in errors or blank images.
    • Incorrect Binary Property Name: If the "Binary Property" does not match what downstream nodes expect, they may not find the image.
    • Replacements Not Working: Ensure that placeholders in your HTML use the correct {{KEY}} syntax and that replacement keys match exactly.
  • Error Messages:

    • "error": "Request failed with status code 4xx/5xx": Indicates an issue with the API request (invalid input, authentication, etc.).
    • "error": "Cannot read property 'split' of undefined": May occur if the API response headers are missing expected fields—check your input and credentials.
    • "error": "Unexpected token < in JSON...": The API returned HTML (possibly an error page) instead of JSON/binary; check your parameters and API status.

Resolution Steps:

  • Double-check all required fields, especially "HTML" or "URL".
  • Verify your API credentials.
  • Test your HTML separately to ensure it renders as expected.
  • Use the n8n execution log to inspect raw error messages for more details.

Links and References

Discussion