Footer not working
I'm trying to create a simple footer on my PDF and I find this If i use this simple HTML code
<html>
<body>
Test
<footer>asd</footer>
</body>
</html>
This error show up on the console:
jsPDF PubSub Error Maximum call stack size exceeded RangeError jsPDF.min.js:168
And this is the resulting PDF:

856 pages all white! This is the code I use to generate the PDF
doc.fromHTML(html, 100, 15, {
'width': 350,
'elementHandlers': {}
},function(e){
doc.save("test.pdf") ;
});
Using jsPDF 1.0.272-git Built on 2014-09-29T15:09
Up! You can try in your example site just by paste this:
var doc = new jsPDF();
var html = "<html><body>Test<footer>asd</footer></body></html>"
// We'll make our own renderer to skip this editor
var specialElementHandlers = {
'#editor': function(element, renderer){
return true;
}
};
// All units are in the set measurement for the document
// This can be changed to "pt" (points), "mm" (Default), "cm", "in"
doc.fromHTML(html, 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
If you just remove the
still not working with latest
I think the problem is caused by this line: https://github.com/MrRio/jsPDF/blob/master/jspdf.plugin.from_html.js#L778
if (this.pdf.internal.pageSize.height - this.pdf.margins_doc.bottom < this.y + this.pdf.internal.getFontSize()) {
...
this.pdf.addPage();
...
}
There is a comparison of mm values, but this.pdf.internal.getFontSize() returns a pt value which is obviously bigger. So you can never write a footer because it always seems to be to close to the bottom of the page and every time a new page is added...
Multiplying this.pdf.internal.getFontSize() with 25.4/72 solved this problem for me.
Btw. the missing unit conversion caused some problems with tables, too.
Any update about this? I as well can't seem to get footers to work...
In current version, the font size is still not multiplied with the scaleFactor
We are closing this issue, because we will not support any longer fromHTML and addHTML.
Explaination:
We are working on a new html2pdf plugin, which will be based on html2canvas and our context2d plugin. This should lead to more reliable results for your projects. And it will give us the time to focus on the core functionality of pdf-generation because we will not use our energy for writing/supporting/extending 2 html plugins. If you still want to use addHTML or fromHTML you can still use jsPDF 1.4.1.
Best Regards