Commit Graph
6622 Commits
Author SHA1 Message Date
KenM76andClaude Opus 5.5 5efa2d51a6 Merge origin/main into feat/autotag-pagination
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:27:54 -05:00
Dylan M. Taylor 79477f3909 Point hayro-postscript to storytold/craft-libs (storytold/craft-libs#790) (#7828) 2026-11-18 19:08:53 -05:00
Dylan M. Taylor 8f4f4ea9c5 Cut over pptx export to craft-pptx (#7823)
* cut over pptx export to craft-pptx (storytold/craft-libs#792)

* style(export): run cargo fmt on pptx.rs
2026-11-18 18:57:36 -05:00
FredApps 3bc2adbe28 Merge pull request #7805 from FredApps/ci/gate-cleanup-budget-778
ci: allow native gate cleanup to finish
2026-11-19 05:29:14 +07:00
Dylan M. Taylorandkiwi4boy d03b99ea54 Export: Word through craft-docx, from the shared word model (rebased #7592) (#7814)
* export: write RTF through craft-rtf's full writer, from the word model

The pages are mapped onto a craft_wordmodel::Document (as_word.rs, the
mapping the DOCX export will share), and craft_rtf::doc::export writes
it. Over the small writer this keeps, in RTF:
- pictures, inline (the engine no longer leaves them out for RTF);
- each page's size, as a section per page (blank pages kept);
- Heading 1 and 2 styles;
- the title;
- hard line breaks inside a paragraph or cell (storytold/pdfcraft#4723).
It also fixes two bugs: \cellx was the absolute page x, so every column
edge sat one left margin too far right, and tables that touched became
one (NIST CSF 2.0 came out with 28 tables instead of 68).

craft-rtf, craft-wordmodel, craft-docx and craft-mime are pinned together
at one craft-libs commit: doc::export takes its own revision's Document.

* export: pin craft-libs main with push_text, the header-row fix and the RTF generator name

craft-rtf, craft-wordmodel, craft-docx and craft-mime move to craft-libs
b8eaa8e2, which has storytold/craft-libs#1946, #1947 and #1950. The
mapping appends through Paragraph::push_text/push_object, tables keep
the default look, and the RTF names PdfCraft as its generator.

* export: write Word through craft-docx, from the shared word model

as_docx.rs no longer writes WordprocessingML itself: as_word::word_doc
maps the pages onto a craft_wordmodel::Document and craft_docx::write
writes it. The decisions stay the same: a page with rotated text or
overlapping text keeps its layout as positioned text boxes and pictures
(watermark-sized text behind, pictures over it, other text on top), the
other pages flow, each page is a section of its own size, a shared page
colour is the document's, the PDF's language goes in the slot Word keeps
for its script, and the media limits are unchanged.

Over the hand-written package this gains:
- a VML fallback for every text box, so Word 2007 opens positioned pages;
- rotated text as a turned text box Word draws as a line;
- the body font named (Arial), with a font table saying it is a sans;
- PdfCraft as the application in docProps/app.xml;
- a picture drawn many times stored once.

The tests that matched XML read the package back through craft-docx.

* parity: the Word export through craft-docx, checked in Word 16, Word 2007 and LibreOffice

* chore: update Cargo.lock after rebasing #7592

---------

Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
2026-11-18 17:11:01 -05:00
FredApps 1f3aa5311c Merge remote-tracking branch 'origin/main' into ci/gate-cleanup-budget-778 2026-11-18 22:32:53 +01:00
FredApps 56f19a32c0 Merge pull request #7811 from FredApps/test/startup-password-completion-order
test: avoid racing startup password completion order
2026-11-19 04:32:05 +07:00
KenM76andClaude Opus 5.5 0ed3ad3655 fix(a11y): text rise, every height cluster, labelled page numbers
Apply the Ts text rise to a text object's extent, through the text
matrix and CTM, so raised or lowered text is placed where it shows.

Mark every qualifying height cluster of a running-text group, not only
the best one: the window search repeats on the runs either side of
each qualifying window, at most 8 clusters per group. A window now
takes every member within the tolerance of its first, so further
copies on pages it already covers are marked too.

Treat a labelled page number (Page 3, p. 3, 3 of 9, 3/9, in dashes or
brackets) like a bare one in the heading exception, so large
labelled page numbers are footers while Chapter 1 / Chapter 2 stay
headings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:13:03 -05:00
FredApps f9bfa19e74 test: keep startup password assertions independent of worker order 2026-11-18 21:26:45 +01:00
KenM76andClaude Opus 5.5 699d964719 fix(a11y): keep large page numbers as footers, test crop and rotation
A heading-sized group that changes only in its number is still a page
number unless it has words ("Chapter 1"). Pin the bands against an
offset crop box and 180 and 270 degree pages, a text origin that
overflows to infinity, and a page whose only text is running text.
body_size reads the evidence without cloning it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:12:51 -05:00
KenM76andClaude Opus 5.5 1b9fa432f0 feat(a11y): mark running headers and footers as pagination artifacts
Auto-tag Apply finds text that repeats near the top or bottom edge of
most pages before assigning roles: the same text, digits and lone roman
numerals aside, within 4 units of the same height, on at least 40% of
the pages and at least two. It wraps that text in
/Artifact <</Type /Pagination /Subtype /Header|/Footer>> BDC ... EMC
with no MCID instead of tagging it (ISO 32000-2 14.8.2.2). A group of
changing, heading-sized text is left as headings. Running text is left
out of the body style and heading levels, MCIDs number the tagged
objects only, and AutoTagResult counts headers and footers.

a11y::running_text lists the findings without changing the document;
accessibility_autotag_apply returns them as running_text and
running_count, and its note says so.

Adapted from pdfcer (MIT, same author) at ccb49b46, block_layout.rs,
with distinct pages counted instead of objects.

Closes #7065

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:59:31 -05:00
FredApps ec7e4342f7 ci: allow native gate cleanup to finish 2026-11-18 20:15:17 +01:00
FredApps bad6ac7fa2 Merge pull request #7779 from FredApps/chore/778-xfa-merged-pin
Use merged XFA namespace and BOM safety fixes
2026-11-19 00:57:14 +07:00
Dylan M. Taylor b11d37c0ed Merge pull request #7795 from storytold/fix/shared-ocsp-wrapper-pin-20261118
fix(sign): consume standard OCSP certificate wrapper parsing
2026-11-18 12:36:28 -05:00
FredApps fe16ea4834 fix(xfa): classify shared namespace admission as too large 2026-11-18 18:07:30 +01:00
Dylan M. Taylor dbf59f410f Merge pull request #7786 from storytold/test/ocsp-independent-oracle-20261118
test(sign): keep embedded OCSP certificate oracle independent
2026-11-18 11:54:34 -05:00
FredApps 39b3f45a9d Merge current main to validate the #778 dependency pin with baseline repairs 2026-11-18 17:07:47 +01:00
Dylan M. Taylor 3f1088afe2 Keep the OCSP parity oracle independent for embedded certificates 2026-11-18 11:01:52 -05:00
Dylan M. Taylor 209c040cce Merge pull request #7783 from storytold/fix/unused-tag-import
Keep the DER tag import where the test oracles use it
2026-11-18 10:43:26 -05:00
Dylan M. Taylor c9c4eb94e8 Keep the DER tag import where the test oracles use it 2026-11-18 10:43:09 -05:00
FredApps 6d95958ccc Use merged XFA namespace and BOM safety fixes 2026-11-18 16:08:32 +01:00
Dylan M. Taylor f1ace254bf Merge pull request #7656 from storytold/refactor/shared-ocsp
Sign: parse ocsp through shared PKCS7 components
2026-11-18 10:08:06 -05:00
Dylan M. Taylor 34d6706088 Pin shared PKCS7 adapters to merged parts API 2026-11-18 09:58:51 -05:00
Dylan M. Taylor d79a0fdc3d Merge main into shared OCSP adapter, retaining CRL parity coverage 2026-11-18 09:58:06 -05:00
Dylan M. Taylor a49a037db6 Merge pull request #7646 from storytold/refactor/shared-xfdf-fields
XFDF: use shared bounded field-value reader
2026-11-18 09:53:53 -05:00
Dylan M. Taylor e6274ea729 Merge branch 'refactor/shared-xfdf-fields' of github.com:storytold/pdfcraft into pr-7646 2026-11-18 09:53:36 -05:00
Dylan M. Taylor 70c7cebde8 Merge remote-tracking branch 'base-src/main' into pr-7646
# Conflicts:
#	Cargo.lock
2026-11-18 09:50:17 -05:00
Dylan M. Taylor e835554187 Merge pull request #7655 from storytold/refactor/shared-x509
Sign: parse x509 through shared PKCS7 components
2026-11-18 09:47:14 -05:00
Dylan M. Taylor 78706fe8c0 Merge pull request #7654 from storytold/refactor/shared-crl
Sign: parse crl through shared PKCS7 components
2026-11-18 09:47:10 -05:00
Dylan M. Taylor 7c15cb5019 Merge pull request #7642 from storytold/refactor/shared-xfa-xml
XFA: use shared namespace-aware XML DOM
2026-11-18 09:47:03 -05:00
Dylan M. Taylor 2801898667 Merge pull request #7637 from storytold/refactor/shared-timestamp-request
Sign: use shared RFC 3161 request reader
2026-11-18 09:46:59 -05:00
Dylan M. Taylor c26d380659 Merge remote-tracking branch 'origin/main' into refactor/shared-xfdf-fields 2026-11-18 09:41:01 -05:00
Dylan M. Taylor 02cbeb24d7 Merge pull request #7659 from storytold/fix/xfa-count-cache-20261117
XFA: cache repeated prototype child counts without relaxing work limits
2026-11-18 09:19:07 -05:00
Dylan M. Taylor b24a313ff5 Merge remote-tracking branch 'origin/main' into pr-7656 2026-11-18 09:12:07 -05:00
Dylan M. Taylor 4085380014 Merge remote-tracking branch 'origin/main' into pr-7655 2026-11-18 09:12:03 -05:00
Dylan M. Taylor babccf53e7 Merge remote-tracking branch 'origin/main' into pr-7654 2026-11-18 09:11:58 -05:00
Dylan M. Taylor b26c0c529f Merge remote-tracking branch 'origin/main' into pr-7646 2026-11-18 09:11:54 -05:00
Dylan M. Taylor 8d0ed386c0 Merge remote-tracking branch 'origin/main' into pr-7642 2026-11-18 09:11:50 -05:00
Dylan M. Taylor b7887ea0d1 Merge remote-tracking branch 'origin/main' into pr-7637 2026-11-18 09:09:10 -05:00
Dylan M. Taylor add7f7b509 Merge remote-tracking branch 'origin/pr7702-current' into fix/xfa-count-cache-20261117 2026-11-18 08:35:44 -05:00
FredApps 64c10d450c Merge main into onee/fix-annot-tests 2026-11-18 19:51:06 +07:00
FredApps 562c428c6f test(annot): retain current opacity and review-state semantics (#7721)
* test(annot): retain current opacity and review-state semantics

* style: wrap fixture imports at repository width
2026-11-18 19:08:31 +07:00
FredApps e56b03fbae test(annot): assert URL scan work instead of wall-clock speed (#7695) 2026-11-18 17:41:12 +07:00
FredApps 2d2c2f7e18 fix(xfdf): retain canonical Cargo lock package order (#7698) 2026-11-18 17:39:57 +07:00
FredApps f8211b6aaf Merge main into onee/fix-annot-tests 2026-11-18 17:14:34 +07:00
Dylan M. Taylor ef2d06e303 build: preserve Cargo canonical XML package order 2026-11-18 05:13:23 -05:00
Dylan M. Taylor 30c1e449f3 fix(export): package a repeated picture once in PPTX and bound HTML embedded pictures (#5933)
* fix(export): package repeated PPTX pictures once and bound HTML embedded images

* test: make reused PPTX picture reading order explicit
2026-11-18 05:10:11 -05:00
FredApps ae30592466 Update annotation tests after SaveOptions, Style, LinkAction, and Shape changes
#2523's tests were written against earlier field lists. Later work added
id_entropy, border and opacity style fields, a zoom on page links, and a
line on custom stamps, so cargo xtask ci now fails at clippy on main.

The tests keep the same intent: page links still use Fit Page, the view they
had before they carried a zoom, and the extra style and stamp fields take
their defaults.
2026-11-18 16:55:06 +07:00
Valentin Klein 894904616d Form-data import says when the form refused every value
Importing form data whose only value the form refuses now fails and names the field, instead of reporting success.

Fixes #7409

<details><summary>Details for review</summary>

**Cause:** the issue's analysis is right. `pdfcraft_xfdf::apply_values` records refused fields in `Report::rejected` and the library deliberately returns `Ok(report)`. The engine's `ImportData` handler (`crates/engine/src/edit/run.rs`) only looked at skipped comment appearances and dropped `rejected`, so the edit committed as an ordinary Import step: dirty, an Undo entry, and Redo cleared.

**Fix:**
- If the file gave values for known fields and the form refused all of them (no field and no comment taken), the import returns a new `DataError::Refused` (shown as "the form refused every value in the file, so nothing was imported: "Choice""). Nothing is committed, so Undo, Redo and the dirty state stay as they were, like the existing "nothing matches this document" case. The tools and the UI already show the edit error.
- If some values took and others were refused, the import still applies the valid ones, as the issue allows, and the repair log names the refused fields (first five, then a count).
- `doc_import_data` (CLI/MCP) returns the repair entries that import appended in `import_repairs` (empty when everything was taken), so a caller sees a refused value without calling `doc_info`.
- The library's own behaviour is unchanged.

**Tests** (`crates/engine/src/tests.rs`; and `crates/automation/tests/it/automation.rs`: `form_data_import_response_names_the_fields_the_form_refused`, which checks the response of a full, a mixed and an all-refused import): `form_data_the_form_refuses_is_reported_and_leaves_the_document_alone`. A combo with options A and B, Undo leaves Redo available, then importing `Choice=INVALID` must fail naming "Choice" with Undo/Redo and the value unchanged; a second import with `Choice=INVALID` plus `Notes=hello` applies Notes and names only Choice in the repair log. It fails without the fix (I checked this).

Checked: `cargo test -p pdfcraft-engine -p pdfcraft-xfdf -p pdfcraft-automation`: xfdf 130 pass, engine 779 pass, automation 451 pass. The 7 engine failures and 10 automation failures (OCR models, plus `file_processing_keeps_javascript_off_for_xfa_open_scripts` and `copy_restricted_text_stays_in_the_document`) fail the same way without my change. Clippy `-D warnings --all-targets` is clean for engine and automation; `pdfcraft-xfdf` has one existing `collapsible_match` finding at `xfdf.rs:326` on current upstream/main that I did not touch. rustfmt is clean. I did not run the CLI/MCP end to end.

</details>
2026-11-18 16:39:21 +07:00
Valentin Klein 996d34f432 A hidden layer stays hidden after a full Save As
A layer I hid stays hidden in the open document after a full Save As.

Fixes #7411

<details><summary>Details for review</summary>

**Cause:** the issue's analysis is right. A full save rewrites the file and renumbers its objects, then `mark_saved` refreshes the open document. The refresh looked old layer choices up by the old object number, and the renderer's layer overrides (`config.layers`) still named the old numbers, so the hidden layer came back as shown. An incremental save keeps the numbers, which is why it was unaffected.

**Fix:** `mark_saved` now knows when the saved bytes are a rewrite (it already computed that to reset the script runtime). In that case the refresh carries the visibility over by layer name (the nth layer with a name maps to the nth layer with that name, the writer keeps the `/OCGs` order) and rebuilds the renderer's overrides with the new numbers. Name matching also avoids an old number being reused by a different layer. The undo history survives the save, so undo and redo bring back a graph with the old numbers; when the restored layer numbers differ from the open document's, they use the same carry-over by name. Other refreshes are unchanged.

**Test** (`crates/engine/src/tests.rs`): `a_full_save_as_keeps_the_layer_choices_of_the_open_document` hides one of two layers whose objects get renumbered by the rewrite, saves in full, and checks both the layer list and the rendered pixels. Without the fix it fails with the hidden layer shown again (I checked this). `undo_and_redo_after_a_full_save_as_keep_the_hidden_layer_hidden` hides a layer after an edit, saves in full, then undoes and redoes, checking the layer list and the pixels each time (it fails without the undo/redo carry-over).

Checked: `cargo test -p pdfcraft-engine` (779 unit tests pass in the lib, the other test binaries pass; 7 OCR tests fail here because of the OCR setup on my machine, unrelated to layers), clippy `-D warnings --all-targets`, rustfmt, `xtask layers`. I did not run the native app.

</details>
2026-11-18 16:38:39 +07:00