Get image of div using html2canvas not working with previous version
<p>I want to make image of <code>div</code> using <code>html2canvas</code> but my code is not working well.  <strong>Just install the new version of html2canvas and this is working fine</strong>
See whats the problem with previous version here is code</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>html2canvas($("#canvas-preview"), {
  onrendered: function(canvas) {
    theCanvas = canvas;
    document.body.appendChild(canvas);

    // Convert and download as image 
    //Canvas2Image.saveAsPNG(canvas); 
    $("#img-out").append(canvas);
    // Clean up 
    //document.body.removeChild(canvas);
  }
});</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>#canvas-preview {
  width: 200px;
  border: 1px solid #000;
  box-sizing: border-box;
  position: relative;
  border: 1px solid red
}
#canvas-preview::before,
#image-container::before {
  background-color: green;
  content: '';
  display: block;
  height: 100%;
  position: absolute;
  width: 100%;
  z-index: 1;
}
#custom-canvas {
  margin: 10px;
  color: #fff;
  z-index: 2;
  position: relative;
  font-family: 'Anton';
  border: 1px solid green;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="canvas-preview" class=""&gt;
  &lt;div id="custom-canvas"&gt;
    &lt;div&gt;
      &lt;span line-num="1" class="text-lines" style="font-size: 76.7025px;"&gt;ARFAN&lt;/span&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;span line-num="2" class="text-lines" style="font-size: 67.7685px;"&gt;HAIDER&lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div id="image-out"&gt;&lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>This function get the image but not same as <code>div</code> it get only half a image not full. what the problem is with this code. ?</p>

<p><strong>UPDATE</strong></p>

<p>Output look like this image.</p>

<p><a href="https://i.stack.imgur.com/PA2vd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PA2vd.png" alt="enter image description here"></a></p>