我正在输出用户定义的文本,但是由于某些原因,某些文本是随机缩进的。文本仅包含\n
作为特殊字符,没有选项卡或其他任何内容。我不知道为什么会这么做。
这是导致问题发生的原始文本:
"L Shaped zoning areas - Two of them shown on plans. Each L shape consists of run 1 and 2 and Cosists of the following: The height will be 2160mm in the corner and then will taper down to 1310h at either end.\n\n\n:b:Run 1:b:\n\n1 x 5 high corner bay 2160h x 450x450mm\n1 x 5 high add on bay 2160h x 450x450mm\n2 x 2 high add on bays 895h x 450x450mm\n1 x 1 high add on bay \n1 x 1 high end bay\n2 x 2 high add on bays 895h x 450x450mm\n2 x sliding door storage units 848h x 800w x 450d\n8 x single shelves\n1 x single shelf with fabric acoustic panel\n1 x single planter unit\n1 x single display box\n\n\n:b:Run2:b:\n\n1 x 5 high add on bay 2160h x 450x450mm\n2 x 2 high add on bays 895h x 450x450mm\n1 x 1 high add on bay\n1 x 1 high end bay\n2 x sliding door storage units 848h x 800w x 450d\n3 x single shelves\n2 x single shelf with fabric acoustic panel\n1 x single planter unit\n1 x single display box\n"
奇怪的是,如果您添加更多这些“列表”,它们只是换行。除了最后一个列表之外的所有列表都得到这个奇怪的缩进。我不太在乎它的缩进,我想要的是一致的样式。除了最后一个具有此缩进的列表之外,其他所有列表看起来都很奇怪。
Run 1\n1 x 5 high corner bay 2160h x 450x450mm\n1 x 5 high add on bay 2160h x 450x450mm\n2 x 2 high add on bays 895h x 450x450mm\n1 x 1 high add on bay\n1 x 1 high end bay\n2 x 2 high add on bays 895h x 450x450mm\n2 x sliding door storage units 848h x 800w x 450d\n8 x single shelves\n1 x single shelf with fabric acoustic panel\n1 x single planter unit\n1 x single display box\n
演示:https://codesandbox.io/s/1zzxo94orl(在新窗口中打开输出,否则PDF将不会显示)
更新:
我已经发现可以使用.font('Helvetica-Bold').text('')
来解决问题,但是似乎有点棘手。