It appears as though there is no way to prevent pdfmake from striping leading whitespace from a paragraph. Why does it do this? There are many cases where I would want leading whitespace. For example, paragraph indents. Or code snippets.
I would like to put this into my pdf:
{
"sample": {
"json": "nested"
}
}
However, because pdfmake auto-strips leading whitespace, it ends up looking like crap:
{
"sample": {
"json": "nested"
}
}
Am I just missing something?
I also am having this issue.
I was able to hack around the issue with invisible unicode characters, but it's not the best solution IMO:
var str = JSON.stringify({sample: "json"}, undefined, 4);
str = str.replace(/ /g, '\u200B'); //Replace all spaces with invisible unicode
I was also looking into that. Thanks!!
Feature implemented by PR https://github.com/bpampuch/pdfmake/pull/1055.
Most helpful comment
I was able to hack around the issue with invisible unicode characters, but it's not the best solution IMO: