Commit Graph
1520 Commits
Author SHA1 Message Date
51d05efb63 M6: copy and paste selected form fields from the Edit menu (#1571) (#8604)
* M6: copy and paste selected form fields (fixes #1571)

[KenM76: rebased onto main. copy_field moves to crates/forms/src/author/copy.rs
(author.rs is split), Edit::CopyField to crates/engine/src/edit.rs, labels.rs and
run.rs, the tool to dispatch.rs, the test to tests/it/automation.rs. The i18n/*.tsv
rows are dropped (catalogs now live in craft-i18n), and the Prepare ⌘C/⌘V key handling
is dropped here because crates/ui-egui/src/prepare.rs and its raw key events are gone;
it is rebuilt on the edit.copy and edit.paste commands in a later commit.]

* M6: a copied field keeps an inherited MaxLen and its buttons' /Opt values, and a signature copies blank

[KenM76: rebased onto main; applied to crates/forms/src/author/copy.rs.]

* M6: a copied button keeps an inherited /Opt, and on states named after /Opt positions are renumbered

[KenM76: rebased onto main; applied to crates/forms/src/author/copy.rs.]

* M6: a pasted field has a look of its own

copy_field shared the source's appearance streams, and its /MK and /BS
when they were indirect. Restyling a copy, or filling in a copy whose
look is redrawn in place (a password field), then changed the source.
Each copied widget now gets its own copies of the streams its /AP
reaches, and a direct /MK and /BS. The copy also drops /NM and the XFA
binding keys, and takes what the field inherits from tree::inherited
rather than a second walk of its own.

Tests: a restyled or refilled copy leaves the source alone; a
transparent, borderless multiline field (a calendar day) pastes onto
another page with its flags, look and appearance.

Co-authored-by: Marco Arnulfo <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* M6: copy and paste the selected fields from the Edit menu while preparing a form

Copy (Edit menu, Ctrl+C) in Prepare a form takes the selected fields and
puts their names on the clipboard as text; Paste (Ctrl+V) adds a copy of
each on the current page as one undo step, "Paste fields", and selects the
copies. On their own page the copies land 18 pt right and down, one step
more per paste; on another page, in place. Paste brings the fields back
only while the clipboard still holds their names, so pasting other text
does not paste stale fields.

The paste rides the edit.copy / edit.paste commands, so it works from the
menu as well as the keys. It keeps Marco's paste guard (no paste under a
dialog, none into a document that forbids changes).

Parity: form.copy-paste-fields lists the UI tests, and its notes say what
is still missing: Cut, and pasting into another PDF (#2543).

Co-authored-by: Marco Arnulfo <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* M6: a pasted field moves right and down as the page is shown

The Prepare paste step now goes through the page's view transform, as
form_copy_field's dx/dy already did, so on a turned page the copies still
land right and down on screen. Prepare keeps Paste for its fields: a
paste whose fields have since been deleted, or a picture on the
clipboard, pastes nothing there, as before.

copy_field is split into helpers (picking the widgets, the field half,
the /Opt renumbering, the widget half, attaching to the tree) with no
change of behaviour, and form_copy_field looks its page up with get.

Co-authored-by: Marco Arnulfo <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(forms): a field copy's /DV never names a button it lacks

A check box or radio copy made without the widget its /DV names now gets
/DV /Off. Before, reset sent that state to the copy, write_value refused it
(Invalid), and reset_with_formatting stopped there, so Clear form failed for
every field in the document. renumber_states also renames /AP /R with /N
and /D, so a renumbered button keeps its rollover look.

Tests: a_radio_copy_without_its_default_button_still_resets,
a_radio_copy_with_its_default_button_keeps_it,
copying_a_numbered_radio_button_renames_its_rollover_look. Each fix reverted
on its own fails its test; with the /DV fix reverted, reset itself returns
Invalid("\"size1\" has no option \"S\" (options: L)").

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(forms,ui-egui): address #8604 review of field copy and paste

- A one-widget copy merges the field's and the widget's /AA, so the
  field's calculate/format/keystroke/validate triggers survive the merge.
- Copying fields in Prepare cancels a running whole-document text copy,
  so its older text cannot land over the field names.
- Copy remembers each widget's object, not its index; paste finds its
  current position and skips one deleted since.
- The paste step is turned back by the view rotation, so a paste in a
  turned view still moves right and down on screen.

Each fix's test fails with that fix reverted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(forms): compare a copied button's default as name bytes

`off_unless_copied` compared the raw `/DV` name with the escaped text of
each copied widget's on state, so a state such as `/A#23B` (text "A#23B",
bytes "A#B") never matched and a copy that kept the default button lost
its `/DV`. Compare against `name_bytes(on_state)`.

`a_copy_keeps_a_default_whose_name_has_a_hash` fails with the old
comparison (`/DV` became `/Off`).

Also write the turned-view paste test's clipboard text as "consent\nshade",
like the other paste tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep radio copies and per-page paste offsets consistent

---------

Co-authored-by: Marco Arnulfo <[email protected]>
Co-authored-by: KenM76 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: FredApps <[email protected]>
Co-authored-by: FredApps <[email protected]>
2026-12-04 17:52:12 +01:00
67e3288769 Port release fixes to main: reader-web (#9306)
* Return keyboard to reader on blank page view click

(cherry picked from commit b12d744c3a)

* Check field draft survives background focus handoff

(cherry picked from commit 82abf52b1a)

* Preserve the OCR text drag anchor over a scanned page

(cherry picked from commit a28bdd3db1fd5723736b038a16bf7ac13795baf6)
(cherry picked from commit bbb0c61a1c)

* Restore saves to the embedding web page

(cherry picked from commit 24702af7e6)

* Keep host copy saves from marking the open document saved

(cherry picked from commit 2624b9b9d2)

* Use pinned APIs in Space Audit and host save checks

Port of the host save test half only; the Space Audit half is covered by another open PR.

(cherry picked from commit bbde94e743)

* Read the browser clock when painting comment and file timestamps

(cherry picked from commit cbda2fd3ff)
(cherry picked from commit c5984569d1)

* Web: give the document session a browser wall clock (#8957)

(cherry picked from commit b90c6de6e0)

* Test organize thumbnails after moving a page

(cherry picked from commit 0230ac0fc7)

* Test organize deletion of selected and tile pages

(cherry picked from commit 9a12b9b1fb)

* feat(view): rulers along the page area (view.rulers)

View ▸ Show/Hide ▸ Rulers (Ctrl+R / ⌘R) reserves a strip along the top
and left of the document area and draws rulers in the measurement units
preference, from the top-left of the page under the pointer (or the
current page) in its displayed orientation. Major ticks use the 1/2/5
interval that keeps labels apart at the current zoom, the tick count is
capped, and a marker follows the pointer. The choice persists, and the
control channel takes `rulers=on|off` and reports `rulers`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit c8a854134f)
(cherry picked from commit dcb941b3f9)

---------

Co-authored-by: FredApps <[email protected]>
Co-authored-by: Codex <[email protected]>
Co-authored-by: Terra854 <[email protected]>
Co-authored-by: yusufmntm <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-12-04 16:13:04 +01:00
00c357ac71 fix(xfa): remap bookmarks and named destinations to the pages a relayout writes (#9027) (#9080)
* fix(xfa): remap bookmarks and named destinations to the pages a relayout writes (#9027)

After an XFA form is laid out again, the document's pages are replaced, so
bookmarks and named destinations that named the old pages pointed at orphaned
objects. Remap them to the replacements by page position (a destination naming
a page the layout dropped goes to the last page written); destinations naming
untouched pages or non-page targets are left alone.

- xfa/pdf.rs: page_list (the pages a layout replaces, in reading order);
  write_form captures the old pages before page creation and remaps
  destinations after the new pages are written; remap_destinations handles
  /Dests, /Outlines (bookmark items, /Next chains and /Kids), and /Names
  (Dests and Pages categories); remap_dest / remap_action / remap_name_tree
  update indirect objects in place.
- xfa/fixtures.rs: dests_shell, a shell with /Dests, /Names and two /Outlines
  items (a /Dest and a GoTo action) naming the placeholder page.
- engine/tests.rs: xfa_relayout_keeps_bookmarks_and_named_destinations_on_the_pages_it_writes.

Co-authored-by: Copilot <[email protected]>

* fix(xfa): bound the destination remap's walks and remap what they omit (#9027 review)

The remap that points bookmarks and named destinations at the pages a
relayout writes could walk a malformed document forever, and silently left
a destination stale when a search hit its bound:

- xfa/pdf.rs: page_list errors on a page tree that lists a node twice,
  and on one past MAX_PAGES_SEARCHED, before any page is replaced; the
  outline walk follows each item's /First child (the spec's way) and
  errors at the bound instead of truncating; /Names categories are
  handled per category, the Pages one's values being page references
  remapped through the map directly (remap_page_ref); remap_dest,
  remap_action and remap_name_tree take a visited set, a /D chain or
  /Kids chain that repeats being an error before the recursion
  continues.
- xfa/fixtures.rs: the name-tree key is the string (end), as the spec
  requires.
- xfa/pdf.rs tests: each fix is guarded by a test that fails without it;
  automation hostile_args: the cyclic page tree, destination, and name
  tree are in the hostile-input sweep.

Co-authored-by: Copilot <[email protected]>

* fix(xfa): count pages and bookmarks at acceptance, pin the position remap (#9027 review)

- page_list: the 10,000-page bound is checked when a leaf is accepted, so a tree of
  exactly the bound followed by an empty /Pages node is still walked.
- the bookmark walk checks `seen` before the item bound, so a repeat of an item
  already counted is not a new item.
- tests for 3 old pages onto 2 and 2 onto 3, each with a bookmark, a /Dests entry and
  a /Names entry, plus one for each bound case above.
- remap_destinations' doc says what an error leaves behind: the walks after the bookmark
  walk can fail once earlier ones were written.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* fix(xfa): a page tree the remap cannot list is a warning, not a failed layout (#9027)

Main's relayout tests (cyclic page trees, a shared-reference page subtree past the walk bound)
expect the layout to be written. The destination remap now reports what it could not do as a
warning and keeps the layout, instead of failing the whole relayout.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: FredApps <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
2026-12-04 16:12:36 +01:00
Marco ArnulfoandFredApps 640ce697e8 M11: show art, trim and bleed boxes on the page (view.show-page-boxes) (#2779)
* M11: show art, trim and bleed boxes on the page (view.show-page-boxes)

Preferences > Documents and view outlines the bleed, trim and art boxes a
page sets, as Acrobat's Page Display preference does: only boxes the page
defines, clipped to the media box, placed through the crop box and /Rotate
and cut at the page edge. Art red, trim green, bleed blue, the colours of
Acrobat's Set Page Boxes > Show All Boxes. Remembered across restarts,
page-boxes on|off on the command line and control channel.

* Fix page box preference test selection

* Keep page box options in sync and mark box edges by type

---------

Co-authored-by: FredApps <[email protected]>
2026-12-04 14:34:13 +01:00
ad27770a23 fix(ui): the watermark and background previews show a file's picture (#2817) (#8679)
* fix(ui): the watermark and background previews show a file's picture (#2817)

The Add Watermark and Add Background dialogs previewed a mark taken
from a file (an image, or a page of a PDF) as a grey frame with the
file name, so its size, offset, turn and opacity could not be judged
before OK. The preview now draws the picture itself, where OK puts it.

The engine's new mark_picture brings the file in the way OK does
(mark_source: an image turned upright by its EXIF orientation, a PDF
page as an upright form), draws it alone on a page of its shape and
renders it small, once on white paper and once over black, so its own
transparency survives. The dialog renders it on a worker thread, keeps
it in the draft as a texture keyed by the file and the page, and shows
the frame with the file name until it arrives or when the file can't
be drawn. It is laid out as picture() in pdfcraft-edit lays it out:
fitted to the page at the scale, centred plus the offset, turned, at
the opacity. A watermark on top is drawn over the page. A background,
or a watermark behind the page, shows where the page is white: the
page's picture is multiplied by the picture, averaged over a fine
grid, as a background colour already tints it.

Item 14 of #2817.

* deps: ctutils 0.4.5 for RUSTSEC-2026-0385

* parity: evidence paths where main moved the tests (tests/it/)

* style: cargo fmt after the merge

* engine: the picture sheet's black background has no backdrop to replace (main's new Background field)

* engine: the mark-picture tests encode their PNGs with craft-image-codecs, as the engine does since main dropped the png crate

* fix(ui): a file background previews nowhere the page's own backdrop hides it

The colour tint already left out pages that keep their backdrop: a scan, or a
white backdrop with Replace unticked. The picture did not, so the preview
showed a background OK would not. backdrop_hides is now the one test both use,
and such a page previews with no picture at all.

The new test fails with the check removed ("page 1 keeps its backdrop").

Raised by CodeRabbit on #3024.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(ui): a mark from a file is clipped at the page edge in the preview

OK crops a watermark or background at the page edge, but the preview drew it
under the pane's clip, so a scaled, offset or turned mark ran past the page
into the pane. It is now drawn with the clip narrowed to the page.

The test uses the landscape page, where the pane is taller than the page, and
fails with the clip removed.

Raised by CodeRabbit on #3024.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(ui): a picture behind the page shows only where the page paints nothing

The watermark and background previews drew a file's picture behind the
page by tinting the page picture with it, so the page's own colours were
multiplied by the picture: an opaque blue box over a red picture previewed
black, though after OK it stays blue.

The preview now paints white paper, the picture, then the page rendered
on a transparent sheet (Document::pages_on_glass), which is clear only
where the page paints nothing. The sheet drops the marks an Update
replaces and, for a background with Replace ticked, the white backdrops
OK replaces. Until the sheet is rendered nothing is drawn behind the
page. The per-cell averaging grid the tint needed goes.

a_picture_behind_the_page_is_covered_where_the_page_paints reads what
the preview's meshes show at the box: with the old preview it fails
(#00_00_00_FF, black). the_pages_on_glass_are_clear_only_where_they_paint_nothing
fails with the sheet rendered opaque (alpha 255 on bare paper).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(ui): render a page sheet only at a positive, finite scale

A zero, negative or non-finite preview scale no longer reaches
render_page: glass_scale refuses it and the picture behind the page
is simply not drawn. The engine gains a test that pages_on_glass with
replace_backdrops takes a page's own white backdrop away.

Revert proof: with glass_scale returning Some for every scale,
a_sheet_is_rendered_only_at_a_positive_finite_scale fails (Some(0)
for 0.0); with replace_backdrops ignored,
the_pages_on_glass_lose_the_white_backdrop_a_background_replaces
fails (alpha 255 on bare paper).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(ui): read mesh triangles with as_chunks

Clippy on the CI toolchain rejects chunks_exact with a constant size.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(ui): show the file name while a picture's page sheet is missing

A picture placed behind the page draws on the page's transparent sheet.
While that sheet renders, or when it can't be rendered, the preview fell
back to Layer::Hidden and drew nothing, the same as a mark the page's own
backdrop hides. The user saw no sign of the picture they had chosen.

file_layer now returns None when the sheet is missing, so the overlay
takes its name-frame arm. A picture the backdrop hides is still not drawn,
and asks for no sheet. The sheet is rendered only when there is a picture.

Test: a_picture_behind_a_page_whose_sheet_is_missing_shows_the_file_name_frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Format marks_ui.rs after the merge with main

rustfmt joins the overlay() signature onto one line (the merge with main left it split).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9

---------

Co-authored-by: Guillem Hermida <[email protected]>
Co-authored-by: KenM76 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-12-04 14:23:37 +01:00
a8176e3194 M5: change the text range a highlight, underline, strikethrough or squiggly marks (#4824) (#8555)
* M5: change the text range a highlight, underline, strikethrough or squiggly marks (#4824)

pdfcraft_annot::set_quads and Edit::SetMarkupRange give an existing text markup
new quadrilaterals (colour, note and replies kept, one undo step). The comment
context menu gets Mark the selected text instead, and comment_edit takes
find/all/quads. Appearance redraws read indirect /CA, /C and friends, and a
squiggly's zigzag has a total vertex budget.

* M5: refuse empty markup quadrilaterals before changing comments (#4824)

* M5: check markup refusals before promoting inline annotations (#4824)

* M5: keep every squiggly area zigzagged within its drawing budget (#4824)

* M5: refuse markup redraws before promoting inline annotations (#4824)

* M5: fit the markup range tests to main and list comment_edit for highlights (#4824)

The rebase onto main left two tests on APIs main has since changed:
appearance::build now takes the document, and the UI test selects a
comment through session.comments.select_only and runs commands, options
and undo through the harness helpers. The comment.highlight parity entry
now also lists comment_edit, which changes a highlight's marked text.

Co-authored-by: AdrianTM <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* M5: check restyles before promotion and store quads in drawing order (#4824)

set_style checks the target and every Replace Text partner before
annot_ref can promote an inline annotation, so a refused restyle (one
too large to redraw, one that cannot be drawn, one locked) adds no
object and leaves /Annots as it was. A partner the change leaves alone
(a strikeout under a width-only restyle) is still checked for its lock
only.

set_quads stores corners given around the area (ISO 32000-2 §12.5.6.10,
Table 182) in the order the appearance draws, so a highlight fills its
area instead of crossing itself; a quad whose first two corners are
opposite each other is refused.

Co-authored-by: AdrianTM <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* M5: compare signs when testing a quad's outline for crossings (#4824)

z_order multiplied two side values to test whether an edge pair
crosses. For a tiny quad (edges near 1e-100) the product underflows
to zero, the crossing goes unseen and a perimeter-order quad is stored
unchanged. Compare the signs of the two values instead.

Co-authored-by: AdrianTM <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Adrian <[email protected]>
Co-authored-by: KenM76 <KenM76>
Co-authored-by: AdrianTM <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: KenM76 <[email protected]>
2026-12-04 14:13:56 +01:00
FredApps aac23fb4d8 Merge pull request #8591 from KenM76/feat/bates-files-dialog
Add Bates numbering to a list of files from the app
2026-12-04 13:37:05 +01:00
FredApps 4b03632ebb Merge pull request #8558 from KenM76/feat/form-field-grid-copies
M6: copy a form field into a grid (#6012)
2026-12-04 13:35:45 +01:00
8db03bbe3f fix(ui): All tools ▸ Audit space usage opens the Space Audit (#8993) (#9004)
* fix(ui): All tools ▸ Audit space usage opens the Space Audit (#8993)

The Space Audit shipped (Document Properties ▸ Space Audit and the
Optimizer's button), but the Compress a PDF catalogue entry still said
Planned (M11) and had no command behind it. Register optimize.audit,
open the stand-alone Space Audit dialog from it, and mark the entry
Ready.

* fix(ui): the Space Audit shows only the active document's figures

A finished audit was written to the shared result whatever document it
measured, so a late audit of one document could replace another's, and
the dialog showed the previous document's rows while the new measure
ran. Take in a result only when it is the active document's at its
current edit generation, and clear the rows and say "Measuring…" until
that result arrives.

* fix(ui): the Space Audit dialog measures again after an edit lands mid-measure (#8993)

pass dropped a stale audit result but left space_audit_pending set, and only
the Properties tab starts a new measure, so the stand-alone and Optimizer audit
dialogs could stay on "Measuring..." with an empty table. Start the measure for
the current edit once when it is pending, the result is not for this edit and no
job exists for it, as Properties does. Adds a test that edits before the first
measure finishes.

Review: https://github.com/storytold/pdfcraft/pull/9004#pullrequestreview-6187726404

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: FredApps <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
2026-12-04 13:19:28 +01:00
FredApps 4f76f1af37 Merge branch 'main' into feat/form-field-grid-copies 2026-12-04 12:55:02 +01:00
FredApps ec828d0093 Merge branch 'main' into feat/bates-files-dialog 2026-12-04 12:54:56 +01:00
bmh129andClaude Opus 5.5 116224fa72 fix(js): a value a script assigns with field.value is shown through the field's Format script (#9140) (#9141)
* fix(js): a value a script assigns with field.value is shown through the field's Format script (#9140)

Only Calculate results were marked for redrawing through the Format script, so a button that copied
138 into a currency field drew "138" instead of "$ 138.00". The field.value setter now marks the
field formatted as well; the stored value is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rvu8dYQi7eW7nr4gjv2mgG

* fix(forms): a check box or radio button a script sets keeps its state appearances (#9140)

The Format redraw draws one text appearance and removes /AS, so a script assigning a check box's
value would have lost its on and off faces. Only text and combo boxes are redrawn through Format.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rvu8dYQi7eW7nr4gjv2mgG

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-12-04 12:00:15 +01:00
40c0271fba Limit text comparison to selected pages (#6507)
* Limit text comparison to selected pages

Comparing every page is slow and noisy for large documents when only one page changed. Scoping the diff to chosen pages makes the result focused and faster.

Add an optional pages argument to doc_compare and Session::compare_pages that filters both documents' words to the listed 1-based pages before running the existing comparison, keeping Session::compare unchanged for all pages.

Test: compare_pages_limits_text_comparison failed before the change and passes after.

* Repair review branch integration

* Tighten the change after a final review

* Tighten the change after a final review

* Address review for pull request 6507

* Format the files this pull request changes

* Address remaining review requests

* Align compare and automation changes with the current main

* Format the deletion-mark regression test

* Address review for pull request 6507

* Repair review branch integration

* Repair review branch integration

* Update the annotation tests for the new Style, SaveOptions, LinkAction and Shape fields

* Format the files this pull request changes

* Format the files this pull request changes

* Select the compared pages in the split document tools and restore main's text elsewhere

* Drop the PDF/A verification test that belongs to another change

* Address review for pull request 6507

* Format the files this pull request changes

* Repair review branch integration

* Tighten the change after a final review

* Tighten the change after a final review

* Repair review branch integration

* Address review for pull request 6507

* Format the files this pull request changes

* Address review for pull request 6507

* Format the files this pull request changes

* Tighten the change after a final review

* Tighten the change after a final review

* Repair review branch integration

* Repair review branch integration

* Tighten the change after a final review

* Repair review branch integration

* Tighten the change after a final review

---------

Co-authored-by: eliets2 <[email protected]>
Co-authored-by: FredApps <[email protected]>
2026-12-04 11:14:53 +01:00
01eedd566c M5: All tools ▸ Add comments lists Attach file (#8172) (#8553)
The Add comments tool group did not list comment.attach, so the only
Attach file in All tools was Edit a PDF's, which attaches the file to
the document with no icon on any page. List the comment tool under
Add comments ▸ Markup, with the label and icon the quick toolbar
already uses.

The UI test opens Add comments, clicks the Attach file row, clicks the
page and answers the picker, and checks that a FileAttachment comment
sits at the clicked spot. It fails with the catalogue line removed.

Co-authored-by: KenM76 <KenM76>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: FredApps <[email protected]>
2026-12-04 08:43:23 +01:00
Aleksander HelgakerandFredApps 255ea3724d fix(print): report dimensions of images inside forms (#7742) (#7748)
* fix(print): report dimensions of images inside forms

* fix(print): preserve low-PPI findings for shared and extreme image uses

* Keep print image measurements consistent across placements

* Measure direct image PPI after scaling by UserUnit

* Deduplicate direct image reports by placement origin

---------

Co-authored-by: FredApps <[email protected]>
2026-12-04 08:26:17 +01:00
Terra854andFredApps a9b6dc8737 Keep original PDF dates for comment timestamps (#8958) (#8978)
Co-authored-by: FredApps <[email protected]>
2026-12-04 08:02:34 +01:00
29d305d95d fix(print): tell CUPS how the marked sheets run (doc_print marks) (#9135)
* Print: tell CUPS how the marked sheets run

With printer marks, doc_print laid the sheets out from the pages as the
document shows them, while print_pdf_marked prints the pages the marks
widen. A page the marks widen from portrait to landscape was spooled
without orientation-requested 4, so CUPS would shrink its landscape sheet
onto portrait paper.

Session::check_printer_marks, the scratch-copy check that already runs
before Will Print, now returns each page's displayed size on that copy, and
doc_print lays the sheets out from them. The sheet count and the automatic
CUPS orientation follow the printed sheets, and nothing is rendered twice.
spool_job's argument checks still run before Will Print; an orientation in
options still stands, and a mixed job still gets none.

The marks test now also prints the same page at the same layout with and
without trim and registration marks, and checks for ink at a trim mark and
a registration target where the unmarked print has blank paper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Print: keep printed_sheets in the doc_print impl block

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9

---------

Co-authored-by: KenM76 <KenM76>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: KenM76 <[email protected]>
Co-authored-by: FredApps <[email protected]>
2026-12-04 06:40:58 +01:00
Elvis33LEandskylar taylor f785466336 test(ci): consolidate integration tests into tests/it across 6 crates (#9050)
* test(ci): consolidate integration tests into tests/it across 6 crates

* ci: update parity evidence paths for consolidated integration tests

---------

Co-authored-by: skylar taylor <[email protected]>
2026-12-02 15:17:52 -06:00
FredApps dcb2c569a5 Merge branch 'main' into feat/image-page-size 2026-12-02 07:41:28 +01:00
FredApps 2dd24dcdf9 Format with rustfmt after the main merge
Import lists in engine/src/lib.rs and session.rs reflow, and one blank line
goes from the automation tests; no other change.
2026-12-02 13:40:33 +07:00
FredApps 36f0150c42 Merge pull request #3069 from mtlcl410/feat/alpha-hit-testing
M7: pictures are picked where they show, not across their transparent margins (#3005)
2026-12-02 07:19:44 +01:00
FredApps dd90ee980d Merge branch 'main' into feat/alpha-hit-testing 2026-12-02 06:33:04 +01:00
FredApps ca74084fc9 Merge branch 'main' into fix/validate-rejected-value-reverts 2026-12-02 06:32:44 +01:00
FredApps a639547bc9 Merge branch 'main' into feat/image-page-size 2026-12-02 05:45:52 +01:00
FredApps e0580ebaad Merge branch 'main' into feat/sign-ca-checks-and-trust-sets 2026-12-02 05:45:46 +01:00
FredApps 016246e7fc Merge branch 'main' into fix/xfa-message-box-answers 2026-12-02 04:52:18 +01:00
FredApps 1034899e97 Merge branch 'main' into fix/merge-data-quoted-csv-7410 2026-12-02 02:07:03 +01:00
FredApps 74e2e3534d Merge branch 'main' into fix/header-footer-update-5785 2026-12-02 00:41:18 +01:00
jweaver3 7e6326eae5 M7.6: keep an updated header and footer in its place among the others
Update now puts the replacement where the header and footer it replaces
was on each page, instead of on top of every mark added after it, so
marks that overlap stack as they did. The preview draws the page in two
layers around the draft: the marks under it, then the ones over it on a
transparent page, so it still shows what OK will leave.
2026-11-30 07:28:15 -05:00
yusufmntmandClaude Opus 5.5 014f2c74c4 feat(edit): allow custom and Unicode fonts for added text (#4978)
Added text could only use the standard Helvetica, Times and Courier
faces, so characters outside WinAnsi (Greek, Cyrillic, CJK) were
refused. An added text item can now name a page font resource
(`AddedText::font_resource`): it is drawn with that embedded font
(Type 0, Identity-H, wrapped with the font's own advances), kept in
`/PCAdded` across saves, and painted in the item's ink like other text.

The Format text panel offers the page's document fonts, Load font… and
the installed fonts for added text as well as for edited paragraphs; a
pick or a loaded font applies to the draft, the selected added text
(undoable) or the style for the next text. Bold and italic are off for
an explicit font resource.

Rebased onto the craft framework UI port (#8160).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 13:25:28 +01:00
jweaver3 7ad1496871 Merge upstream main into fix/header-footer-update-5785
main replaced the marks dialogs with hosted parameter dialogs
(craft::ui::patterns::form_dialogs), so Update's header and footer
choice (#5785) is ported onto them rather than merged line by line:

- The "Which header and footer:" choice is a choice row (hf.which).
  Picking one fills the dialog in from it; whether the range is still
  the one it filled in travels in the dialog's fields (hf.range_kept),
  so the build pass, the host pass and OK all read the same pages.
- finish_marks refuses an Update read from another document, as
  finish_edits did.
- The page range is craft::pages::PageRange: the preview helpers take
  the pages OK applies to.

FredApps' review: the Update preview took away every header and footer
on the page (doc.without_marks), while OK removes only the chosen one,
so a header and footer OK keeps was missing from the preview. The
preview now takes away only the chosen one (new
Document::without_header_footer over pdfcraft_edit::remove_header_footer,
the removal update_header_footer itself does), and its cache is keyed
by the choice, so choosing another draws the page again. An older
header and footer with no recorded settings is still replaced
page-wide, and previewed that way.

Tests: an engine test and a dialog-level test with two headers and
footers on one page, unit tests for what the preview takes away and
for the fields, and the PR's two UI tests ported to the new harness.
2026-11-29 02:01:50 -05:00
FredApps d1e6a5374b Merge main into fix/merge-data-quoted-csv-7410
Preserve main CSV bytes and carry the distinct field count from the existing XFDF writer through the engine to form_merge_data. Keep the ordinary quoted and empty-header regressions.
2026-11-28 20:43:00 +01:00
KenM76andClaude Opus 5.5 a63cdcfede feat(ui): add Bates numbering to a list of files from the app
Bates numbering > Add to files... (edit.bates_files) numbers a list of
files as one run: each file starts one after the last number of the file
before, with the single-file token's prefix, suffix, digits, start and box.
It writes numbered copies beside each original or in a picked folder and
never changes the originals. Nothing is written when a copy would land on
another copy (names compared without case) or on an existing file, or when
a file can't be read, opened (password, signed) or numbered.

The engine gains BatesFormat (check, spans with checked arithmetic, label,
settings) and Session::add_bates. doc_bates_multi is not moved onto it
here; that move is its own change.

Parity edit.bates-multi-file stays partial: the dialog refuses password
and signed files and runs on the frame thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-28 04:27:06 -05:00
FredApps 32dbecde2d Merge remote-tracking branch 'origin/main' into pr-6984
# Conflicts:
#	crates/automation/tests/it/automation.rs
#	crates/engine/src/edit/run.rs
#	crates/engine/src/open.rs
#	crates/engine/src/session/editing.rs
#	crates/engine/src/tests.rs
#	crates/engine/src/xfa.rs
#	crates/engine/src/xfa_form.rs
#	parity/acrobat-features.toml
2026-11-28 08:28:58 +07:00
01ecdf2c17 Grid copies: one export-value rule, keep a widget's read-only flag
A check box with several widgets is copyable only when every widget has
the same on state and the same export value. The forms layer's
`copyable_widget` now holds that rule and the engine's
`field_table::copyable` calls it, so the preview and the copy agree.
Before, a box whose widgets drew different on states without /Opt was
copied, and one whose /Opt repeated a single value was refused.

A copied check box gets its widget's export value as its /Opt when /Opt
lists one value per widget, and no /Opt otherwise, so the copy exports
what its source widget did.

A widget that is read-only through its own /Ff makes its copy read-only:
the copy has one dictionary, and the field's /Ff used to hide the
widget's.

The automation README and the parity note say which check boxes are
refused in the new rule's terms, and the parity entry lists the tests.

Co-authored-by: Karim <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-27 18:51:58 -05:00
Thorsten Hirsch 59707b8fac Merge branch 'storytold:main' into feat/sign-ca-checks-and-trust-sets 2026-11-28 00:39:19 +01:00
FredApps e48415fb05 Merge remote-tracking branch 'origin/main' into pr-3331
# Conflicts:
#	crates/automation/src/printing.rs
#	crates/automation/src/tools.rs
#	crates/automation/tests/it/automation.rs
#	crates/create/src/lib.rs
#	crates/create/src/tests.rs
#	crates/engine/src/lib.rs
#	crates/engine/src/session.rs
#	crates/engine/src/session/files.rs
2026-11-28 05:33:55 +07:00
FredApps 81a475e55f Merge pull request #6982 from Combiler01/fix/freehand-highlight-icon
Fix: Use a dedicated icon for Freehand Highlight (#6961)
2026-11-27 23:30:26 +01:00
cbe3eb63cb Copy into Grid: say why the item is off, test the tool's refusals
- The undo label is "Copy field into grid" and the parity title "Copy a
  field into a grid", so no other product's wording is left. The parity
  notes and the tool text say "value" rather than "initial value", and
  the notes drop "actions", which no test checks.
- form_add_field_table no longer repeats the text-or-check-box test:
  copy_edit refuses what field_table::copyable says no to, so the tool
  and the menu refuse the same fields with the same Uncopyable reason.
  The tool still checks the field and the widget exist.
- A disabled Copy into Grid... row says why on hover: several fields
  are selected, or the field is not a text field or a check box with
  one export value.
- New tests: the tool refuses source_widget without source_field, an
  unknown field, a radio group, source_widget 0 and a widget past the
  last, adding nothing; and the hostile-argument sweep sends every
  hostile value as source_widget, with and without source_field.

Co-authored-by: Karim <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-27 16:44:32 -05:00
mtlcl410 a70473b53f Merge remote-tracking branch 'upstream/main' into HEAD 2026-11-28 00:41:50 +08:00
9ecb1f8823 Grid copies: own appearances, no XFA keys, refuse what can't copy
Review fixes on #6012's copy_field and copy_edit:

- A copy no longer carries the source's private XFA keys (PCSom,
  PCXfaNode, PCItems), so it is not bound to the template node the
  source fills.
- Each copy gets appearance streams of its own (/N, /D, /R and every
  check box state). Shared streams meant redrawing one in place, as a
  password field's edit does, redrew the source and every other copy.
- copy_edit refuses a field a grid can't copy with
  TableError::Uncopyable, so a preview never shows a check box whose
  widgets export different values as valid. field_table::copyable is
  the same test for menus.
- copy_field is split into helpers under 80 lines.

New forms tests: a transparent, borderless, multi-line source keeps its
look and flag in the copy after a save; a copy has no PCSom; filling a
copy leaves the source's appearance stream unchanged. The check box test
now asserts a different stream with equal content per state.

Co-authored-by: Karim1125 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-27 09:38:48 -05:00
Karim 36b33e3363 M6: copy form fields into a grid
Cherry-picked from #6012 (ef57ba58d) onto main c34c6c5a0. Conflicts
resolved: CopyField sits beside main's field edits and clears the form
script snapshot like them; the copy label joins main's batch labels.
The Prepare a form menu and window parts are left out here because main
moved them onto the dialog host; the next commits port them. The
ROADMAP.md, docs/roadmap.md and docs/gaps.md edits are dropped.
2026-11-27 08:18:59 -05:00
Thorsten HirschandClaude Sonnet 5.5 4139499ec1 M9: review follow-ups: a trust list is known by its own name, a spliced PEM block is refused
- `TrustStore::set_list(name, Option<list>)` had two sources for a list's name: a list
  loaded as "EU" but named "Other" could not be removed as "EU". Now `add_list(list)`
  uses the list's own name and `remove_list(name)` takes it back (`Session::add_trust_list`,
  `remove_trust_list`).
- `x509::load_certificates` now refuses a PEM block that never ends (upstream, with the
  `.p7b` bundles). A block that begins while another is still open replaced it without a
  word, so a bundle spliced from two cut-short files loaded as the second one only. That is
  an error too; the trust list tests cover a cut inside the last block, a cut after the
  last complete one, and a splice.
- The module docs say why non-CA entries stay in a list: the real EU file has 4 of 875
  (three OCSP responder certificates, one time-stamp signer) under its CA services, so
  refusing them would refuse the real lists. They issue nothing in chain building and
  vouch only for themselves, which the signer checks still judge.

Fallout of rebasing onto the current main: the parity evidence follows the tests into
`tests/it/`, and twelve tests that others added build their `TrustStore` with
`..TrustStore::default()`.
Upstream's rule that a time-stamp authority's certificate must be issued for time
stamping would have kept the time untrusted in our time-stamp test for a second reason;
its authority now has that purpose, so the test checks our rule again (a list never
vouches for a time-stamp authority: it fails if one could) and the user's own
certificate still makes the time trusted. No catalog line and no attribution hash is
touched: upstream no longer gates tests on translations, and the new wording stays
English until translators get to it.

Fallout of rebasing onto the main of Nov 4: `validate.rs` now imports its names one by one, so
`TrustSource` is imported there, and the test time-stamp authority calls `timestamp::respond`
with its new `TimestampSigner` / `TimestampIssuance` arguments.

Fallout of rebasing onto the main of Nov 18: the x509 chain builder takes its pool as an iterator
(upstream now hashes a candidate's issuer once per lookup, which the iterator keeps), the
re-exports gain `TrustSource` next to upstream's `has_signatures`, and eleven more tests that
others added in `pdf.rs`, `encrypted_signing.rs`, `revision_classification.rs` and
`signed_structure.rs` build their `TrustStore` with `..TrustStore::default()`.

Fallout of rebasing onto the main of Nov 26: four more tests that others added in `pdf.rs`
build their `TrustStore` with `..TrustStore::default()`. The ROADMAP progress-log line is
dropped: it was the only file in conflict, and AGENTS.md asks not to edit append-only logs;
the same facts are in `crates/sign/README.md`, the module docs and the `sign.eutl` parity entry.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-26 23:49:04 +01:00
Thorsten HirschandClaude Sonnet 5.5 8e52c9c3c3 M9: opt-in trust lists (a file of CA certificates, such as the EU Trusted Lists)
A signer can be trusted through a list of CA certificates the user loads from a
file: `sign_trust {"eu_trusted_list": "<path>"}`, DER one after the other or
PEM. Refs #775, #87, #824: the PDF attached to #775, a CAdES signature under a
qualified service that Acrobat validates, is Unknown without the list and Valid
with it.

- The list is off until loaded, nothing is embedded, and it is kept apart from
  the user's own trusted certificates (`TrustStore::lists`). The details name the
  list that vouched. Chains through it still need CA certificates all the way
  (#620) and the signer's own certificate is held to #749's purpose rules.
- A list vouches for signers, never for a time-stamp authority: a CA trusted to
  issue signing certificates is not thereby a source of trusted time, so trusted
  time still comes from the user's own certificates.
- A cut-short or damaged list is refused instead of loading as a smaller one, and
  PEM that starts with text beginning with a "0" (DER's first byte) is read as PEM,
  in `x509::load_certificates` too.
- `sign_trust` reads and checks every argument before it changes anything and
  revalidates the open documents once (`Session::update_trust`); the list path
  stays inside `--root` and the read is bounded.
- `build_chain` takes its pool as an iterator, so a list's certificates are not
  copied for every signature.

`TrustStore` gains `lists`: struct literals need `..TrustStore::default()`.

Tests that fail without their change: the damaged-list and PEM cases
(`trust.rs`), a list that holds a time-stamp authority's certificate not making
its time trusted (`chain.rs`, with the shape of #775), and a bad `sign_trust`
argument changing nothing (`automation.rs`).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-26 23:46:04 +01:00
mtlcl410 c4c22df1b2 Merge main (d492d8890) into feat/alpha-hit-testing 2026-11-27 05:58:33 +08:00
FredApps f53cab766c Merge main into #4538 2026-11-26 20:27:19 +01:00
FredApps 1e05eefeae Merge main into #4369 2026-11-27 00:10:52 +07:00
FredApps e4144bfdde Merge main into #4538 2026-11-27 00:09:02 +07:00
FredApps e334d6d4be Merge pull request #4527 from EricKaden/fix/xfa-ready-events
XFA: ready events run in the other viewer's order, and layout:ready again after a new layout
2026-11-26 17:50:24 +01:00
FredApps d3428827db Merge pull request #2763 from kavishkashehan726-sudo/claude/serene-hawking-sk6w13
fix(engine): validate signed XFA forms as the file was read (#2759)
2026-11-26 17:37:19 +01:00