Skip to content

v0.3.2 - Table Header Positioning Bug Fix

Latest

Choose a tag to compare

@irenteria0617 irenteria0617 released this 15 Dec 02:41
· 3 commits to main since this release

🐛 Bug Fixes

Table Header Positioning (Critical Bug Fix)

Fixed a critical bug where table headers were rendering below data rows instead of above them.

Root Cause:
Incorrect handling of PDF coordinate system where Y-axis grows upward from the bottom of the page.

Solution:
Comprehensive coordinate system overhaul in Table.ts affecting 8 critical locations:

  • Changed rect(x, y, width, height) to rect(x, y, width, -height) for downward drawing (3 locations)
  • Inverted calculateTextY() logic to properly position text in downward-drawing cells
  • Fixed header border Y position from y + height to y - height
  • Fixed row border Y position from y + height to y - height
  • Corrected vertical border drawing direction
  • Rewrote outer borders logic to properly handle top/bottom/left/right borders

✅ Testing

  • Added comprehensive table test suite with 39 new unit tests
  • Total test count increased from 229 to 268 tests
  • All tests passing (268/268) ✓
  • Coverage includes: basic rendering, column handling, styling, alignment, borders, page breaks, edge cases
  • Browser compatibility verified with test-tables-browser.html

📦 Installation

npm install @pdfstudio/pdfstudio@0.3.2

🔗 Full Changelog

Full Changelog: https://github.com/pdfstudio-dev/pdfstudio/compare/v0.3.1...v0.3.2

### Commit SHA
e130808ee72bd87140994cbdd7bb90e377521c5a

### Files changed
- `package.json`
- `CHANGELOG.md`
- `README.md`
- `src/tables/Table.ts`
- `tests/tables/Table.test.ts` (new)