//assuming you have a table with an ID of src_table var my_svg = '' var table_offset = $('#src_table').offset(); $('#src_table').find('td').each(function() { //Add a rectangle for each
in the same place in SVG as the
is in relation to the top left of where the table is on page my_svg += ''; //Text is assumed to be in a
tag. If it's not, just use the .html() of the
element (this).children('p').each(function(){ t_offset = $(this).offset(); var this_text = ''; // Look for tags and split them onto new lines. var this_lines = $(this).html().split(' '); for(var i=0;i'+this_lines[i]+''; } this_text += ''; my_svg += this_text; }) } }); my_svg += '
'; //Either append my_svg to a div or pass the code onto whatever else you need to do with it.