let text = `Hello world
this is the second line
and there is space before this line`;
page.drawText(text, { font: timesRoman,
size: 12,
lineHeight: timesRoman.heightAtSize(12) + 3,
x: 88.56, // 1.23" from left
y: 648, // 1" from top
maxWidth: 434.88, // 1.23" margin on each side
});
Would render:
Hello world
this is the second line
and there is space before this line
(the extra \n or \r\n lines are ignored)
A workaround is to type an invisible character (a Space) on each blank line. This would force the new lines to be rendered.
How did you attempt to do it?
See above.
What actually happened?
The multiple \r\n lines were ignored.
What did you expect to happen?
Each blank line containing only \r\n should move the pointer down a full line.
How can we reproduce the issue?
see the above example.
Version
latest
What environment are you running pdf-lib in?
Node
Checklist
[X] My report includes a Short, Self Contained, Correct (Compilable) Example.
[X] I have attached all PDFs, images, and other files needed to run my SSCCE.
What were you trying to do?
Rendering text such as:
Would render:
(the extra \n or \r\n lines are ignored)
A workaround is to type an invisible character (a Space) on each blank line. This would force the new lines to be rendered.
How did you attempt to do it?
See above.
What actually happened?
The multiple \r\n lines were ignored.
What did you expect to happen?
Each blank line containing only \r\n should move the pointer down a full line.
How can we reproduce the issue?
see the above example.
Version
latest
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response