我有一个字符串想要用作 PDF 文档的标题。我尝试使用以下代码来实现此目的,但遇到了背景颜色的问题。它不会将背景颜色应用于整行,而是仅出现在文本正下方。对于解决此问题的任何帮助,我将不胜感激。
var dd = {
content: [
{
text: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
style: 'header'
},
],
styles: {
header: {
fontSize: 18,
bold: true,
margin: [0, 0, 0, 10],
background:'blue',
color: 'white',
alignment:'center'
}
},
defaultStyle: {
// alignment: 'justify'
}
}
Run Code Online (Sandbox Code Playgroud) pdfmake ×1