Puddinq.com sharing knowledge
';

HTML to image

HTML to image

je hebt nodig html2canvas en canvas2image

(function ($, root, undefined) {

    'use strict';

    $(document).ready(function($) {
        $("#download-calender").click(function(e) {
            e.preventDefault();
            var img = {
                image_pro: null
            };
            html2canvas(document.getElementById('section-calender-print')).then(function(canvas) { cp(canvas); }); // here send canvas to cp
            var cp = function(canvas) {
                var image_cv = Canvas2Image.convertToPNG(canvas); //to generate an image from canvas
                img.image_pro = image_cv.getAttribute('src');
                var a = document.createElement('a');
                a.download = "calender.png";
                a.href = $(image_cv).attr('src');
                document.body.appendChild(a);
                a.click();
                document.body.removeChild(a);
            };
        });
    });

})(jQuery, this);