Reputation: 471
Is it possible to add a tab space before the beginning of the text in pdfmake. I did try "\t" for this but it does not work when we add it to the initial or before the string starts.
this is what i tries out
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]
> }
>
> }
presently my output is:-
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.
What iam looking for is a tab space before "Investing in a granulation"
Upvotes: 3
Views: 11673
Reputation: 814
updated solution.
{ text: 'My Text', preserveLeadingSpaces: true}
Upvotes: 2
Reputation: 61
Try this one \u200B\t
, it's a zero width space followed by a tab.
Other solutions can be found here: https://github.com/bpampuch/pdfmake/issues/1566
Upvotes: 6
Reputation: 471
Add multiple "\t" to the initial string for tab space effect.
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]
> }
>
> }
Upvotes: 4