如何自定义 AmChart 生成的 PDF 的页眉和页脚?
How to customize the Header and footer for AmChart generated PDF?
我能够创建 amChart 库中已预定义的 PDF。
我想创建带有行数和页码的页眉和页脚。在我下面的代码中,我只能显示文本。
'export': {
'enabled': true,
'header': 'AnyText',
'footer': 'Page 1 of 1',
'dateFormat': 'YYYY-MM-DD HH:NN:SS',
'pageOrigin': false,
'fileName': 'Graph',
'menu': [{
'class': 'export-main',
'menu': [
'PDF',
'PRINT'
]
}]
}
如何通过添加行和空格来自定义页眉和页脚?
我浏览了 AmChart 网站,但没有找到任何信息(也许我错过了)。
AmCharts 使用 pdfMake under the hood for its PDF export functionality. To override the header and footer, you can pass in a pdfMake object, which is the same as the docDefinition object in the pdfMake documentation 覆盖布局或其他设置,例如页眉和页脚。页眉和页脚可以是 return 带有格式信息的对象的静态字符串或动态函数,例如
'export': {
'enabled': true,
'pdfMake': {
'header': 'AnyText',
'footer': function(currentPage, pageCount) {
return {
text: 'Page ' + currentPage + ' of ' + pageCount,
alignment: 'center'
}
}
}
'dateFormat': 'YYYY-MM-DD HH:NN:SS',
'pageOrigin': false,
'fileName': 'Graph',
'menu': [{
'class': 'export-main',
'menu': [
'PDF',
'PRINT'
]
}]
}
我能够创建 amChart 库中已预定义的 PDF。
我想创建带有行数和页码的页眉和页脚。在我下面的代码中,我只能显示文本。
'export': {
'enabled': true,
'header': 'AnyText',
'footer': 'Page 1 of 1',
'dateFormat': 'YYYY-MM-DD HH:NN:SS',
'pageOrigin': false,
'fileName': 'Graph',
'menu': [{
'class': 'export-main',
'menu': [
'PDF',
'PRINT'
]
}]
}
如何通过添加行和空格来自定义页眉和页脚?
我浏览了 AmChart 网站,但没有找到任何信息(也许我错过了)。
AmCharts 使用 pdfMake under the hood for its PDF export functionality. To override the header and footer, you can pass in a pdfMake object, which is the same as the docDefinition object in the pdfMake documentation 覆盖布局或其他设置,例如页眉和页脚。页眉和页脚可以是 return 带有格式信息的对象的静态字符串或动态函数,例如
'export': {
'enabled': true,
'pdfMake': {
'header': 'AnyText',
'footer': function(currentPage, pageCount) {
return {
text: 'Page ' + currentPage + ' of ' + pageCount,
alignment: 'center'
}
}
}
'dateFormat': 'YYYY-MM-DD HH:NN:SS',
'pageOrigin': false,
'fileName': 'Graph',
'menu': [{
'class': 'export-main',
'menu': [
'PDF',
'PRINT'
]
}]
}