Skip to content

fix(pdf): Rotated frames export axis-aligned instead of rotated #86

Description

@patriksimms

Problem

As an organizer I want a rotated image frame to print at the angle I gave it, so the exported PDF matches what the layout editor and book preview showed me.

Today the exporter ignores geometry.rotation for every frame that holds picture content:

  • drawCroppedImage in src/server/pdf-renderer.ts takes no rotation, so photos in a rotated image or gallery frame export axis-aligned
  • decorative-image elements export axis-aligned for the same reason
  • filler art for empty photo slots matches that behaviour deliberately, see feat(book): Empty photo slots print art instead of blank paper #83

Text already rotates correctly, so a rotated layout exports with its text at an angle and its pictures square.

Cause

src/domain/layout-backgrounds.ts:35 documents it: the browser rotates a shape around its top-left corner and the PDF around its bottom-left, so a naive rotation moves the element rather than turning it in place.

Scope

Rotate photos, decorative images, and filler art together. Fixing only one of them would be worse than the current state, since a slot would visibly shift when a contributor adds or removes a photo.

Acceptance criteria

  • A rotated image frame exports at the same angle and position it previews at
  • A rotated gallery frame rotates as a unit, with its slots in the same relative places
  • A rotated decorative image exports at the same angle it previews at
  • A rotated empty photo slot's filler art rotates with its frame
  • An exported-PDF proof shows a rotated frame with and without a photo landing in the same place

Found by an automated review on #84.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions