rkusa / pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.
MIT License
786 stars 142 forks source link

The add() method of the table cell text method does not respect the "textAlign" or "alignment" properties #318

Closed ardentia closed 11 months ago

ardentia commented 1 year ago

Whenever text is being gradually added to a table cell, along with the additional textAlign or alignment properties, the text that I added does not align to the right, as I would expect.

The problem is reproduced here: https://stackblitz.com/edit/js-f1ncp7?file=index.js

As you can see, the text under the last table column is not at all right-aligned.

rkusa commented 11 months ago

.add() is indeed not changing the text alignment, you have to define it when calling .text(): tr.cell().text({textAlign: 'right'})

Thanks for providing a stackblitz to easily reproduce your question.