Skip to content

Start the print dialog on A4 outside Letter regions and remember the paper size - #124

Open
twotonetobi wants to merge 1 commit into
Forward-Future:mainfrom
twotonetobi:a4-paper-default
Open

twotonetobi wants to merge 1 commit into
Forward-Future:mainfrom
twotonetobi:a4-paper-default

Conversation

@twotonetobi

Copy link
Copy Markdown

Problem

The print dialog always starts on Letter. In most of the world the printer holds A4, so every print first needs a trip to "Paper and quality", and the choice is forgotten the next time the dialog opens.

Steps: on a Mac with the region set to Germany, open a PDF, press Command P, open Advanced, then "Paper and quality". Paper size shows Letter.

Change

  • The main process passes the operating system region (app.getLocaleCountryCode(), not the interface language) to the renderer through additionalArguments, and the preload exposes it as folioDesktop.region.
  • defaultPaper(region) in printLayout.ts returns Letter for the regions where Letter is standard (United States, Canada, Mexico, the Philippines, Puerto Rico and several Latin American countries) and for an unknown region, A4 everywhere else. The browser build has no region and keeps Letter.
  • The paper chosen in the dialog is stored in localStorage (folio:print-paper) and used the next time. Anything else in storage falls back to the default.
  • Test runs (FOLIO_TEST_USER_DATA set, unpackaged) use region US unless FOLIO_TEST_REGION names another, so the smoke tests give the same result on every machine. Without this, smoke-print fails on a machine set to a non-Letter region.

Issue or approval

No issue opened first. It is a small, contained change to a default, and I'm happy to move the discussion to an issue or close this if you'd rather handle it differently.

How I checked it

  • macOS. npm run build, npm run smoke and npx vitest run (18 files, 261 tests, including the new src/printPaper.test.ts) pass.
  • In Folio's test mode with FOLIO_TEST_REGION=DE the dialog opens on A4 (preview 8.27 × 11.69 in), with US on Letter (screenshots attached). Before the test pin, smoke-print on this Mac (region Germany) printed A4, 842 × 595 pt, which is the change working.
  • Not checked on Windows or Linux. getLocaleCountryCode() exists on both.

The code was written by Claude Code (Claude Opus), reviewed by me.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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.

1 participant