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

时间:2015-08-29 22:06:23

标签: css html5 pdf-generation pdfmake

我正在使用pdfmake。我想格式化一个文档,他们在github和他们的操场上有很好的例子,但我想知道他们是否具有其中的所有功能。我感觉他们可能是其他属性,如切换字体,添加不同的样式元素或下划线 - 在示例中没有明确共享的内容。也许你所看到的就是你得到的东西,但我只是彻底地浏览了github页面并没有找到更详细的功能列表。似乎hella类似于html但它似乎没有相同的html / css样式功能,如果有更多的东西可以有人请指出它。

3 个答案:

答案 0 :(得分:12)

这里你去..至少,支持下面未注释的样式。我亲自尝试过。

ValidationAttribute.IsValid

您可以使用以上样式,如下所示。

['font',
'fontSize',
'bold',
'italics',
'alignment',
'color',
'columnGap',
'fillColor',
'decoration',
'decorationStyle',
'decorationColor',
'background',
'lineHeight'
//'tableCellPadding'
// 'cellBorder',
// 'headerCellBorder',
// 'oddRowCellBorder',
// 'evenRowCellBorder',
// 'tableBorder'
]

答案 1 :(得分:0)

您也可以使用margin,如下所示。

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

答案 2 :(得分:0)

更新:Github's anwer的27/5/2020

扩展@Romo的答案:

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

它接受几个选项:

“无”,“上罗马”,“圆形”,“正方形”