1

是否可以在pdfmake中的文本开头之前添加一个制表符空间。我确实为此尝试了“\ t”,但是当我们将它添加到初始或字符串开始之前它不起作用。

这就是我尝试的

var dd = {
>         content: [{
>     text: 'Cost',
>     style: 'header',
>     decoration: 'underline' }, {
>     text: '\tInvesting in a granulator is a wise move because of the enormous long-term savings of virgin raw materials and other benefits
> that you gain.',
>     style: 'para' }],
>         styles: {
>             header: {
>                 fontSize: 20,
>                 bold: true
>             },
>             para: {
>                 fontSize: 10,
>                 margin: [0, 9, 0, 9]             
>             }
> 
> }

目前我的输出是: -

成本

投资造粒是明智之举,因为可以长期节省大量原始原材料和其他好处。

我正在寻找的是“投资造粒”之前的选项卡空间

4

2 回答 2

3

将多个“\t”添加到初始字符串以获得制表符空间效果。

var dd = {
>         content: [{
>     text: 'Cost',
>     style: 'header',
>     decoration: 'underline' }, {
>     text: '\t\t\t Investing in a granulator is a wise move because of the enormous long-term savings of virgin raw materials and other benefits
> that you gain.',
>     style: 'para' }],
>         styles: {
>             header: {
>                 fontSize: 20,
>                 bold: true
>             },
>             para: {
>                 fontSize: 10,
>                 margin: [0, 9, 0, 9]             
>             }
> 
> }
于 2015-12-01T10:09:09.030 回答
3

试试这个\u200B\t,它是一个零宽度空间,后跟一个制表符。

其他解决方案可以在这里找到:https ://github.com/bpampuch/pdfmake/issues/1566

于 2020-04-20T11:41:18.737 回答