Skip to content

Commit d4aed28

Browse files
Implement snaking columns #604 (#2915)
* feat: Implement snaking columns (issue #604) with tests and examples * fix(snakingColumns): add validation warning and docs (Copilot feedback) - Warn when content found in columns > 0 (ignored by design) - Document why processRow iterates all columns (bookkeeping) - Add single-source-column contract to limitations doc * fix(snakingColumns): add validation and docs from Copilot review - Add runtime warning in processColumns() when content in columns > 0 - Add architectural comments in processRow() explaining column iteration - Document single-source-column contract in limitations doc - Fix test robustness: use testHelper.MARGINS.left, add normalizeX() Loop short-circuit suggestion rejected (breaks column bookkeeping). Other suggestions deferred pending actual bug reports. * fix(examples): resolve spell-check error in planet names Replace "TOI-700" with "Kepler-700" in examples/snaking_columns_grouped_multipage.js to avoid false positive from the 'typos' CI check. * fix: layout corruption in snaking columns with nested content (Issue #604) Summary: Fixes a critical bug where nested column groups (e.g., tables or stacks inside snaking columns) became misaligned when spanning across a page break. The `lastColumnWidth` context was being incorrectly reset, causing inner columns to lose their width tracking. Changes: - LayoutBuilder/PageElementWriter: Preserve `lastColumnWidth` during `resetSnakingColumnsForNewPage` to maintain correct inner column state across page breaks. - DocumentContext: Add null-checks to `getCurrentPosition` and `moveToNextPage` to prevent crashes on uninitialized pages (fixes regression in `sections.js`). - LayoutBuilder: refine invalid column warning to ignore non-content properties (fixing false positives for placeholder columns). - Documentation: Link `snaking_columns_limitations.md` in README. * feat(snakingColumns): add example and integration tests for snaking columns with real table nodes * fix(snakingColumns): draw top border at continuation point after column and page breaks * Add examples and integration tests for snaking columns with headerRows and keepWithHeaderRows - Introduced `snaking_columns_table_headerRows.js` to demonstrate the use of headerRows in snaking columns. - Added `snaking_columns_table_keepWithHeaderRows.js` to showcase keepWithHeaderRows functionality in snaking columns. - Created integration tests in `snaking_columns_table_headerRows.spec.js` to validate header repetition and layout integrity across multiple pages and columns. * getCurrentPosition() fixed in master, revert change from master * bug with sections fixed in master * fix: prevent duplicate horizontal lines at header-data boundary in snaking columns * merge tests * remove snaking columns limitations documentation * Update README.md * merge and cleanup snaking columns examples * cleanup --------- Co-authored-by: Libor M. <liborm85@gmail.com>
1 parent f8b424e commit d4aed28

File tree

10 files changed

+2934
-23
lines changed

10 files changed

+2934
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Added `snakingColumns` property for columns to enable newspaper-like column flow
56
- Added outlines / bookmarks for `text` node
67
- `outline` - set to `true` for add to bookmarks
78
- `outlineText` (optional) - set custom bookmark text, otherwise text from node
@@ -18,7 +19,7 @@
1819

1920
- Added properties for ToC:
2021
- `hideEmpty` - set to `true` if you can hide an empty ToC
21-
- `sortBy` - `'page'` (default) or `'title'`
22+
- `sortBy` - `'page'` (default) or `'title'`
2223
- `sortLocale` - custom locale to sort by property `sortBy`
2324
- Added property `decorationThickness` for `text` to set width of the decoration line
2425
- Added inherited/extends styles, use property `extends` in style with style name or array of string with style names

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Check out [the playground](http://bpampuch.github.io/pdfmake/playground.html) an
2323
* auto/fixed/star-sized widths,
2424
* col-spans and row-spans,
2525
* headers automatically repeated in case of a page-break,
26+
* snaking columns (newspaper-style layout where content flows column-to-column),
2627
* images and vector graphics,
2728
* convenient styling and style inheritance,
2829
* page headers and footers:

examples/pdfs/snaking_columns.pdf

263 KB
Binary file not shown.

0 commit comments

Comments
 (0)