我正在使用pdfmake。我想格式化一个文档,他们在 github 和他们的操场上有很好的例子,但我想知道他们是否在其中提供了所有功能。我觉得它们可能是额外的属性,比如切换字体、添加不同的样式元素或下划线——示例中没有明确共享的东西。也许您所看到的就是您所得到的,仅此而已,但我非常彻底地浏览了 github 页面,并没有找到更详细的功能列表。它似乎与 html 相似,但它似乎没有 html/css 相同的样式功能,如果还有更多内容,请有人指出。
问问题
14138 次
3 回答
18
给你.. 至少,支持以下未注释的样式。我自己试过了。
['font',
'fontSize',
'bold',
'italics',
'alignment',
'color',
'columnGap',
'fillColor',
'decoration',
'decorationStyle',
'decorationColor',
'background',
'lineHeight'
//'tableCellPadding'
// 'cellBorder',
// 'headerCellBorder',
// 'oddRowCellBorder',
// 'evenRowCellBorder',
// 'tableBorder'
]
您可以使用上述样式,如下所示。
var dd = {
content: [
{
text: 'This is a header, using header style',
style: 'header'
}
],
styles: {
header: {
fontSize: 18,
bold: true,
background: '#ff1'
}
}
}
于 2015-09-27T08:03:29.527 回答
0
更新:27/5/2020 来自Github 的 anwer
扩展@Romo 的答案:
[
'font',
'fontSize',
'bold',
'italics',
'alignment',
'color',
'columnGap',
'fillColor',
'decoration',
'decorationStyle',
'decorationColor',
'background',
'lineHeight'
'listType' // <=== Added
]
它接受几个选项:
“无”、“大罗马”、“圆形”、“方形”
于 2020-05-27T19:56:57.867 回答
0
您也可以使用边距,如下所示。
// margin: [left, top, right, bottom]
{ text: 'sample', margin: [ 5, 2, 10, 20 ] },
// margin: [horizontal, vertical]
{ text: 'another text', margin: [5, 2] },
// margin: equalLeftTopRightBottom
{ text: 'last one', margin: 5 }
它来自文档Here。
于 2019-06-22T06:28:25.153 回答