pdfmake API?是否有样式、字体和功能的列表?

pdfmake API? Is there a list of styles, fonts, capabilities?

我正在使用 pdfmake。我想格式化一个文档,他们在 github 和他们的操场上有很好的例子,但我想知道他们是否提供了其中的所有功能。我感觉它们可能是额外的属性,比如切换字体、添加不同的样式元素或下划线——示例中没有明确共享的东西。也许所见即所得,仅此而已,但我非常彻底地浏览了 github 页面,没有找到更详细的功能列表。它看起来与 html 非常相似,但它似乎没有 html/css 相同的样式功能,如果还有更多内容,请有人指出。

给你..至少,支持以下未注释的样式。我自己试过了。

['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'
        }
    }
}

您也可以使用保证金,如下所示。

// 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

更新:2020 年 5 月 27 日来自 Github's anwer

扩展@Romo 的回答:

[
'font',
'fontSize',
'bold',
'italics',
'alignment',
'color',
'columnGap',
'fillColor',
'decoration',
'decorationStyle',
'decorationColor',
'background',
'lineHeight'
'listType' // <=== Added  
]

它接受几个选项:

'none', 'upper-roman', 'circle', 'square'