qq15725 / modern-screenshot

📸 Quickly generate image from DOM node using HTML5 canvas and SVG
https://toolpkg.com/html-to-image
MIT License
504 stars 36 forks source link

背景图是 http 资源时,生成图片有概率丢失 #34

Closed jianghai closed 12 months ago

jianghai commented 1 year ago

background-image: url('https://xx')

qq15725 commented 1 year ago

查看是否传递了太短的 timeout 默认是 30s

domToPng({
  timeout: 30000,
})

查看是否存在加载的网络请求

如果完全没加载,可能需要提供完整的测试样本

lorenzhh commented 1 year ago

I had the same issue, I don't know why it may happens. So I configured the domToPng not to use cache by adding:

fetch: { bypassingCache: true },