admin管理员组文章数量:1405636
So,
I've successfully modified everything else but can't figure how to change just the footers font size, it is now way too big pared to table font itself.
let pdf = new jsPDF({orientation: 'l'});
let res = pdf.autoTableHtmlToJson(document.getElementById('capture'));
const totalPagesExp = '{total_pages_count_string}';
let height = pdf.internal.pageSize.getHeight();
const footer = function(res) {
let str = 'Sivu ' + res.pageCount;
if (typeof pdf.putTotalPages === 'function') {
str = str + ' / ' + totalPagesExp;
str = str + ' -- ' + moment().format('L').toString();
}
//PROBLEM GOES HERE
pdf.text(str, 5, height - 5, {
fontSize: 5
});
};
pdf.autoTable(
res.columns,
res.data,
{margin: {top: 25, bottom: 15},
styles: {overflow: 'linebreak',
fontSize: 6},
showHeader: 'everyPage',
afterPageContent: footer,
theme: 'plain'});
if (typeof pdf.putTotalPages === 'function') {
pdf.putTotalPages(totalPagesExp);
}
pdf.save( 'file.pdf');
Footer itself is iterating nicely, page numbers show up as they are suppose to, but even if i pass options object into psd.text()
as stated in documentation, it still wont change the font size.
Documentation for text
So,
I've successfully modified everything else but can't figure how to change just the footers font size, it is now way too big pared to table font itself.
let pdf = new jsPDF({orientation: 'l'});
let res = pdf.autoTableHtmlToJson(document.getElementById('capture'));
const totalPagesExp = '{total_pages_count_string}';
let height = pdf.internal.pageSize.getHeight();
const footer = function(res) {
let str = 'Sivu ' + res.pageCount;
if (typeof pdf.putTotalPages === 'function') {
str = str + ' / ' + totalPagesExp;
str = str + ' -- ' + moment().format('L').toString();
}
//PROBLEM GOES HERE
pdf.text(str, 5, height - 5, {
fontSize: 5
});
};
pdf.autoTable(
res.columns,
res.data,
{margin: {top: 25, bottom: 15},
styles: {overflow: 'linebreak',
fontSize: 6},
showHeader: 'everyPage',
afterPageContent: footer,
theme: 'plain'});
if (typeof pdf.putTotalPages === 'function') {
pdf.putTotalPages(totalPagesExp);
}
pdf.save( 'file.pdf');
Footer itself is iterating nicely, page numbers show up as they are suppose to, but even if i pass options object into psd.text()
as stated in documentation, it still wont change the font size.
Documentation for text
Share Improve this question asked Dec 12, 2018 at 12:10 ClomezClomez 1,5225 gold badges27 silver badges44 bronze badges1 Answer
Reset to default 4pdf.setFontSize(5);
and remember to put it before putting the text into footer,
pdf.setFontSize(5);
pdf.text(str, 5, height - 5, {
styles: { fontSize: 5 },
});
本文标签: javascriptFont size for footerin jsPDF autoTableStack Overflow
版权声明:本文标题:javascript - Font size for footer, in jsPDF autoTable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744322433a2600566.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论