Skip to content

Feature request: Add url option to nodeHtmlToImage #220

Open
@sachinchillal

Description

@sachinchillal

Feature request: Add url option to nodeHtmlToImage

Description

I would like to be able to pass an HTML page link instead of HTML text to the nodeHtmlToImage function, so that I can render the page as an image without having to read the HTML content first.

Example

For example, I want to do something like this:

const nodeHtmlToImage = require('node-html-to-image')

nodeHtmlToImage({
  output: './image.png',
  url: 'http://localhost:3000/black-card.html?index=1&cardPos=bottom&imgPos=bottom' // the link to the HTML page I want to convert to image
})
.then(() => console.log('The image was created successfully!'))

url can be

Use case

This feature would be useful for me because I have a web app that generates dynamic HTML pages based on some parameters, and I want to save them as images for later use. It would be more convenient and efficient to pass the page link directly to the nodeHtmlToImage function, rather than reading the HTML content and passing it as a string.

Alternatives

I have not found any alternatives that can achieve the same functionality as nodeHtmlToImage, but with the url option. If you know any, please let me know.

Additional context

I am using node-html-to-image version 3.3.0 and Node.js version 16.16.0 on Windows 11.

Thank you for your consideration and your great work on this library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions