Skip to content

Ask every time for the pages of Split PDF (#981) - #1102

Merged
KnifeLemon merged 1 commit into
mainfrom
feat/split-pdf-ask-pages
Nov 4, 2026
Merged

KnifeLemon merged 1 commit into
mainfrom
feat/split-pdf-ask-pages

Conversation

@KnifeLemon

@KnifeLemon KnifeLemon commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

What it does

"Ask every time" for the pages of a PDF preset (#981). Drop a PDF on the slot and a small Choose pages window opens:

  • it shows the file and how many pages it has (PDFsharp, the same count the page editor uses);
  • type the range: 13-55, 1-3, 8, 12-15, 100-, or leave it empty for every page. It is checked as you type: "Pages chosen: 43 of 812", or in red "This PDF ends at page 812." / "Type page numbers from 1, like …", and the button stays off until the range is valid;
  • for a PDF target, choose One PDF or One file per page (pill switch, as in the merge order window);
  • Enter splits, Esc / Cancel / closing the window starts nothing.

The button carries the preset's name ("Split PDF"), like the merge window's.

Where it is turned on

  • Preset editor: an Ask every time checkbox right under Pages, with a one-line hint when it's on. It shows wherever the Pages field shows (PDF → PDF, PDF → images, PDF → DOCX …), except when Merge all files into one PDF is on (one range would go for every file; a merge keeps its Pages as before, and the setting isn't saved behind it).
  • Built-in Split PDF: on in a new install only (FORMAT-RULES rule 7 style: BuiltInData gets AskPageRange = true, no migration). Existing libraries keep their Split PDF exactly as it is; users turn it on in the editor. Reset to defaults / a restored Split PDF get the new default.
  • No settings migration (the schema is left as main has it, 64 since feat(tools): Add background tool #1081). The new PdfOptions.AskPageRange is an optional bool that defaults to off: an older library reads as off, an older Filee ignores it.

Behaviour details (decisions worth a look)

  • Several PDFs dropped: one window per PDF, in turn, each with its own page count and a "File 2 of 3" line, because the reporter's case is different chapters from different PDFs (13-55 of a book, 15-23 of a framework). The next window starts with the previous one's One PDF / One file per page choice. Cancel on any of them starts nothing. PDFs given the same pages run as one job; other files dropped with them (not PDFs) convert as the preset says, without a window.
  • The range starts from the preset's Pages (selected, so typing replaces it). The saved range is never changed by the window; Pages is also what applies where nothing can ask: watch folders and the command line.
  • One PDF / one file per page is remembered in the saved preset (as "Merge images" remembers its layout), so a student who always wants one PDF chooses it once. The range is not remembered.
  • One PDF from Split PDF doesn't land alone in Split PDF's {name} folder of pages: the run's copy gets "subfolder only when a file becomes several" (SubfolderOnlyForSeveralFiles), so it's saved next to the source.
  • With Save to: Ask every time too, the pages window comes first, then the save dialog.
  • Files from a browser are saved first (as for the tools), then the window counts the pages of the saved PDF.
  • A PDF whose pages can't be counted (damaged, password) still opens the window, says so, and only checks the form of the range.
  • A retry from history converts the same pages again (the job's copy no longer asks).
  • The range accepts what other keyboards type: en / em / full-width dashes, full-width, ideographic and Arabic commas, Devanagari, Arabic-Indic, Thai and full-width digits (the Nepali hint already shows १-३, ५).

CLI

filee convert … --pages <range> overrides the preset's range (e.g. filee convert book.pdf --preset pdf-split --pages 13-55). It's checked with the same rules (no page count there), and a wrong range is a usage error (exit 2). Listed in filee help convert. The CLI never asks. (filee.sh/cli lists options too; it isn't in this repo.)

Screenshots

Choose pages (English, light) Past the end (Korean, dark)
Choose pages, 13-55 of 812 800-830 of an 812-page PDF: red message, button off

Preset editor: Ask every time under Pages, with its hint

All checked shots:

  1. Choose pages, English, light: 2 PDFs dropped ("File 1 of 2"), a long file name trimmed, "Pages in this PDF: 812", range 13-55, "Pages chosen: 43 of 812", One PDF selected, Cancel / Split PDF.
  2. Same, Korean, dark (페이지 선택, 고른 페이지: 43 / 812, PDF 하나로 / 페이지마다 파일 하나, 취소 / PDF 분할).
  3. Range past the end (800-830): the red "This PDF ends at page 812.", Split PDF greyed out (English dark, German light).
  4. Arabic, dark: the window mirrored (switch and buttons).
  5. Preset editor (English light, Korean dark): Ask every time under Pages, with its hint below.

How tested

  • AskedPagesTests (Core, new): ranges typed by hand (spans, open ends, reversed, duplicates, en dash, Devanagari / Arabic-Indic digits, full-width punctuation) give the text used and the page count, matching what the converters read; invalid input (abc, 3-x, 0, -, 1-3-5, 1.5, +3, 1;3); pages past the end only when the count is known; which presets ask (not merges, groups, tools); one PDF / one file per page only for a PDF target (not N-up, not OCR); the answer goes into a copy that asks no more and leaves the saved preset alone; Split PDF asks in a new install while an existing library saved without the setting stays off after loading.
  • AskPagesTests (App, new, headless):
    • the real flow from the donut with Split PDF: the window opens after the donut closes, with the page count; a range past the end keeps Enter from starting; 3-5, 9 + One PDF + Enter → one job, a PDF of exactly pages 3, 4, 5 and 9; Esc → no job, no file, preset unchanged; the One PDF choice is kept in the saved preset;
    • two PDFs dropped (60 and 30 pages): two windows in turn ("File 1 of 2", "File 2 of 2"), each with its own count; 13-55 and 15-23 → 43 and 9 pages;
    • view model: status texts, en dash, invalid, unknown page count, PDF → PNG without the switch;
    • unreadable / missing PDF → no count, no exception;
    • render + layout in en, ko (light and dark), de, ar, ru, hi, vi, ja: every part inside the window, the switch segments and buttons not overlapping, Arabic mirrored; and the past-the-end state;
    • the preset editor: checkbox under Pages, hint, saved into the preset, gone (and not kept) for a merge.
  • CliTests: --pages "2–3, 5" with Split PDF writes book_p2/p3/p5.pdf; --to pdf --pages 4- extracts 3 of 6 pages; --pages 1-x → exit 2.
  • dotnet build Filee.slnx (no new warnings); dotnet format Filee.slnx --verify-no-changes clean.
  • Core: 1007 passed (3 skipped). CLI: 80 passed (1 skipped). App, full run before rebasing on feat(tools): Add background tool #1081: 1842 passed, 6 skipped, 1 failed: RenderTests.Engines_page_shows_versions_descriptions_and_download_speed, because Tesseract is installed under Program Files on the test machine (unrelated). After the rebase: AskPagesTests, LocalizationTests, LocalizationResourceTests, AutomationNameTests, MergeOrderTests, PresetEditorTargetTests 284/284, Core again 1007/1007.

UI strings in all 20 languages (incl. vi), in each language's existing terms for the donut, watch folders and the command line; Korean in 해요체.

Closes #981

🤖 Generated with Claude Code

A PDF dropped on a preset whose pages are set to "Ask every time" opens a
small "Choose pages" window: it shows the page count, checks the range as
it is typed (13-55, 1-3, 8, 12-15, 100-) and, for a PDF target, offers one
PDF or one file per page. Enter starts it, Esc starts nothing. Several
PDFs get a window each, so each can give its own chapter.

- PdfOptions.AskPageRange, off by default: no settings migration. On for
  Split PDF in a new install only.
- Preset editor: "Ask every time" under Pages (not for a merge).
- PageRange.Check for ranges typed by hand, including other digits, dashes
  and commas other keyboards type.
- filee convert --pages <range> overrides the preset's range.
- Strings in all 20 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon
KnifeLemon merged commit 378cf72 into main Nov 4, 2026
12 checks passed
KnifeLemon added a commit to arielsrossi/Filee that referenced this pull request Nov 4, 2026
…bs too

Co-Authored-By: Claude Opus 5.5 <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.

[Feature]: plit PDF must ask for range.

1 participant