Skip to content

Harmonia print: fit wide tables to the page instead of clipping - #6974

Open
NicoleNG18 wants to merge 1 commit into
eclipse-dirigible:masterfrom
NicoleNG18:fix/harmonia-print-wide-table-clipping
Open

Harmonia print: fit wide tables to the page instead of clipping#6974
NicoleNG18 wants to merge 1 commit into
eclipse-dirigible:masterfrom
NicoleNG18:fix/harmonia-print-wide-table-clipping

Conversation

@NicoleNG18

Copy link
Copy Markdown
Contributor

Closes #6973

Problem

The list/master/report Print buttons build an HTML document and call window.print(). The stylesheet used table{width:100%} with the browser's default auto table-layout, where width:100% is only a minimum: the browser grows columns to fit content, and when the summed content width exceeds the page, the table overflows and the browser clips everything past the right edge. A wide entity like Sales Invoices (17 columns) loses roughly its right third. Confirmed from the produced PDF's metadata (MediaBox 595x842, Producer: Skia/PDF) — it is Chrome's own portrait print, not the server-side FOP path.

Fix — mirror the server-side FOP renderer

No @page/landscape trick: the server-side XslFoRenderer prints portrait too and solves the identical "wide printed table" problem purely with fixed layout + font scaling. The browser print now does the same:

  • table-layout:fixed; width:100% — the actual fix. Forces the table to exactly the page width so it cannot overflow; over-long content wraps into taller rows instead of being clipped.
  • Column-count font scaling, same formula as XslFoRenderer.java (Math.max(6, 10 - Math.max(0, columns - 3))), so a wide table shrinks to stay compact (floors at 6pt).
  • padding:2pt cells (matching FOP) and overflow-wrap:anywhere; word-break:break-word so space-less tokens (ids, IBANs like BG12CODBEXTEXT23) wrap inside their fixed cell.

Scope

Fixed in all three copies of the print stylesheet:

  • application-core/.../pages/basePage.jsprintRows — the shared helper behind printList() on the list / master / manage / my / partner views. Because application-core is served once (not copied per project), this fixes every already-generated app after a rebuild, no regeneration needed.
  • template-application-ui-harmonia-java/.../report-file/report.js.template → standalone report print.
  • template-application-ui-harmonia-java/.../report/table-page.js.template → report table-view print.

The chart print (chart-page.js) prints an image, not a table, so it is unaffected. No other copies of the pattern exist (verified).

Notes

  • JS/.template only — no Java changed, so no formatter/javadoc impact.
  • IntentEmissionCoverageIT's printRows(...) / printList() call-site assertions are preserved.

🤖 Generated with Claude Code

The list/master/report Print buttons build an HTML document and call
window.print(). The stylesheet used `table{width:100%}` with the default
auto table-layout, so a wide table (e.g. Sales Invoices, 17 columns) grew
past the portrait page width and the browser clipped the overflow at the
right edge.

Mirror the server-side FOP path (XslFoRenderer): `table-layout:fixed`
forces the table to the page width, and the font is scaled down by column
count with the same formula, `max(6, 10 - max(0, columns - 3))`. Cell
padding drops to 2pt and long unbreakable tokens (ids, IBANs) wrap inside
the fixed cell, so nothing overflows in portrait.

Fixed in all three copies of the print stylesheet: the shared
basePage.printRows (list/master/manage/my/partner) and the two report
prints (report-file, report table view).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harmonia list/master "Print" clips wide tables

1 participant