Blank PNG / Tainted canvases may not be exported (not using images)

后端 未结 1 711
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-22 16:59

I am trying to export a fairly simple html to canvas and then png. To do so, I am using rasterizeHTML (http://cburgmer.github.io/rasterizeHTML.js/). The problem that I am facing

1条回答
  •  别那么骄傲
    2021-01-22 17:01

    There are two things at work here:

    1. You should wait for rasterizeHTML.drawHTML to finish before expecting anything from the canvas:

      
      rasterizeHTML.drawHTML('
    2. Safari & Webkit cannot read back from the canvas once HTML (actually a SVG) has been drawn there. See https://github.com/cburgmer/rasterizeHTML.js/wiki/Browser-issues#wiki-webkit. A bug has been filed with both Chrome and Safari (again, see the link), but until then Firefox sadly is the only browser that allows you to read form it.

    0 讨论(0)
提交回复
热议问题