You must Sign In to post a response.
  • Category: JQuery

    Capture div using html2canvas

    hi all

    in my home.aspx, iam displaying a map dinamically in a div

    now i want to capture that div from home.aspx page and display that in child.aspx page div

    iam using the following code in child.aspx, but nothing is displaying

    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="js/html2canvas.js"></script>
    <script type="text/javascript" src="js/jquery.plugin.html2canvas.js"></script>
    <script type="text/javascript">

    function Capture() {

    //targetdiv is the home.aspx div

    html2canvas($("#targetdiv"), {

    //displaydiv is the div in chid.aspx

    onrendered: function (displaydiv) {
    width: 300,
    height: 300
  • #762161
    Hello Rishe,

    Try this code :

    <style type="text/css">
    div {
    height: 100px;
    width: 100px;
    background-color: #9900FF;
    <script type="text/javascript" src="html2canvas.js"></script>
    <script type="text/javascript" src="jquery-1.9.1.js"></script>
    <script language="javascript">
    $(document).ready(function() {
    html2canvas($("#mydiv"), {
    onrendered: function(canvas) {
    var myImage = canvas.toDataURL("image/png");;
    <div id="mydiv">

    Go through the below link of Google Developers :

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • Sign In to post your comments