Change page size without scaling the content (#7116) #7836
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7836"
general
weight: 0.35
mansur-akhmadi
What this changes
Fixes #7116.
Organize pages ▸ Change page size gives pages a new size without scaling anything on them, e.g. an A4 page on an A3 sheet at 100%.
/UserUnit. When no size fits every chosen page (e.g. units 1 and 20,000), the dialog says so and turns off the size fields and OK.How it's done (
pdfcraft_organize::set_page_size):/Rotate) or a/UserUnitpage ends up at the size you asked for, with the anchor where you see it.Headless:
page_set_size {doc, pages?, paper | width+height, orientation?, align?, move_right?, move_down?}.papertakes a preset name or a written size like297x210mm. A written size keeps its order.page_sizes, pluscut_off: the 1-based pages where part of what showed is now outside.doc_printused is now shared, with no change todoc_print.Wiring: the
page.sizecommand, Organize menu, Organize panel and All tools entries,dialog=page-sizeon the control channel, and an undo label ("Change page size").How you verified it
CARGO_TARGET_DIRshared, macOS arm64:cargo fmt --check(organize, engine, automation, ui-egui)cargo clippy --no-deps -p pdfcraft-organize -p pdfcraft-engine -p pdfcraft-automation -p pdfcraft-ui-egui --all-targets -- -D warnings: clean. Without--no-deps, the local clippy (1.99) stops first on acollapsible_matchincrates/xfdf/src/xfdf.rs:326, which is already onmainand isn't touched here.cargo test -p pdfcraft-organize: 241 passed, including 5 newchange_page_size_tests:- every turn (0/90/180/270, plus -90 and 450) × four placements: the old visible area lands, unscaled, where the placement puts it on the page as shown (read back through
pdfcraft_model's view matrix after a save and reopen)-
/UserUnitsizes and limits- cut pages reported, other boxes reset, clip streams written, no clip when shrinking, a 0.004 pt difference not counted as a cut
- inherited crop box
- bad requests refused atomically
cargo test -p pdfcraft-automation --test it -- changing_page_size tool_table doc_print_takes: the text found bytext_findkeeps its size and moves exactly by the placement (+100/+100 centred, +10/+20 top-left with a move). Also checked:page_renderat the new size, one undo step, a written landscape size,cut_off, and seven refused argument sets plus two refused sizes with the document unchanged.cargo test -p pdfcraft-engine: 788 passed;added_content_stays_put_when_the_page_size_changesandpage_size_change_leaves_a_shared_added_item_on_other_pages_alone(two pages sharing one added image's stream, only page 1 resized: page 2 keeps[10,20,60,70], also after Replace image). The 7 OCR tests that fail here need OCR models and fail the same way without this change.cargo test -p pdfcraft-ui-egui --lib -- pagesize pageboxes(the draft's paper and orientation logic, the size limits per/UserUnit, and that the dialog's preview placement is the engine's) and--test it -- pageboxes::(the dialog in the real shell: seeded from the page, Landscape, the cut warning, OK, the notice, undo label, reseeding, and the "no page size in common" note with OK off). The 10 OCR/comments/editingitfailures here also fail without this change.cargo xtask layers,cargo xtask parity,cargo xtask wasm: clean.This is a new feature, so the new tests can't run on
main: the API, edit, command and tool don't exist there.Never-crash
unwrap/expect/panic!/unreachable!/todo!outside testsget), finite and range checks on every size, share and offset, before any page changesunsafeProvenance
maximize-2icon)/Rotate, §8.5.4 clipping, Annex C page limits) and the issue. Acrobat's own Change Page Size was not observed for this.ATTRIBUTION.tomlis unchangedSecurity
--rootuntouched (no file paths in the new tool)Parity and reach
organize.change-page-sizegoes fromplannedtoshipped, with evidence and notes on what is still missing: scaling the content to fit the new size (#2821), and comments outside what showed aren't hidden by the clippage_set_sizeAnything a reviewer should look at first
Qthanqcan pop the clip early./UserUnit), so a page "resized" to its own preset size (595.276 vs 595.28) isn't reported as cut.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added a Change Page Size option in the Pages menu and Organize panel. Apply standard paper sizes or custom dimensions, with portrait or landscape orientation, to the current page, a page range, or all pages.
Choose from nine placement anchors and set offsets; existing content is not scaled. Preview and results indicate when visible content may be cut off.
* Added page-size changes to automation, including standard or custom dimensions and page selection.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->