bubkoo / html-to-image

✂️ Generates an image from a DOM node using HTML5 canvas and SVG.
MIT License
5.66k stars 524 forks source link

Blank image with 1.6.2 version #160

Closed Davids89 closed 2 years ago

Davids89 commented 3 years ago

Since I updated to 1.6.2, everytime I get a screenshot I get only a blank image. I was checking the last commits and I saw it was changed the way to clone nodes.

Expected Behavior

With previous version I got a correct screenshot.

Current Behavior

If I update to 1.6.2, automatically I get blank screenshot.

This is how i got the screenshot since I installed the package.

const element = document.querySelector(identifier)

const params = {
    pixelRatio: 1,
    quality: 1
}

toJpeg(element, params).then(dataUrl => {
    // I have here my image in base64
}).catch(() => {
   // throw error
})

Thank you.

vivcat[bot] commented 3 years ago

👋 @Davids89

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

mgw-sbex commented 3 years ago

If blank is the same as black, I'm seeing this too on MacOS Catalina with html-to-image 1.7.0

Here is my code: saveAs(blob, fileName) { var elem = window.document.createElement('a'); elem.href = blob elem.download = fileName; elem.style = 'display:none;'; (document.body || document.documentElement).appendChild(elem); if (typeof elem.click === 'function') { elem.click(); } else { elem.target = '_blank'; elem.dispatchEvent(new MouseEvent('click', { view: window, bubbles: true, cancelable: true } )); } URL.revokeObjectURL(elem.href); elem.remove(); }

async getPng(elem){ let blob = await htmlToImage.toPng(elem); return(blob); }

capture(id) { let elem = document.getElementById(id); if (typeof(elem) === undefined) { console.log('capture: elem undefined' + id) return; } if (elem != null) { this.getPng(elem) .then((response) => this.saveAs(response, 'instantreplay.png')); } };

FYI My image is: image-string.zip You can see the one icon in the upper right. The remainder of the image is an iframe playing a video. There are no CORS errors in the console (or any errors)

vivcat[bot] commented 3 years ago

Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

Thanks for being a part of the Antv community! 💪💯

Cedtron commented 3 years ago

hello i think am having the same issue it shows black on the downloaded image like it dosenot read the background image of the my CSS

vivcat[bot] commented 2 years ago

Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

Thanks for being a part of the Antv community! 💪💯

vannyle commented 2 years ago

Hello, I have the same problem. Any workarounds?

Davids89 commented 2 years ago

@vannyle I downgraded the version to 1.6.1 to fix it temporary.

vivcat[bot] commented 2 years ago

Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

Thanks for being a part of the Antv community! 💪💯

vivcat[bot] commented 2 years ago

Hey again! It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Thanks again for being part of the Antv community! 💪💯

SalahAdDin commented 2 years ago

Any answer here?

vivcat[bot] commented 1 year ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.