html2canvas error: Uncaught Error: IndexSizeError: DOM Exception 1

前端 未结 4 1778
慢半拍i
慢半拍i 2020-12-19 04:44

I am using html2canvas to convert a div on a canvas. Like this:




        
4条回答
  •  -上瘾入骨i
    2020-12-19 04:58

    i would say that you probably have some float attribute or fixed position on a div that cause a container to be of height 0 while the content has a superior height. i had this problem before caused by it because html2canvas can't handle a content larger than it's container. for example, if you have something like this:

    html2canvas will raise this error because div has a height of 0 while the img is bigger. possible correction will be to force height of div to be supperior to image height.

    thanks Saturnix for your detailed answer, you helped me find out where it came from.

    i hope this could help you,

提交回复
热议问题