How to create a picture according to a grid table?

Now I have some data to show in a grid table,now I want to show the data in a picture so that the other people can not get the data from the web,What tool can change a gird to a picture?

Answers 1

  • Best way is probably canvas.

    <canvas id="canvas" style="border:2px solid black;" width="200" height="200"></canvas>
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");
    var data = "<svg xmlns='' width='200' height='200'>" +
                 "<foreignObject width='100%' height='100%'>" +
                   "<div xmlns='' style='font-size:20px'>" +
                      "<table border='1'><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr><tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table>" +
                   "</div>" +
                 "</foreignObject>" +
    var DOMURL = self.URL || self.webkitURL || self;
    var img = new Image();
    var svg = new Blob([data], {type: "image/svg+xml;charset=utf-8"});
    var url = DOMURL.createObjectURL(svg);
    img.onload = function() {
        ctx.drawImage(img, 0, 0);
    img.src = url;

Related Articles