Skip to content

Add inner and outer margin settings for booklet printing#222

Merged
neongreen merged 1 commit intomainfrom
claude/add-booklet-margins-011CUhzFjaDXy9tNLteMrjVM
Nov 1, 2025
Merged

Add inner and outer margin settings for booklet printing#222
neongreen merged 1 commit intomainfrom
claude/add-booklet-margins-011CUhzFjaDXy9tNLteMrjVM

Conversation

@neongreen
Copy link
Copy Markdown
Owner

Add support for booklet-style printing with inner/outer margins that automatically adjust for left and right pages:

  • Add --margin-inner and --margin-outer CLI flags for booklet printing
  • Add validation to prevent using left/right and inner/outer together
  • Update CSS generation to use @page :left and :right for booklet mode
  • Update Typst generation to use inside/outside margins for booklet mode
  • Add comprehensive tests for booklet margin functionality

For booklet printing, inner margins appear on the binding side (left on odd pages, right on even pages), while outer margins appear on the outer edge.

Add support for booklet-style printing with inner/outer margins
that automatically adjust for left and right pages:

- Add --margin-inner and --margin-outer CLI flags for booklet printing
- Add validation to prevent using left/right and inner/outer together
- Update CSS generation to use @page :left and :right for booklet mode
- Update Typst generation to use inside/outside margins for booklet mode
- Add comprehensive tests for booklet margin functionality

For booklet printing, inner margins appear on the binding side (left
on odd pages, right on even pages), while outer margins appear on the
outer edge.
@neongreen neongreen merged commit 943a3af into main Nov 1, 2025
2 of 5 checks passed
@neongreen neongreen deleted the claude/add-booklet-margins-011CUhzFjaDXy9tNLteMrjVM branch November 1, 2025 22:59
@mergify
Copy link
Copy Markdown

mergify Bot commented Nov 1, 2025

🧪 CI Insights

Here's what we observed from your CI run for 78c4b71.

🟢 All jobs passed!

But CI Insights is watching 👀

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if options.isBookletMode() {
// Booklet mode: generate separate rules for :left and :right pages
topRight, outerRight, bottomRight, innerRight, topLeft, innerLeft, bottomLeft, outerLeft, _ := options.resolveBookletMargins()
fmt.Fprintf(&pageCSS, "@page { size: A4 %s; }\n", orientation)
fmt.Fprintf(&pageCSS, "@page :right { margin: %s %s %s %s; }\n", topRight, outerRight, bottomRight, innerRight)
fmt.Fprintf(&pageCSS, "@page :left { margin: %s %s %s %s; }\n", topLeft, outerLeft, bottomLeft, innerLeft)

P1 Badge Swap inner/outer margins for left pages in booklet CSS

In booklet mode the left-page CSS applies the margins in the wrong order. resolveBookletMargins returns outerLeft for the outer edge and innerLeft for the binding edge on left pages, but the code formats @page :left { margin: %s %s %s %s } as topLeft, outerLeft, bottomLeft, innerLeft. For left pages the right margin should be the binding margin (innerLeft) and the left margin should be the outer margin (outerLeft). As written, even-numbered pages get the wide binding margin on the outer edge and the narrow outer margin on the binding side, which defeats the purpose of the new inner/outer flags. Swap the parameters so right=inner and left=outer.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants