We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draw multiline text with empty line and maxWidth param
function page.drawText have different result when pass maxWidth param and text with empty line for example:
page.drawText( `first\n` + `\n` + `second\n` , { x: 25, y: 100, font, size: 24, color: rgb(1, 0, 0), lineHeight: 24, opacity: 0.75, maxWidth: 500, }, )
result :
call page.drawText without maxWidth
page.drawText( `first\n` + `\n` + `second\n` , { x: 25, y: 100, font, size: 24, color: rgb(1, 0, 0), lineHeight: 24, opacity: 0.75, }, )
result:
as you can see, without maxWidth parameter the empty line is also present
empty line not rendered
few tests that should passed
https://github.com/Hopding/pdf-lib/blob/master/tests/utils/strings.spec.ts#L23
it(`handles trailing newlines`, () => { const input = 'foo\n'; const expected = ['foo', '']; const actual = breakTextIntoLines(input, [], 21, computeTextWidth); expect(actual).toEqual(expected); }); it(`handles empty lines`, () => { const input = 'foo\n\nbar'; const expected = ['foo', '', 'bar']; const actual = breakTextIntoLines(input, [], 21, computeTextWidth); expect(actual).toEqual(expected); });
see above
1.17.1
Browser
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What were you trying to do?
draw multiline text with empty line and maxWidth param
How did you attempt to do it?
function page.drawText have different result when pass maxWidth param and text with empty line for example:
result :
call page.drawText without maxWidth
result:
as you can see, without maxWidth parameter the empty line is also present
What actually happened?
empty line not rendered
What did you expect to happen?
few tests that should passed
https://github.com/Hopding/pdf-lib/blob/master/tests/utils/strings.spec.ts#L23
How can we reproduce the issue?
see above
Version
1.17.1
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: