natancabral / pdfkit-table

Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin)
MIT License
93 stars 59 forks source link

Allow to set text `features` to support rtl #89

Open moshfeu opened 9 months ago

moshfeu commented 9 months ago

The way rtl is supported in pdfkit is by passing features prop to the text function

https://github.com/foliojs/pdfkit/issues/219#issuecomment-1895751382

Please allow to pass the features props to the table function. Something like

const table = {
  title: "כותרת",
  subtitle: "Subtitle",
  headers: [ "Country", "Conversion rate", "Trend" ],
  rows: [
    [ "Switzerland", "12%", "+1.12%" ],
    [ "France", "67%", "-0.98%" ],
    [ "England", "33%", "+4.44%" ],
  ],
  textFeatures: ['rtla']
}

And pass it here

https://github.com/natancabral/pdfkit-table/blob/707a1917d6f628ddc12b72c7010a1b25d108030f/index.js#L555-L560

When I think about it, allowing setting align is also a good idea