niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.48k stars 4.8k forks source link

html2canvas can not get background-image which set by css houdini paint api #3107

Open smk0621 opened 1 year ago

smk0621 commented 1 year ago

using css houdini paint api to set background-image,as following,but the screenshot is blank content, can not get the background-image

@supports ((-webkit-mask: paint(id, type)) or (mask: paint(id, type))) div { background-image: paint(paint-worklet); }

Does html2canvas support this ?

monouowox commented 9 months ago

Yes,so i am.Background-imgae attribute used in css by url() function,function argument is from remote server,use h2htmlcanvas constructer pass it options contain 'useCores:true',but i console it get some logs :Access to image at 'https://' from origin 'http://192.1' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.Why use 'useCores:true' cannot resolve cors?