Pdfmake: Leading/hanging paragraph indent

Created on 30 Apr 2017  ·  6Comments  ·  Source: bpampuch/pdfmake

As far as I can tell it turns out to be really easy to add this feature. I'd send a pull request but I don't have unit tests yet. It's a three-line patch to src/textTools.js

If I send a pull request, will you help me figure out what scenarios I need to test? I'm not very good at working on other people's code yet.

Most helpful comment

PDFmake trim whitespaces, becouse of that \t does not works.

I found a solution: using Unicode white spaces works using \u200B followed by \t

{text: '\u200B\t\t\tÉ um fato conhecido de todos que um leitor se distrairá com o conteúdo de texto legível de uma página quando estiver examinando sua diagramação.', alignment: 'justify'}

All 6 comments

Help is welcome.
Leading indent was implemented by PR https://github.com/bpampuch/pdfmake/pull/1054.

PDFmake trim whitespaces, becouse of that \t does not works.

I found a solution: using Unicode white spaces works using \u200B followed by \t

{text: '\u200B\t\t\tÉ um fato conhecido de todos que um leitor se distrairá com o conteúdo de texto legível de uma página quando estiver examinando sua diagramação.', alignment: 'justify'}

Thanks @enniosousa :) It took me long time to find a solution for that. And only your solution works.

It's really impossible to make indent while using separate {text: "bla bla", style: 'bla bla'} objects inside of columns like:

content = [
  {
    columns: [
    {
        width: '50%',
        text: [
          {text: "bla bla", style: "indentLineWithMarginOrLeadingIndent"},
          ...
        ]
    },
    {
      width: '50%',
      text: [
        { text: "bla bla", style: "indentLineWithMarginOrLeadingIndent" },
        ...
      ]
    }
    ]
  }
];

All styles work for these separate text object, except "margin". Actually 'stack' object helps to solve that. It accepts all margin styles but brings other problems like, last stack object of the column object disappears when you insert a new line out of column (if your columns has different heights).

{text: ' "sample": {', preserveLeadingSpaces: true},

No plan to support hangingIndent similarly as leadingIndent?

PDFmake trim whitespaces, becouse of that \t does not works.

I found a solution: using Unicode white spaces works using \u200B followed by \t

{text: '\u200B\t\t\tÉ um fato conhecido de todos que um leitor se distrairá com o conteúdo de texto legível de uma página quando estiver examinando sua diagramação.', alignment: 'justify'}

'\u200B' will display as square in some font...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qgliu picture qgliu  ·  3Comments

dmatesic picture dmatesic  ·  3Comments

kamilkp picture kamilkp  ·  3Comments

sayjeyhi picture sayjeyhi  ·  3Comments

ValeSauer picture ValeSauer  ·  3Comments