如何在pdfmake文本的初始部分添加一个tab-space

How to add a tab-space at the inital part of pdfmake text

是否可以在 pdfmake 中的文本开头之前添加一个制表符 space。我确实为此尝试了“\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]             
>             }
> 
> }

目前我的输出是:-

Cost

Investing in a granulation is a wise move because of the enormous long-term savings of virgin raw materials and other benefits that you gain.

我要找的是 "Investing in a granulation"

之前的选项卡 space

在制表符的初始字符串中添加多个“\t”space效果。

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]             
>             }
> 
> }

试试这个 \u200B\t,它是一个 zero width space 后跟一个制表符。

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