Anchor footer elements (metadata, notes, references) to bottom of page #31

Closed
opened 2026-03-17 16:16:14 +01:00 by shahondin1624 · 0 comments

Description

Currently, footer elements on song pages — Worte/Weise metadata, explanatory notes, and reference book page numbers — are rendered flowing directly after the song content. This means they appear at different vertical positions depending on how much content a song has, creating an inconsistent layout across pages.

These elements should always be bottom-anchored: rendered at a fixed position near the bottom of the page (just above the page number), regardless of where the song content ends. This matches the layout of the original CL6 PDF where the reference table and metadata are always at the page bottom.

Current Behavior

┌─────────────────┐     ┌─────────────────┐
│ Title            │     │ Title            │
│ Verse 1          │     │ Verse 1          │
│ Verse 2          │     │ Verse 2          │
│ Verse 3          │     │ Verse 3          │
│ Verse 4          │     │ Worte: ...       │  ← floats up
│ Verse 5          │     │ BuLiBu CL SwA   │  ← floats up
│ Worte: ...       │     │                  │
│ BuLiBu CL SwA   │     │                  │
│                  │     │                  │
│                  │     │                  │
│        9         │     │       10         │
└─────────────────┘     └─────────────────┘

Expected Behavior

┌─────────────────┐     ┌─────────────────┐
│ Title            │     │ Title            │
│ Verse 1          │     │ Verse 1          │
│ Verse 2          │     │ Verse 2          │
│ Verse 3          │     │ Verse 3          │
│ Verse 4          │     │                  │
│ Verse 5          │     │                  │
│                  │     │                  │
│ Worte: ...       │     │ Worte: ...       │  ← always at bottom
│ BuLiBu CL SwA   │     │ BuLiBu CL SwA   │  ← always at bottom
│                  │     │                  │
│        9         │     │       10         │
└─────────────────┘     └─────────────────┘

Acceptance Criteria

  • On the last page of each song, footer elements (notes, Worte/Weise metadata, reference book table) are rendered at fixed positions anchored to the bottom margin, not flowing after the song content
  • The rendering order from bottom up is: page number → reference table → metadata (Worte/Weise) → notes
  • The footer position is consistent across all song pages regardless of content length
  • Song content still flows from top down and does not overlap with bottom-anchored footer elements
  • The footerReservation calculation continues to correctly reserve space so content doesn't overflow into the footer area
  • For 2-page songs, footer elements appear only on the last page (page index 1)
  • Existing tests pass

Implementation Hints

In PdfBookRenderer.renderSongPage(), instead of rendering notes/metadata/references at the current y position after content:

  1. Calculate the total footer height (already done in calculateFooterReservation())
  2. Render footer elements from the bottom margin upward at fixed Y positions:
    • Reference footer: starts at bottomMargin + pageNumberHeight
    • Metadata: starts above the reference footer
    • Notes: starts above the metadata
  3. The song content rendering remains unchanged (top-down), using yMin to prevent overflow into the footer area
## Description Currently, footer elements on song pages — Worte/Weise metadata, explanatory notes, and reference book page numbers — are rendered flowing directly after the song content. This means they appear at different vertical positions depending on how much content a song has, creating an inconsistent layout across pages. These elements should always be **bottom-anchored**: rendered at a fixed position near the bottom of the page (just above the page number), regardless of where the song content ends. This matches the layout of the original CL6 PDF where the reference table and metadata are always at the page bottom. ## Current Behavior ``` ┌─────────────────┐ ┌─────────────────┐ │ Title │ │ Title │ │ Verse 1 │ │ Verse 1 │ │ Verse 2 │ │ Verse 2 │ │ Verse 3 │ │ Verse 3 │ │ Verse 4 │ │ Worte: ... │ ← floats up │ Verse 5 │ │ BuLiBu CL SwA │ ← floats up │ Worte: ... │ │ │ │ BuLiBu CL SwA │ │ │ │ │ │ │ │ │ │ │ │ 9 │ │ 10 │ └─────────────────┘ └─────────────────┘ ``` ## Expected Behavior ``` ┌─────────────────┐ ┌─────────────────┐ │ Title │ │ Title │ │ Verse 1 │ │ Verse 1 │ │ Verse 2 │ │ Verse 2 │ │ Verse 3 │ │ Verse 3 │ │ Verse 4 │ │ │ │ Verse 5 │ │ │ │ │ │ │ │ Worte: ... │ │ Worte: ... │ ← always at bottom │ BuLiBu CL SwA │ │ BuLiBu CL SwA │ ← always at bottom │ │ │ │ │ 9 │ │ 10 │ └─────────────────┘ └─────────────────┘ ``` ## Acceptance Criteria - [ ] On the last page of each song, footer elements (notes, Worte/Weise metadata, reference book table) are rendered at fixed positions anchored to the bottom margin, not flowing after the song content - [ ] The rendering order from bottom up is: page number → reference table → metadata (Worte/Weise) → notes - [ ] The footer position is consistent across all song pages regardless of content length - [ ] Song content still flows from top down and does not overlap with bottom-anchored footer elements - [ ] The `footerReservation` calculation continues to correctly reserve space so content doesn't overflow into the footer area - [ ] For 2-page songs, footer elements appear only on the last page (page index 1) - [ ] Existing tests pass ## Implementation Hints In `PdfBookRenderer.renderSongPage()`, instead of rendering notes/metadata/references at the current `y` position after content: 1. Calculate the total footer height (already done in `calculateFooterReservation()`) 2. Render footer elements **from the bottom margin upward** at fixed Y positions: - Reference footer: starts at `bottomMargin + pageNumberHeight` - Metadata: starts above the reference footer - Notes: starts above the metadata 3. The song content rendering remains unchanged (top-down), using `yMin` to prevent overflow into the footer area
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shahondin1624/songbook#31