0
<canvas width="1050" height="1200" id="canvas1">Sorry, no canvas available</canvas>//

<table id="qwerty">
<tr>
<td>Apple</td>
<td>Mango</td>
</tr>
<tr>
<td>Orange</td>
<td>Grape</td>
</tr>
</table>



<script>
var canvas = document.getElementById("canvas1") 
var ctx = canvas.getContext("2d"); 
ctx.drawImage(img1,0,0);
</script>

I have a HTML table and a canvas with an image drawn on it. Now I need to add that table on to the same canvas Please help me with this

Chandu
  • 1
  • 2
  • see this - http://stackoverflow.com/questions/13903952/can-i-draw-a-table-in-canvas-element – Ruben Karapetyan Dec 19 '16 at 07:02
  • @RubenKarapetyan Thanks but I'm not clear with this xmlns='http://www.w3.org/2000/svg in the svg tag – Chandu Dec 19 '16 at 07:03
  • No easy-out-of-the-box-and-reliable-way. I would recommend this : http://html2canvas.hertzen.com/ The hack mentioned in @RubenKarapetyan link will taint the canvas in all browsers except Edge and Firefox, and hence won't allow you to save it programmatically (since I guess it's what you are after) – Kaiido Dec 19 '16 at 07:04

1 Answers1

0

How about make a container with position = relative and put those canvas and table into the container with position = absolute so we could have 2 layers.

I don't think it is possible to have table in canvas unless graphically draw it.

PhongLK
  • 11
  • 4