JsPdf add HTML colspan support
I am using JsPDF
PDF for export. It doesn't support HTML or CSS table column. So how can I export a complete pdf with a HTML worksheet with CSS.
I have already tried with jsPlugins
<script type="text/javascript" src="myproject/js/highcharts/jspdf.js"></script>
<script type="text/javascript" src="myproject/js/highcharts/jspdf.debug.js"></script>
<script type="text/javascript" src="myproject/js/highcharts/jspdf.plugin.from_html.js"></script>
Html
<table id="mytable">
<tr>
<td>headding 1</td>
<td>headding 2</td>
<td>headding 3</td>
</tr>
<tr>
<td>col 1</td>
<td colspan="2" >col 2 and 3</td>
</tr>
<tr>
<td>col 1</td>
<td>col 2</td>
<td>col 3</td>
</tr>
</table>
Javascript
var specialElementHandlers = {
'#bypassme': function (element, renderer) {
return true;
}
};
doc.fromHTML($('#mytable').get(0), xx, yy+=60, {
'width': 540,
'elementHandlers': specialElementHandlers
});
PDF output
+3
source to share
1 answer
In jsPDF, directly adding CSS to pdf is not supported. But you can add constrained styles using methods. If you are using php you can try mpdf. It supports adding css directly for java back end try iText and in .net you can try iTextSharp
http://mrrio.github.io/jsPDF/doc/symbols/jsPDF.html
0
source to share