mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-25 02:37:00 -06:00
Merge main8dff7ecdb0into the original reader head4b7e4aaab6, preserving both histories and their attribution. Keep main's placed-page crop/cache APIs, crop-aware raster sizing, linked-file reads and unrelated dependencies while retaining the shared reader's checked layered-export errors. Route main's added PDF bounds code and placed-PDF tests through craft-pdf. Correct the fetched-source notice to craft-libs 89dcbb3 and the transferred source snapshot to PdfCraft 7437bde, with asset provenance recorded separately. Add a regression for hidden-layer export with a placed TrimBox. This records unchanged treebf630f5252, validated locally on 2026-10-20: 13 PDF backend tests, 94 renderer tests, 16 WASM package checks and PDF test compilation to WASM passed. Seven PDF exports / ten pages match exact main in native PNGs, independent Poppler pixels and extracted text. Formatting, dependency, clippy, asset and layer checks passed; the lockfile did not drift. Full local CI is not green: native validation recorded 2,927 passes, two sandbox-denied listener binds and one unavailable GPU-adapter case. Five other listener-dependent tests were not attempted; five existing ignores remain. Runtime WASM was not executed without an available runner. These limits are preserved, and no builds or tests were rerun for this commit.
65 lines
4.2 KiB
Markdown
65 lines
4.2 KiB
Markdown
# Shared PDF backend
|
|
|
|
DesignCraft pins `craft-pdf`, patched Krilla 0.8.2 and the four Hayro reader crates to
|
|
craft-libs revision `89dcbb3060377a26c99a6d80caa16084366704c4`. Existing `craft-ui` and `craft-print` revisions
|
|
remain unchanged. The reader migration is reviewed on top of the separate writer change.
|
|
|
|
## Writing
|
|
|
|
The `write-pdf` capability is required for placed PDF pages and book merging.
|
|
|
|
The shared library supplies fallible font copying/preparation, metadata setup, version and
|
|
archival configuration, final serialization and a native unwind guard. DesignCraft retains
|
|
layout, shaping, font choice/licensing, fallback warnings, image caches, links, tagging,
|
|
bleed/marks, PDF/X postprocessing and export presets. A shared writer does not improve the
|
|
format-conformance or product-parity claims by itself.
|
|
|
|
`export_pdf_with_report`, `export_booklet` and `merge_pdfs` guard the whole export, including
|
|
painting and postprocessing. A native drawing panic becomes `PdfError::Write`. A failed
|
|
page or surface cleanup permanently poisons the backend writer, preventing successful
|
|
serialization of an incomplete document after a narrow catch. Discard other captured app
|
|
state after an internal failure. These guards do not catch WASM aborts, allocation aborts,
|
|
or errors in preceding application operations such as print preparation.
|
|
|
|
Cargo applies patches only from the consuming workspace root. Keep the Krilla patch and
|
|
facade at the same full immutable commit, including Krilla reached through `krilla-svg`.
|
|
`cargo xtask pdf-deps` verifies their resolved versions, source and uniqueness, and runs in
|
|
`cargo xtask ci`. Publish the dependency revision before publishing this consumer branch.
|
|
Local path replacements are suitable only for development and should not be committed.
|
|
|
|
The vendored Krilla patch ledger, per-file hashes, licence texts and four unchanged CC0
|
|
Compact ICC profiles live in craft-libs (`vendor/krilla`, `licenses/pdf-writer`, and
|
|
`ATTRIBUTION.md`). No fonts or binary PDF fixtures are added to DesignCraft by this migration.
|
|
|
|
Tests cover metadata key presence, hostile page selection, successful PDF export and native
|
|
subprocess recovery for all three export entry points. Native/WASM export comparisons and
|
|
independent PDF parsing/rendering supplement the repository gates. Physical printer output,
|
|
Windows/Linux runtime and PDF/A/PDF/X certification remain separate acceptance work.
|
|
|
|
## Reading
|
|
|
|
Placed-PDF geometry, layers and raster output use `craft-pdf` with its explicit `raster`
|
|
feature. The facade and four patched Hayro crates are pinned to one immutable craft-libs
|
|
revision. The backend source was transferred from PdfCraft revision
|
|
`7437bde378f43856eada40af25b983812e615e8a`; the per-crate `vendor/SOURCE.json` manifests and `vendor/README.craft-reader.md`
|
|
record the transfer and subsequent craft-libs patches. Asset provenance and hashes
|
|
are recorded separately in ASSETS.md.
|
|
`cargo xtask pdf-deps` checks unique resolved packages, exact versions and sources.
|
|
|
|
DesignCraft retains placement, layer-name policy, document state and the application render
|
|
cache. Render output is premultiplied RGBA8. Page boxes use the same crop, rotation and
|
|
UserUnit transform as raster output, including fractional placed-PDF dimensions.
|
|
Layered-PDF export stops on failed layer rewriting, missing pages or reported incomplete
|
|
content rather than saving an unchanged or incomplete placed page. Shared diagnostics only
|
|
report known backend warnings; they do not certify all PDF fidelity.
|
|
|
|
DesignCraft uses a 512 MiB reader input bound, checked before parsing or copying.
|
|
Raster output has shared geometry/allocation bounds. Native unwind guards turn escaped
|
|
backend panics into errors; WASM aborts and process-wide allocation failures are not recoverable.
|
|
Application fonts, image assets, editing and export presets remain app-owned. Existing
|
|
craft-ui/craft-print versions are preserved. The reader migration builds on the independently qualified writer change.
|
|
|
|
The shared commit must be published before a fresh public checkout can resolve these pins.
|
|
No sibling checkout is required. Licences and existing backend asset notices are recorded in
|
|
NOTICE, ASSETS.md and licenses/pdf-backend. The backend's removed LAB.icc is not restored.
|