4

ノードの 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 の文字列を返し、右側にスペースを追加します。

widthオプションを無視しているか、使い方がわかりません。

4

0 に答える 0