我尝试使用节点的pdfkit来制作PDF,但我遇到了与文字宽度相关的一些问题。
我想要的结果是这样的。
Overall comments: This is the comment
that will display here bla bla
extra text here
但我现在使用的代码是
Overall comments: This is the comment
that will display here blab bla extra text here
要编写这段文字,请使用以下代码:
doc.font('Courier-Bold').text(padRight('Overall Comments:',28),{continued: true});
doc.font('Courier').text(audit.comment,{width: 100,align: 'justify'});
如果audit.comment是右边的文本,padRight返回固定大小为28的字符串,在右边添加空格。
它似乎忽略了宽度选项,或者我不知道如何使用它。