Repository navigation
Conversation
…torytold#2140) HeaderFooter::shrink scales the original page content evenly into the band the header and footer leave free, centred across the page, in display space so rotated pages shrink the way they are shown. The scale is a content stream first inside the q/Q wrapper, tagged as part of the header and footer, so Remove and Update take it away again and backgrounds behind the page stay full size. Margins that leave no room are refused before anything is drawn.
The tool passes shrink through to the header and footer, with an end-to-end test that reads the moved text back from a saved copy, refuses margins that leave no room and checks that Remove brings the content back to full size.
…ld#2140) The Header and Footer dialog (also opened by Bates numbering) gets a checkbox that turns on the shrink, and its preview shows the band the page content shrinks into. The label is translated in every catalog (the catalog checksums in ATTRIBUTION.toml follow). The parity entry for the shrink is shipped, with its limits: annotations and added text and images are not moved yet.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2140
What
Acrobat's Header & Footer dialog can shrink the page so the header, footer or Bates number doesn't land on the page's own text and graphics. PdfCraft only drew on top of the page. This PR adds that option, in the engine, the automation tool and the dialog. Bates numbering opens the same dialog, so it gets the option too.
HeaderFooter::shrink(crates/edit): the page's original content is scaled down evenly into the band the header and footer leave free (HeaderFooter::bands: the margin, the lines of the tallest box, and half the font size of clearance), centred across the page. A side with no text keeps its space. The scaling happens in display space, so a rotated page shrinks the way it is shown.doc_header_footertakesshrink: true.ATTRIBUTION.tomlare updated.edit.header-footer-shrinkgoes from planned to shipped, with its limits in the notes. ROADMAP progress log line added.Not done yet (also in the parity notes): annotations (links, comments, form fields) and PdfCraft's own added text and images stay where they are. They are not moved with the content.
Rendered with
pdfcraft-cli(synthetic page; headerACME Corp. - Confidential, BatesACME-000001, 12 pt), before and after:The dialog:
Tests
crates/edit: the exact scale and placement on an upright page, a rotated page (display space), Remove/Update undoing the shrink without stacking it (back to the exact original content), and the no-room refusal leaving the document unmodified. I checked that all four fail with the shrink disabled.crates/automation: end to end. The moved text is read back from a saved copy (scale and centring), the no-room refusal is checked, and Remove brings the text back to its original box. This test fails without the tool argument.crates/ui-egui(ui_group/marks.rs): Bates numbering opens the dialog, the checkbox turns on the shrink, and OK applies it. This test fails without the checkbox.Run locally:
cargo fmt --all --check,cargo clippy -p pdfcraft-edit -p pdfcraft-automation -p pdfcraft-ui-egui -p pdfcraft-engine --all-targets -D warnings, the tests ofpdfcraft-edit,pdfcraft-automation,pdfcraft-ui-egui(lib, including the catalog-coverage tests, andui_group) and the header/marks tests ofpdfcraft-engine, pluscargo xtask layers,assetsandparity. I couldn't run the wasm check locally, so CI covers that.