HTML2Canvas does not render full div, only what is visible on screen?

前端 未结 10 1853
甜味超标
甜味超标 2020-12-13 04:02

I\'m trying to use HTML2Canvas to render the contents of a div. Here is the code:

var htmlSource = $(\'#potenzial-page\')[0];

$(\'#btn\').on(\"click\", fun         


        
10条回答
  •  半阙折子戏
    2020-12-13 04:39

    A solution that worked for me was to add the following to my css:

    .html2canvas-container { width: 3000px !important; height: 3000px !important; }
    

    It prevents html2canvas from limiting the rendering to the viewable area (which seems to be the default).

    See here: https://github.com/niklasvh/html2canvas/issues/117

提交回复
热议问题