(SOLVED !)
I've encountered with this problem & i solved it . First of ALL you should check that you have included the CDN HTML2CANVAS.js in your script links in your head tag . To do this you should paste this script in your head tag , after the jquery CDN :
(add this script below into your head tag )
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
in this CDN , the function 'toDataURL' have been defined & if you go to this link and search (with CTRL+F) on this script page , you could find toDataURL function . (which has been defined in this CDN)
NOW my head tag is like this below and it works :
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
</head>