PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Rename PrintCraft to PdfCraft (#174)
Brandon Thomasd3db99818f53
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ae2f93fb1..7f2730a3e 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -78,7 +78,7 @@ jobs:- name: CLI without the MCP server still buildsif: runner.os == 'Linux'- run: cargo check -p printcraft-cli --no-default-features+ run: cargo check -p pdfcraft-cli --no-default-featureswasm:name: wasm32 checkdiff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.ymlindex 4c9849b01..a86fc140b 100644--- a/.github/workflows/freebsd.yml+++ b/.github/workflows/freebsd.yml@@ -49,4 +49,4 @@ jobs:CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked# The release packaging, end to end (a quicker release profile than the real release).CARGO_PROFILE_RELEASE_LTO=false CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 packaging/freebsd/package.sh- tar -tzf dist/release/printcraft-*-freebsd-*.tar.gz | grep -E '/bin/printcraft$|/bin/printcraft-cli$|applications/'+ tar -tzf dist/release/pdfcraft-*-freebsd-*.tar.gz | grep -E '/bin/pdfcraft$|/bin/pdfcraft-cli$|applications/'diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.ymlindex 29817c7eb..39adb8d5b 100644--- a/.github/workflows/packaging-lint.yml+++ b/.github/workflows/packaging-lint.yml@@ -46,12 +46,12 @@ jobs:}- name: XML, desktop entry, AppStream, Flatpak manifestrun: |- xmllint --noout packaging/windows/printcraft.wxs packaging/macos/*.plist* packaging/linux/*.xml*+ xmllint --noout packaging/windows/pdfcraft.wxs packaging/macos/*.plist* packaging/linux/*.xml*# Windows Installer needs Icon ids ending in .ico or .exe, or shortcuts show a blank icon (#57).- if grep -oE '<Icon Id="[^"]*"' packaging/windows/printcraft.wxs | grep -vE '\.(ico|exe)"$'; then- echo "::error file=packaging/windows/printcraft.wxs::Icon Id must end in .ico or .exe"; exit 1+ if grep -oE '<Icon Id="[^"]*"' packaging/windows/pdfcraft.wxs | grep -vE '\.(ico|exe)"$'; then+ echo "::error file=packaging/windows/pdfcraft.wxs::Icon Id must end in .ico or .exe"; exit 1fi- desktop-file-validate packaging/linux/ai.storyteller.printcraft.desktop- sed -e 's/@VERSION@/0.0.0/' -e 's/@DATE@/2026-01-01/' packaging/linux/ai.storyteller.printcraft.metainfo.xml.in >"$RUNNER_TEMP/ai.storyteller.printcraft.metainfo.xml"- appstreamcli validate --no-net --explain "$RUNNER_TEMP/ai.storyteller.printcraft.metainfo.xml"- python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.printcraft.yml')); assert m['id'] == 'ai.storyteller.printcraft' and m['command'] == 'printcraft'"+ desktop-file-validate packaging/linux/ai.storyteller.pdfcraft.desktop+ sed -e 's/@VERSION@/0.0.0/' -e 's/@DATE@/2026-01-01/' packaging/linux/ai.storyteller.pdfcraft.metainfo.xml.in >"$RUNNER_TEMP/ai.storyteller.pdfcraft.metainfo.xml"+ appstreamcli validate --no-net --explain "$RUNNER_TEMP/ai.storyteller.pdfcraft.metainfo.xml"+ python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.pdfcraft.yml')); assert m['id'] == 'ai.storyteller.pdfcraft' and m['command'] == 'pdfcraft'"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 7533b7c66..7e7094226 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,5 +1,5 @@# Release pipeline: every push to `release` builds signed installers for every platform and-# creates or updates the draft GitHub Release "PrintCraft v<version>". See docs/releasing.md.+# creates or updates the draft GitHub Release "PdfCraft v<version>". See docs/releasing.md.## All jobs run in the `release` environment (restricted to the `release` branch), which holds# the signing secrets. Every secret is optional: missing ones produce unsigned artifacts and a@@ -28,7 +28,7 @@ env:CARGO_TERM_COLOR: alwaysCARGO_INCREMENTAL: 0RUST_BACKTRACE: 1- PRINTCRAFT_BUILD_SHA: ${{ github.sha }}+ PDFCRAFT_BUILD_SHA: ${{ github.sha }}INPUT_VERSION: ${{ inputs.version }}jobs:@@ -58,7 +58,7 @@ jobs:echo "date=$(date -u +%Y-%m-%d)"echo "prerelease=$pre"} >>"$GITHUB_OUTPUT"- echo "### PrintCraft v$v (\`${GITHUB_SHA::9}\`)" >>"$GITHUB_STEP_SUMMARY"+ echo "### PdfCraft v$v (\`${GITHUB_SHA::9}\`)" >>"$GITHUB_STEP_SUMMARY"macos:name: macOS universal@@ -66,8 +66,8 @@ jobs:runs-on: macos-15environment: releaseenv:- PRINTCRAFT_VERSION: ${{ needs.version.outputs.version }}- PRINTCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}+ PDFCRAFT_VERSION: ${{ needs.version.outputs.version }}+ PDFCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}steps:- uses: actions/checkout@v4# The craft-fonts build input (Japanese fonts): every release embeds it. Bump deliberately.@@ -85,7 +85,7 @@ jobs:key: release-macos-universal- name: Apply version overrideif: inputs.version != ''- run: cargo xtask version set "$PRINTCRAFT_VERSION"+ run: cargo xtask version set "$PDFCRAFT_VERSION"- name: Import signing certificateenv:APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}@@ -125,8 +125,8 @@ jobs:# .github/workflows/windows-arm64.yml installs and runs it on ARM64 hardware.- { arch: arm64, target: aarch64-pc-windows-msvc }env:- PRINTCRAFT_VERSION: ${{ needs.version.outputs.version }}- PRINTCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}+ PDFCRAFT_VERSION: ${{ needs.version.outputs.version }}+ PDFCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}steps:- uses: actions/checkout@v4# The craft-fonts build input (Japanese fonts): every release embeds it. Bump deliberately.@@ -145,7 +145,7 @@ jobs:- name: Apply version overrideif: inputs.version != ''shell: bash- run: cargo xtask version set "$PRINTCRAFT_VERSION"+ run: cargo xtask version set "$PDFCRAFT_VERSION"- name: Install WiXshell: pwshrun: dotnet tool install --global wix --version 5.0.2@@ -183,8 +183,8 @@ jobs:- { arch: x86_64, runner: ubuntu-22.04, deb: amd64 }- { arch: aarch64, runner: ubuntu-22.04-arm, deb: arm64 }env:- PRINTCRAFT_VERSION: ${{ needs.version.outputs.version }}- PRINTCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}+ PDFCRAFT_VERSION: ${{ needs.version.outputs.version }}+ PDFCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}NFPM_VERSION: 2.47.0steps:- uses: actions/checkout@v4@@ -210,7 +210,7 @@ jobs:key: release-linux-${{ matrix.arch }}- name: Apply version overrideif: inputs.version != ''- run: cargo xtask version set "$PRINTCRAFT_VERSION"+ run: cargo xtask version set "$PDFCRAFT_VERSION"- name: Build and package (AppImage, deb, rpm, tar.gz)env:CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts@@ -219,9 +219,9 @@ jobs:- name: Check the packagesrun: |dpkg-deb --info dist/release/*.deb- dpkg-deb --contents dist/release/*.deb | grep -E 'usr/bin/printcraft$|metainfo|applications'- ldd target/release/printcraft- python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.printcraft.yml')); assert m['id'] == 'ai.storyteller.printcraft'"+ dpkg-deb --contents dist/release/*.deb | grep -E 'usr/bin/pdfcraft$|metainfo|applications'+ ldd target/release/pdfcraft+ python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.pdfcraft.yml')); assert m['id'] == 'ai.storyteller.pdfcraft'"for appimage in dist/release/*.AppImage; dochmod +x "$appimage"APPIMAGE_EXTRACT_AND_RUN=1 "$appimage" --version@@ -240,8 +240,8 @@ jobs:environment: releasetimeout-minutes: 180env:- PRINTCRAFT_VERSION: ${{ needs.version.outputs.version }}- PRINTCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}+ PDFCRAFT_VERSION: ${{ needs.version.outputs.version }}+ PDFCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}VERSION_OVERRIDE: ${{ inputs.version }}steps:- uses: actions/checkout@v4@@ -260,7 +260,7 @@ jobs:usesh: truecpu: 4mem: 12288- envs: "PRINTCRAFT_VERSION PRINTCRAFT_BUILD_DATE VERSION_OVERRIDE"+ envs: "PDFCRAFT_VERSION PDFCRAFT_BUILD_DATE VERSION_OVERRIDE"# The same packages as the FreeBSD CI workflow, plus bash for the packaging script.prepare: |pkg install -y bash git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib@@ -270,7 +270,7 @@ jobs:. "$HOME/.cargo/env"git config --global --add safe.directory "$PWD"export CRAFT_FONTS_DIR="$PWD/craft-fonts" CRAFT_FONTS_REQUIRED=1- if [ -n "$VERSION_OVERRIDE" ]; then cargo xtask version set "$PRINTCRAFT_VERSION"; fi+ if [ -n "$VERSION_OVERRIDE" ]; then cargo xtask version set "$PDFCRAFT_VERSION"; fipackaging/freebsd/package.sh# Only dist/ comes back out of the VM: copying the target dir back fails on large builds.rm -rf target@@ -286,8 +286,8 @@ jobs:runs-on: ubuntu-latestenvironment: releaseenv:- PRINTCRAFT_VERSION: ${{ needs.version.outputs.version }}- PRINTCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}+ PDFCRAFT_VERSION: ${{ needs.version.outputs.version }}+ PDFCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }}TRUNK_VERSION: 0.21.14steps:- uses: actions/checkout@v4@@ -311,7 +311,7 @@ jobs:trunk --version- name: Apply version overrideif: inputs.version != ''- run: cargo xtask version set "$PRINTCRAFT_VERSION"+ run: cargo xtask version set "$PDFCRAFT_VERSION"- name: Build and zipenv:CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts@@ -349,7 +349,7 @@ jobs:working-directory: artifactsrun: |tag="v$VERSION"- title="PrintCraft v$VERSION"+ title="PdfCraft v$VERSION"pre=()if [ "$PRERELEASE" = true ]; then pre=(--prerelease); fiif draft="$(gh release view "$tag" --json isDraft --jq .isDraft 2>/dev/null)"; thendiff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.ymlindex bb05a3eb2..d831ffc50 100644--- a/.github/workflows/windows-arm64.yml+++ b/.github/workflows/windows-arm64.yml@@ -53,7 +53,7 @@ jobs:run: ./packaging/windows/package.ps1 -Arch arm64- uses: actions/upload-artifact@v4with:- name: printcraft-windows-arm64+ name: pdfcraft-windows-arm64path: dist/arm64/*if-no-files-found: errorretention-days: 7@@ -66,7 +66,7 @@ jobs:steps:- uses: actions/download-artifact@v4with:- name: printcraft-windows-arm64+ name: pdfcraft-windows-arm64path: dist- name: Install the MSI, check it, run it, uninstall itshell: pwsh@@ -75,8 +75,8 @@ jobs:$msi = (Get-ChildItem dist/*.msi | Select-Object -First 1).FullName$p = Start-Process msiexec.exe -ArgumentList '/i', "`"$msi`"", '/qn', '/l*v', 'install.log' -Wait -PassThruif ($p.ExitCode -ne 0) { Get-Content install.log -Tail 60; throw "msiexec /i exited $($p.ExitCode)" }- $dir = Join-Path $env:ProgramFiles 'PrintCraft'- foreach ($exe in 'printcraft.exe', 'printcraft-cli.exe') {+ $dir = Join-Path $env:ProgramFiles 'PdfCraft'+ foreach ($exe in 'pdfcraft.exe', 'pdfcraft-cli.exe') {$path = Join-Path $dir $exeif (-not (Test-Path $path)) { Get-ChildItem -Recurse $env:ProgramFiles -Filter $exe | Select-Object -First 3; throw "$exe not installed in $dir" }$bytes = [System.IO.File]::ReadAllBytes($path)@@ -85,9 +85,9 @@ jobs:Write-Output "ok $path (ARM64)"}# The installed CLI runs natively: open, render and edit a small PDF through the engine.- $cli = Join-Path $dir 'printcraft-cli.exe'+ $cli = Join-Path $dir 'pdfcraft-cli.exe'& $cli tools | Out-Null- if ($LASTEXITCODE -ne 0) { throw "printcraft-cli tools exited $LASTEXITCODE" }+ if ($LASTEXITCODE -ne 0) { throw "pdfcraft-cli tools exited $LASTEXITCODE" }$body = 'BT /F1 24 Tf 20 150 Td (Hello ARM64) Tj ET'$objs = @('<< /Type /Catalog /Pages 2 0 R >>', '<< /Type /Pages /Kids [3 0 R] /Count 1 >>','<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 200] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>',@@ -103,13 +103,13 @@ jobs:$steps = '[{"tool":"doc_open","args":{"path":"hello.pdf"}},{"tool":"text_paragraphs","args":{"doc":1,"page":1}},{"tool":"text_edit","args":{"doc":1,"page":1,"paragraph":1,"text":"Edited on ARM64"}},{"tool":"page_render","args":{"doc":1,"page":1,"dpi":72},"out":"smoke/page.png"},{"tool":"doc_save","args":{"doc":1,"path":"out.pdf"}}]'[System.IO.File]::WriteAllText("$PWD\smoke\steps.json", $steps)$out = & $cli run --script smoke\steps.json --root smoke 2>&1 | Out-String- if ($LASTEXITCODE -ne 0) { Write-Output $out; throw "printcraft-cli run exited $LASTEXITCODE" }+ if ($LASTEXITCODE -ne 0) { Write-Output $out; throw "pdfcraft-cli run exited $LASTEXITCODE" }if ($out -notmatch 'Hello ARM64') { Write-Output $out; throw 'text_paragraphs did not read the page' }foreach ($f in 'smoke\page.png', 'smoke\out.pdf') { if (-not (Test-Path $f) -or (Get-Item $f).Length -eq 0) { Write-Output $out; throw "$f was not written" } }- Write-Output 'ok printcraft-cli: opened, read, edited, rendered and saved a PDF on ARM64'+ Write-Output 'ok pdfcraft-cli: opened, read, edited, rendered and saved a PDF on ARM64'$p = Start-Process msiexec.exe -ArgumentList '/x', "`"$msi`"", '/qn' -Wait -PassThruif ($p.ExitCode -ne 0) { throw "msiexec /x exited $($p.ExitCode)" }- if (Test-Path (Join-Path $dir 'printcraft.exe')) { throw 'uninstall left printcraft.exe behind' }+ if (Test-Path (Join-Path $dir 'pdfcraft.exe')) { throw 'uninstall left pdfcraft.exe behind' }Write-Output 'ok uninstalled'test:diff --git a/AGENTS.md b/AGENTS.mdindex 0c6d84078..0720da26e 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -37,7 +37,7 @@ Every asset must be one of:- **Public domain.**- **Contributor-original:** created, photographed or generated by a contributor who owns it and licenses it under the project licence (`MIT OR Apache-2.0`).-**One narrow exception: the ArtCraft brand.** The ArtCraft name, wordmark and logos in `docs/brand/` are trademarks of the ArtCraft Team and are **not** open source (manifest identifier `LicenseRef-Storyteller-Trademark`, terms in `docs/brand/LICENSE-brand.txt`). They may be used only unmodified, only within PrintCraft, and only as `kind = "logo"` entries from that directory, to identify the project. Forks and modified versions must remove them. Never add other files under this licence, and never modify the logos.+**One narrow exception: the ArtCraft brand.** The ArtCraft name, wordmark and logos in `docs/brand/` are trademarks of the ArtCraft Team and are **not** open source (manifest identifier `LicenseRef-Storyteller-Trademark`, terms in `docs/brand/LICENSE-brand.txt`). They may be used only unmodified, only within PdfCraft, and only as `kind = "logo"` entries from that directory, to identify the project. Forks and modified versions must remove them. Never add other files under this licence, and never modify the logos.Anything else is forbidden, including assets whose licence you cannot prove from the source. Examples:- system fonts (Apple, Microsoft, Google Android system UI fonts that are not openly licensed);@@ -46,7 +46,7 @@ Anything else is forbidden, including assets whose licence you cannot prove from- "free for personal use" material;- screenshots of other people's software.-**Screenshots of PrintCraft** are contributor-original. Everything visible in them must itself be allowed: our UI, Lucide icons, OFL fonts, and demo documents built only from allowed assets. Never screenshot a document that uses proprietary fonts or images.+**Screenshots of PdfCraft** are contributor-original. Everything visible in them must itself be allowed: our UI, Lucide icons, OFL fonts, and demo documents built only from allowed assets. Never screenshot a document that uses proprietary fonts or images.### 1.3 Every asset is attributed@@ -69,7 +69,7 @@ Anything else is forbidden, including assets whose licence you cannot prove from### 1.4 Fonts live in craft-fonts- Font assets shared by the Crafting Apps, including every Japanese font, live in [`storytold/craft-fonts`](https://github.com/storytold/craft-fonts), not here. **Never commit a font file to this repository**; adding a font means adding it to craft-fonts. (The Latin UI fonts already in `assets/fonts/` — Inter, JetBrains Mono, Dancing Script — stay.) Team members: the shared rules are in [craftrules `standards/fonts.md`](https://github.com/storytold/craftrules/blob/main/standards/fonts.md) (internal).-- craft-fonts is an **optional build input**, never a Cargo dependency: `CRAFT_FONTS_DIR=<checkout> cargo build` makes `crates/fonts/build.rs` embed its fonts as `printcraft_fonts::CRAFT_FONTS`. Without it PrintCraft builds, tests and runs, but has no Japanese face (Japanese UI text shows replacement boxes, and writing Japanese into a PDF returns a clear error). Release builds always set it (`.github/workflows/release.yml`), and `ATTRIBUTION.toml` lists it as a `[[build_input]]`.+- craft-fonts is an **optional build input**, never a Cargo dependency: `CRAFT_FONTS_DIR=<checkout> cargo build` makes `crates/fonts/build.rs` embed its fonts as `pdfcraft_fonts::CRAFT_FONTS`. Without it PdfCraft builds, tests and runs, but has no Japanese face (Japanese UI text shows replacement boxes, and writing Japanese into a PDF returns a clear error). Release builds always set it (`.github/workflows/release.yml`), and `ATTRIBUTION.toml` lists it as a `[[build_input]]`.### 1.5 Procedure for adding or changing an asset@@ -94,16 +94,16 @@ If you find an asset that breaks these rules, stop and remove it from the reposi## 3. Agent control (automation and MCP)-- **Everything is reachable headlessly.** Every user-facing feature must be callable without the GUI: an engine API, then a tool in `crates/automation` (`printcraft-cli run` and MCP use the same table). A feature is not done until its tool exists and has an end-to-end test (`crates/automation/README.md`, "Adding a tool").+- **Everything is reachable headlessly.** Every user-facing feature must be callable without the GUI: an engine API, then a tool in `crates/automation` (`pdfcraft-cli run` and MCP use the same table). A feature is not done until its tool exists and has an end-to-end test (`crates/automation/README.md`, "Adding a tool").- **The UI control channel is opt-in too.** It runs only when the app is launched with `--control <file>`. It binds to loopback, uses a fresh random token per launch, and writes it to an owner-only file. Never enable it by default, widen the bind address, or log the token.-- **The MCP server is opt-in.** Never make the app, the CLI or an installer start it, register it with an agent, or listen on a port by default. It runs only when a user (or an agent the user configured) launches `printcraft-cli mcp`. Any future network transport must be off by default, bound to loopback and authenticated with a token.+- **The MCP server is opt-in.** Never make the app, the CLI or an installer start it, register it with an agent, or listen on a port by default. It runs only when a user (or an agent the user configured) launches `pdfcraft-cli mcp`. Any future network transport must be off by default, bound to loopback and authenticated with a token.- **Safe by default.** Tools must never discard unsaved work silently, must write atomically, must honour `--root`, and must return errors an agent can act on (say what was wrong and what is allowed).- **Track parity honestly.** Every user-facing feature has an entry in `parity/acrobat-features.toml`. Mark it `shipped` only when it works end to end and the entry cites a passing test (`evidence`); `cargo xtask parity` (part of `xtask ci`) rejects claims whose commands, tools or tests don't exist.-- **Use it to test.** Agents should drive the engine through `printcraft-cli run --script` or the MCP tools, and look at `page_render` output, to check their own changes. For UI changes, launch the app with `--control` and use `printcraft-cli ui` (`inspect`, `click`, `screenshot`) to check the real interface.+- **Use it to test.** Agents should drive the engine through `pdfcraft-cli run --script` or the MCP tools, and look at `page_render` output, to check their own changes. For UI changes, launch the app with `--control` and use `pdfcraft-cli ui` (`inspect`, `click`, `screenshot`) to check the real interface.## 4. Never crash-PrintCraft opens files from strangers, and people trust it with their work. A malformed PDF, a bad tool argument, a corrupt settings file or a full disk must produce an error the user (or agent) can act on, never a crash and never lost work. **This outranks feature work:** don't ship a feature by adding a panic path, and fix a crash before building on top of it. The rules below are the ones that bind this repository; the shared standard for every Crafting App, [`craftrules/standards/never-crash.md`](https://github.com/storytold/craftrules/blob/main/standards/never-crash.md), is internal to the storytold team.+PdfCraft opens files from strangers, and people trust it with their work. A malformed PDF, a bad tool argument, a corrupt settings file or a full disk must produce an error the user (or agent) can act on, never a crash and never lost work. **This outranks feature work:** don't ship a feature by adding a panic path, and fix a crash before building on top of it. The rules below are the ones that bind this repository; the shared standard for every Crafting App, [`craftrules/standards/never-crash.md`](https://github.com/storytold/craftrules/blob/main/standards/never-crash.md), is internal to the storytold team.- **Fail with `Result`.** Non-test code returns errors through the crate's error type and `?`. Where readers are lenient by design, fall back gracefully and record the repair (see Fidelity in `CLAUDE.md`).- **No panicking shortcuts.** No `unwrap()`, `expect()`, `panic!`, `unreachable!`, `todo!` or `unimplemented!` outside tests, unless the call is provably infallible (e.g. writing to a `Vec`), with a comment saying why. `assert!` only for internal invariants that input cannot reach.diff --git a/ATTRIBUTION.md b/ATTRIBUTION.mdindex 2f0ded9a9..dc6025140 100644--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@ -2,7 +2,7 @@<!-- Generated from ATTRIBUTION.toml by `cargo xtask assets --write`. Do not edit by hand. -->-Every asset PrintCraft includes, bundles or uses to build its published material, with its author, source and licence. The policy is in [AGENTS.md](AGENTS.md) §1. The machine-readable list, with SHA-256 hashes, is [ATTRIBUTION.toml](ATTRIBUTION.toml). Licence texts are kept beside the assets and summarised in [NOTICE](NOTICE).+Every asset PdfCraft includes, bundles or uses to build its published material, with its author, source and licence. The policy is in [AGENTS.md](AGENTS.md) §1. The machine-readable list, with SHA-256 hashes, is [ATTRIBUTION.toml](ATTRIBUTION.toml). Licence texts are kept beside the assets and summarised in [NOTICE](NOTICE).## In this repository (242)@@ -202,41 +202,41 @@ Every asset PrintCraft includes, bundles or uses to build its published material| `vendor/hayro-interpret/assets/FoxitSymbol.pfb` | FoxitSymbol (standard-14 substitute font) | Foxit Software Inc. / PDFium Authors | BSD-3-Clause | https://pdfium.googlesource.com/pdfium (via hayro-interpret 0.7.0 assets/) | Renders non-embedded standard-14 fonts (vendored hayro-interpret) || `vendor/hayro-interpret/assets/CGATS001Compat-v2-micro.icc` | CGATS001Compat v2 micro ICC profile | Clinton Ingram (saucecontrol/Compact-ICC-Profiles) | CC0-1.0 | https://github.com/saucecontrol/Compact-ICC-Profiles | Default CMYK colour conversion (vendored hayro-interpret) || `vendor/hayro-interpret/assets/LAB.icc` | Lab abstract ICC profile | The Hayro Authors (generated with LittleCMS 2) | MIT OR Apache-2.0 | https://github.com/LaurenzV/hayro (hayro-interpret 0.7.0 assets/) | Lab colour space conversion (vendored hayro-interpret) |-| `docs/brand/artcraft-logo-white.png` | ArtCraft brand: artcraft-logo-white | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-logo-white.svg` | ArtCraft brand: artcraft-logo-white | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-logo.png` | ArtCraft brand: artcraft-logo | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-logo.svg` | ArtCraft brand: artcraft-logo | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-mark-black.png` | ArtCraft brand: artcraft-mark-black | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-mark-black.svg` | ArtCraft brand: artcraft-mark-black | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-mark.png` | ArtCraft brand: artcraft-mark | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `docs/brand/artcraft-mark.svg` | ArtCraft brand: artcraft-mark | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it. |-| `assets/app-icon/printcraft.svg` | PrintCraft app icon (master vector) | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Master artwork; every other app-icon file is rendered from it (packaging/icons.sh) |-| `assets/app-icon/printcraft-small.svg` | PrintCraft app icon (light vector) | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | README header and assets/app-icon/README.md |-| `assets/app-icon/printcraft-1024.png` | PrintCraft app icon, 1024 px on Apple's icon grid | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Runtime window/Dock icon on macOS (apps/printcraft/src/main.rs) |-| `assets/app-icon/printcraft.icns` | PrintCraft app icon (macOS .icns) | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | macOS app bundle icon |-| `assets/app-icon/printcraft.ico` | PrintCraft app icon (Windows .ico, 16-256 px) | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Embedded in printcraft.exe by apps/printcraft/build.rs (Explorer, taskbar, Start menu, Alt-Tab) |-| `assets/app-icon/hicolor/16x16/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 16 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/24x24/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 24 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/32x32/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 32 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/48x48/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 48 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/64x64/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 64 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/128x128/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 128 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/256x256/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 256 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop); runtime window icon on Windows and Linux (apps/printcraft/src/main.rs) |-| `assets/app-icon/hicolor/512x512/apps/ai.storyteller.printcraft.png` | PrintCraft app icon, 512 px | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `assets/app-icon/hicolor/scalable/apps/ai.storyteller.printcraft.svg` | PrintCraft app icon (Linux scalable) | PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop) |-| `docs/images/printcraft-bookmarks.png` | PrintCraft screenshot: Bookmarks | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: navigation. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-dark.png` | PrintCraft screenshot: Dark theme | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: themes. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-find.png` | PrintCraft screenshot: Find text | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: search. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-forms.png` | PrintCraft screenshot: Interactive form | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: forms. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-layers.png` | PrintCraft screenshot: Layers | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: layers. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-organize.png` | PrintCraft screenshot: Organize pages | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: organize. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-palette.png` | PrintCraft screenshot: Command palette | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: tools. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-properties.png` | PrintCraft screenshot: Document properties | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: metadata. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-scripts.png` | PrintCraft screenshot: Scripts of the world | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: rendering. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-split.png` | PrintCraft screenshot: Split dialog | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: split. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-tools.png` | PrintCraft screenshot: All tools | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: tool catalogue. Shows PrintCraft UI, Lucide icons, the showcase PDF built from the [[fetched]] OFL fonts, and the ArtCraft mark (Storyteller trademark from docs/brand/, not covered by this licence) |-| `docs/images/printcraft-twoup.png` | PrintCraft screenshot: Two-up reading | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: layouts. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |-| `docs/images/printcraft-viewer.png` | PrintCraft screenshot: Viewer with comments | PrintCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README hero. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/brand/artcraft-logo-white.png` | ArtCraft brand: artcraft-logo-white | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-logo-white.svg` | ArtCraft brand: artcraft-logo-white | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-logo.png` | ArtCraft brand: artcraft-logo | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-logo.svg` | ArtCraft brand: artcraft-logo | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-mark-black.png` | ArtCraft brand: artcraft-mark-black | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-mark-black.svg` | ArtCraft brand: artcraft-mark-black | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-mark.png` | ArtCraft brand: artcraft-mark | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `docs/brand/artcraft-mark.svg` | ArtCraft brand: artcraft-mark | ArtCraft Team | LicenseRef-Storyteller-Trademark | ArtCraft Team brand assets (provided by the project owner, 2026-10-01; identical copies in storytold/photocraft) | ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it. |+| `assets/app-icon/pdfcraft.svg` | PdfCraft app icon (master vector) | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Master artwork; every other app-icon file is rendered from it (packaging/icons.sh) |+| `assets/app-icon/pdfcraft-small.svg` | PdfCraft app icon (light vector) | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | README header and assets/app-icon/README.md |+| `assets/app-icon/pdfcraft-1024.png` | PdfCraft app icon, 1024 px on Apple's icon grid | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Runtime window/Dock icon on macOS (apps/pdfcraft/src/main.rs) |+| `assets/app-icon/pdfcraft.icns` | PdfCraft app icon (macOS .icns) | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | macOS app bundle icon |+| `assets/app-icon/pdfcraft.ico` | PdfCraft app icon (Windows .ico, 16-256 px) | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Embedded in pdfcraft.exe by apps/pdfcraft/build.rs (Explorer, taskbar, Start menu, Alt-Tab) |+| `assets/app-icon/hicolor/16x16/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 16 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/24x24/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 24 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/32x32/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 32 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/48x48/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 48 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/64x64/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 64 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/128x128/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 128 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/256x256/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 256 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop); runtime window icon on Windows and Linux (apps/pdfcraft/src/main.rs) |+| `assets/app-icon/hicolor/512x512/apps/ai.storyteller.pdfcraft.png` | PdfCraft app icon, 512 px | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `assets/app-icon/hicolor/scalable/apps/ai.storyteller.pdfcraft.svg` | PdfCraft app icon (Linux scalable) | PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py) | MIT OR Apache-2.0 | Contributor-original (see assets/app-icon/README.md) | Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop) |+| `docs/images/pdfcraft-bookmarks.png` | PdfCraft screenshot: Bookmarks | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: navigation. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-dark.png` | PdfCraft screenshot: Dark theme | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: themes. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-find.png` | PdfCraft screenshot: Find text | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: search. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-forms.png` | PdfCraft screenshot: Interactive form | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: forms. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-layers.png` | PdfCraft screenshot: Layers | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: layers. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-organize.png` | PdfCraft screenshot: Organize pages | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: organize. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-palette.png` | PdfCraft screenshot: Command palette | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: tools. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-properties.png` | PdfCraft screenshot: Document properties | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: metadata. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-scripts.png` | PdfCraft screenshot: Scripts of the world | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: rendering. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-split.png` | PdfCraft screenshot: Split dialog | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: split. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-tools.png` | PdfCraft screenshot: All tools | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: tool catalogue. Shows PdfCraft UI, Lucide icons, the showcase PDF built from the [[fetched]] OFL fonts, and the ArtCraft mark (Storyteller trademark from docs/brand/, not covered by this licence) |+| `docs/images/pdfcraft-twoup.png` | PdfCraft screenshot: Two-up reading | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README: layouts. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts |+| `docs/images/pdfcraft-viewer.png` | PdfCraft screenshot: Viewer with comments | PdfCraft contributors (generated by `cargo xtask screenshots`) | MIT OR Apache-2.0 | this repository | README hero. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts || `assets/icons/pin.svg` | Lucide icon "pin" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/pin.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs || `assets/icons/move-right.svg` | Lucide icon "move-right" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/move-right.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs || `assets/icons/reply.svg` | Lucide icon "reply" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/reply.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |@@ -244,10 +244,10 @@ Every asset PrintCraft includes, bundles or uses to build its published material| `assets/icons/thumbs-down.svg` | Lucide icon "thumbs-down" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/thumbs-down.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs || `assets/icons/message-square-plus.svg` | Lucide icon "message-square-plus" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/message-square-plus.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs || `assets/icons/circle-x.svg` | Lucide icon "circle-x" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/circle-x.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |-| `crates/ui-egui/tests/data/form.pdf` | One-page AcroForm test fixture (text, check box, radio group, combo box) | PrintCraft contributors | MIT OR Apache-2.0 | Contributor-original: hand-written PDF objects, no third-party content | Form-filling UI tests (crates/ui-egui/tests/forms.rs, commands.rs) |+| `crates/ui-egui/tests/data/form.pdf` | One-page AcroForm test fixture (text, check box, radio group, combo box) | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: hand-written PDF objects, no third-party content | Form-filling UI tests (crates/ui-egui/tests/forms.rs, commands.rs) || `assets/icons/pentagon.svg` | Lucide icon "pentagon" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/pentagon.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs || `assets/icons/message-square-quote.svg` | Lucide icon "message-square-quote" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/message-square-quote.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |-| `crates/sign/tests/data/openssl-signed.pdf` | One-page PDF signed with OpenSSL CMS (adbe.pkcs7.detached) by the RSA test key | PrintCraft contributors | MIT OR Apache-2.0 | Contributor-original: hand-written PDF objects; signature made with `openssl cms -sign` over its byte ranges (see crates/sign/tests/data/README.md) | Signature validation tests (crates/sign/tests/pdf.rs): a signature PrintCraft did not make |+| `crates/sign/tests/data/openssl-signed.pdf` | One-page PDF signed with OpenSSL CMS (adbe.pkcs7.detached) by the RSA test key | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: hand-written PDF objects; signature made with `openssl cms -sign` over its byte ranges (see crates/sign/tests/data/README.md) | Signature validation tests (crates/sign/tests/pdf.rs): a signature PdfCraft did not make || `assets/icons/clipboard-paste.svg` | Lucide icon "clipboard-paste" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/clipboard-paste.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs || `assets/fonts/DancingScript.ttf` | Dancing Script (variable) | The Dancing Script Project Authors (Pablo Impallari) | OFL-1.1 | https://github.com/google/fonts/blob/9710da1eacb3be272583c3224dcb70f9da6eadbb/ofl/dancingscript/DancingScript%5Bwght%5D.ttf | Fill & Sign typed signatures and initials: the typed name's glyph outlines, drawn as filled paths (the font file itself is not embedded in PDFs) |diff --git a/ATTRIBUTION.toml b/ATTRIBUTION.tomlindex 796b5b6c5..b2008de41 100644--- a/ATTRIBUTION.toml+++ b/ATTRIBUTION.toml@@ -2,7 +2,7 @@# ATTRIBUTION.md is generated from this file: `cargo xtask assets --write`. Checked by `cargo xtask assets` (part of `xtask ci`).## [[asset]] a file in this repository (committed or vendored); `sha256` must match the file.-# [[bundled]] a file compiled into PrintCraft by a Cargo dependency (its crate version must match Cargo.lock).+# [[bundled]] a file compiled into PdfCraft by a Cargo dependency (its crate version must match Cargo.lock).# [[fetched]] downloaded at build time by xtask (never committed), pinned by `sha256`.# [[build_input]] an optional build input outside this repository (e.g. craft-fonts via CRAFT_FONTS_DIR);# never committed or downloaded here, its own repository attributes each file.@@ -2486,7 +2486,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "8b86aeb06a12a90ba77a60e0d90329272310e244ee5c1f9b161b391280ca79d8"[[asset]]@@ -2497,7 +2497,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "a3e03dc49f9ad4225b8517d5424309c8d1c864d3996d862190d9cc797d5af427"[[asset]]@@ -2508,7 +2508,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "08fc6d9d3717e8f13417bac6f9025b50e11d1e0b32e9e000883d2fe0c4a0c67b"[[asset]]@@ -2519,7 +2519,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "3188971e1affdf4f6be4fa65f715376a7a305e6aa741ec78b0296c8f934eff08"[[asset]]@@ -2530,7 +2530,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "5954cc0306e1b9d7beb47097e2e842157113a39d9aba078b57304902687936a9"[[asset]]@@ -2541,7 +2541,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "570adcb4f7ba8ca0647f97074476bab81d3272988f1cdee52efa21bf026036a4"[[asset]]@@ -2552,7 +2552,7 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "9d372157a949c147318561e629b11561c28b7cbc14c84b516a3fe6e84d8fbbad"[[asset]]@@ -2563,13 +2563,13 @@ source = "ArtCraft Team brand assets (provided by the project owner, 2026-10-01;licence = "LicenseRef-Storyteller-Trademark"licence_file = "docs/brand/LICENSE-brand.txt"kind = "logo"-usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PrintCraft; forks and modified versions must remove it."+usage = "ArtCraft branding next to the community links (About dialog, Help menu, home screen) and in docs. ArtCraft Team trademark, not open source; may be used only unmodified within PdfCraft; forks and modified versions must remove it."sha256 = "f87af81b6fa411da8820eed2bfdcc54c0ee9cd453b4e868c64f56c69db142d0e"[[asset]]-path = "assets/app-icon/printcraft.svg"-title = "PrintCraft app icon (master vector)"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/pdfcraft.svg"+title = "PdfCraft app icon (master vector)"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"@@ -2578,9 +2578,9 @@ usage = "Master artwork; every other app-icon file is rendered from it (packaginsha256 = "52b384a10a2a7fdd3145d9822972cfd568ef0cb7312549bd4399addd89d45a6d"[[asset]]-path = "assets/app-icon/printcraft-small.svg"-title = "PrintCraft app icon (light vector)"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/pdfcraft-small.svg"+title = "PdfCraft app icon (light vector)"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"@@ -2589,20 +2589,20 @@ usage = "README header and assets/app-icon/README.md"sha256 = "b036304c11ef5dcad36636d06ca0bf331b51e47650d25d3c916a0e1eabf544c7"[[asset]]-path = "assets/app-icon/printcraft-1024.png"-title = "PrintCraft app icon, 1024 px on Apple's icon grid"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/pdfcraft-1024.png"+title = "PdfCraft app icon, 1024 px on Apple's icon grid"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Runtime window/Dock icon on macOS (apps/printcraft/src/main.rs)"+usage = "Runtime window/Dock icon on macOS (apps/pdfcraft/src/main.rs)"sha256 = "da577d3f21fbcf5c739067787a9e683be2b064d76813b5d5fec9074a7a106538"[[asset]]-path = "assets/app-icon/printcraft.icns"-title = "PrintCraft app icon (macOS .icns)"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/pdfcraft.icns"+title = "PdfCraft app icon (macOS .icns)"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"@@ -2611,256 +2611,256 @@ usage = "macOS app bundle icon"sha256 = "2425148222873de241d267aba667a8b234ecdd0149f2ca8bb6e79443b743b1e8"[[asset]]-path = "assets/app-icon/printcraft.ico"-title = "PrintCraft app icon (Windows .ico, 16-256 px)"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/pdfcraft.ico"+title = "PdfCraft app icon (Windows .ico, 16-256 px)"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Embedded in printcraft.exe by apps/printcraft/build.rs (Explorer, taskbar, Start menu, Alt-Tab)"+usage = "Embedded in pdfcraft.exe by apps/pdfcraft/build.rs (Explorer, taskbar, Start menu, Alt-Tab)"sha256 = "56daaaae9ae5389794909570885809adf5e1d9183bef2d9669ed2f9bba3ed6f5"[[asset]]-path = "assets/app-icon/hicolor/16x16/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 16 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/16x16/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 16 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "9b77095cbe75dcba6b74a1fdcd4064812850efaf7a12edebefc9ded5eabb49da"[[asset]]-path = "assets/app-icon/hicolor/24x24/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 24 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/24x24/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 24 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "a4cd466687f6c5cb59eef3fc564bdba1c8f0d9e324754eeebab82f18823efae7"[[asset]]-path = "assets/app-icon/hicolor/32x32/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 32 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/32x32/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 32 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "e22279013a5ed5c02571e1e4e9bc4cef9aa0847fcb733a285b2916fabd16bf78"[[asset]]-path = "assets/app-icon/hicolor/48x48/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 48 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/48x48/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 48 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "55daf2d5575f6c4e4c4975c9f1c74231178f1801963a8b19f68dfa9bc50cb22f"[[asset]]-path = "assets/app-icon/hicolor/64x64/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 64 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/64x64/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 64 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "2975c200f341e247b5fa18f568fb27d390e3fa01e9b2ad37acb48d0e1cc8a124"[[asset]]-path = "assets/app-icon/hicolor/128x128/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 128 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/128x128/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 128 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "6ef927ca252b40bc9b5d8843d84137334362f8aa1acbb1bf8c15a02affd25b2b"[[asset]]-path = "assets/app-icon/hicolor/256x256/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 256 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/256x256/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 256 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop); runtime window icon on Windows and Linux (apps/printcraft/src/main.rs)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop); runtime window icon on Windows and Linux (apps/pdfcraft/src/main.rs)"sha256 = "cde7ee8c5ee38f9fc40a429fd9e6d99a035bcd321701fce331bb13bac126614d"[[asset]]-path = "assets/app-icon/hicolor/512x512/apps/ai.storyteller.printcraft.png"-title = "PrintCraft app icon, 512 px"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/512x512/apps/ai.storyteller.pdfcraft.png"+title = "PdfCraft app icon, 512 px"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "5ede733e93b96f4eb8d94299232cf2f9605fa19b0d913f95fe9828c316a2d066"[[asset]]-path = "assets/app-icon/hicolor/scalable/apps/ai.storyteller.printcraft.svg"-title = "PrintCraft app icon (Linux scalable)"-author = "PrintCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"+path = "assets/app-icon/hicolor/scalable/apps/ai.storyteller.pdfcraft.svg"+title = "PdfCraft app icon (Linux scalable)"+author = "PdfCraft contributors (drawn by the project owner in ArtCraft; vectorised with craftrules vectorize_tile.py)"source = "Contributor-original (see assets/app-icon/README.md)"licence = "MIT OR Apache-2.0"licence_file = "assets/app-icon/LICENSE.txt"kind = "icon"-usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.printcraft.desktop)"+usage = "Linux hicolor theme icon (packaging/linux/ai.storyteller.pdfcraft.desktop)"sha256 = "52b384a10a2a7fdd3145d9822972cfd568ef0cb7312549bd4399addd89d45a6d"[[asset]]-path = "docs/images/printcraft-bookmarks.png"-title = "PrintCraft screenshot: Bookmarks"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-bookmarks.png"+title = "PdfCraft screenshot: Bookmarks"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: navigation. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: navigation. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "6daf2dceda8737da0c5f9e7895e5c4cc24cc845938ffca478713c2230573240d"[[asset]]-path = "docs/images/printcraft-dark.png"-title = "PrintCraft screenshot: Dark theme"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-dark.png"+title = "PdfCraft screenshot: Dark theme"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: themes. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: themes. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "18fbd4931b2a8d01a88aef0d5d0837e3cdc12aa35f8529bedbb4a930565d47e5"[[asset]]-path = "docs/images/printcraft-find.png"-title = "PrintCraft screenshot: Find text"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-find.png"+title = "PdfCraft screenshot: Find text"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: search. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: search. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "b52771502be4c03e2dabf107c77d5183fad7f39655146d59761dda855c2d4b52"[[asset]]-path = "docs/images/printcraft-forms.png"-title = "PrintCraft screenshot: Interactive form"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-forms.png"+title = "PdfCraft screenshot: Interactive form"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: forms. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: forms. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "f8eb7705056d32e9c8e4d3b8b197c3e500faae08672e4622d6327d2799b536e7"[[asset]]-path = "docs/images/printcraft-layers.png"-title = "PrintCraft screenshot: Layers"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-layers.png"+title = "PdfCraft screenshot: Layers"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: layers. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: layers. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "20ff9e1c6ecc74d000a7514b82fe9e39f82c8ef5e7c1a52e9060c5ca349020d6"[[asset]]-path = "docs/images/printcraft-organize.png"-title = "PrintCraft screenshot: Organize pages"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-organize.png"+title = "PdfCraft screenshot: Organize pages"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: organize. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: organize. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "0a309ba73bcfccbe0106824b55fc347cc0b32293d1db68149d5eccec9c087ba1"[[asset]]-path = "docs/images/printcraft-palette.png"-title = "PrintCraft screenshot: Command palette"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-palette.png"+title = "PdfCraft screenshot: Command palette"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: tools. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: tools. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "74867793e506c03255459e838eef0b08e485c13b7ea8a6b8de3ec16870067eda"[[asset]]-path = "docs/images/printcraft-properties.png"-title = "PrintCraft screenshot: Document properties"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-properties.png"+title = "PdfCraft screenshot: Document properties"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: metadata. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: metadata. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "86f293543b299fa1665db999a68978138f8d61a4082d7c5b5025498e188da459"[[asset]]-path = "docs/images/printcraft-scripts.png"-title = "PrintCraft screenshot: Scripts of the world"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-scripts.png"+title = "PdfCraft screenshot: Scripts of the world"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: rendering. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: rendering. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "0dde8ed5a14dee7396379963adff517bd249c7dd0fe494c389b612e643584b15"[[asset]]-path = "docs/images/printcraft-split.png"-title = "PrintCraft screenshot: Split dialog"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-split.png"+title = "PdfCraft screenshot: Split dialog"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: split. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: split. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "bf31e13b563ead564af968c5fae8d1c07b91ee38867d0cf1aae9e0582efc2fe5"[[asset]]-path = "docs/images/printcraft-tools.png"-title = "PrintCraft screenshot: All tools"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-tools.png"+title = "PdfCraft screenshot: All tools"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: tool catalogue. Shows PrintCraft UI, Lucide icons, the showcase PDF built from the [[fetched]] OFL fonts, and the ArtCraft mark (Storyteller trademark from docs/brand/, not covered by this licence)"+usage = "README: tool catalogue. Shows PdfCraft UI, Lucide icons, the showcase PDF built from the [[fetched]] OFL fonts, and the ArtCraft mark (Storyteller trademark from docs/brand/, not covered by this licence)"sha256 = "61731a921902e285d40826d401f1ef25624dabb8c8ac1f8f0c09c1292a17ee1a"[[asset]]-path = "docs/images/printcraft-twoup.png"-title = "PrintCraft screenshot: Two-up reading"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-twoup.png"+title = "PdfCraft screenshot: Two-up reading"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README: layouts. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README: layouts. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "a72ed1b84c827e3aa1dd3282d857b4742f02d8ff23fc39b62115c840ebad14b4"[[asset]]-path = "docs/images/printcraft-viewer.png"-title = "PrintCraft screenshot: Viewer with comments"-author = "PrintCraft contributors (generated by `cargo xtask screenshots`)"+path = "docs/images/pdfcraft-viewer.png"+title = "PdfCraft screenshot: Viewer with comments"+author = "PdfCraft contributors (generated by `cargo xtask screenshots`)"source = "this repository"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "image"-usage = "README hero. Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+usage = "README hero. Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"sha256 = "ecd261028d8837f7f7c013dd796d81ca7e89643bcfcbad3ab9fbfbe87ded04e3"[[asset]]@@ -2943,7 +2943,7 @@ sha256 = "ef1fec17d88794ba6c34c5cf63bdadbd234b3d4dffbcc3d55468b47e3f398472"[[asset]]path = "crates/ui-egui/tests/data/form.pdf"title = "One-page AcroForm test fixture (text, check box, radio group, combo box)"-author = "PrintCraft contributors"+author = "PdfCraft contributors"source = "Contributor-original: hand-written PDF objects, no third-party content"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"@@ -2976,12 +2976,12 @@ sha256 = "69a76b4cd352dbdea61c63ed1e8d1e02083ee1773b3ced2a1c8cdf8c90fb2055"[[asset]]path = "crates/sign/tests/data/openssl-signed.pdf"title = "One-page PDF signed with OpenSSL CMS (adbe.pkcs7.detached) by the RSA test key"-author = "PrintCraft contributors"+author = "PdfCraft contributors"source = "Contributor-original: hand-written PDF objects; signature made with `openssl cms -sign` over its byte ranges (see crates/sign/tests/data/README.md)"licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "document"-usage = "Signature validation tests (crates/sign/tests/pdf.rs): a signature PrintCraft did not make"+usage = "Signature validation tests (crates/sign/tests/pdf.rs): a signature PdfCraft did not make"sha256 = "8b91c3b4e39c4a31717a0dd0685bd7d0468671df32aee5b9818d44dc72c2bc3c"[[asset]]diff --git a/CLAUDE.md b/CLAUDE.mdindex 60f00c7fb..ccad9e7bd 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,6 +1,6 @@-# PrintCraft — instructions for agents+# PdfCraft — instructions for agents-PrintCraft is a clean-room, open-source, Rust-native PDF application targeting Adobe Acrobat Pro parity. It runs natively on macOS, Windows, Linux and FreeBSD, and on the web via WASM. It is the sibling of `../photocraft` (a Photoshop-class editor) and follows the same conventions.+PdfCraft is a clean-room, open-source, Rust-native PDF application targeting Adobe Acrobat Pro parity. It runs natively on macOS, Windows, Linux and FreeBSD, and on the web via WASM. It is the sibling of `../photocraft` (a Photoshop-class editor) and follows the same conventions.## Start every session here1. Read `plan/STATUS.md`: the current milestone, the next unchecked task and any blockers. `ROADMAP.md` holds the milestone estimates and progress; update its table and log at the end of every session.@@ -13,7 +13,7 @@ PrintCraft is a clean-room, open-source, Rust-native PDF application targeting A## Non-negotiables- **Assets: read `AGENTS.md` §1 before adding or showing any icon, image, font or document.** No assets from Adobe products, ever. Only openly licensed or contributor-original assets are allowed, each with an entry in `ATTRIBUTION.toml`. `cargo xtask assets` enforces this. `AGENTS.md` overrides this file.-- **Fonts live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts).** Never commit font files here (`AGENTS.md` §1.4; team members: [craftrules `standards/fonts.md`](https://github.com/storytold/craftrules/blob/main/standards/fonts.md), internal). It is the optional build input `CRAFT_FONTS_DIR`: `git clone https://github.com/storytold/craft-fonts ../craft-fonts && CRAFT_FONTS_DIR=../craft-fonts cargo test --workspace` embeds the Japanese fonts (UI fallback, Japanese text in edited PDFs) and runs their tests, which otherwise skip. Code using `printcraft_fonts::CRAFT_FONTS` must work when it is empty.+- **Fonts live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts).** Never commit font files here (`AGENTS.md` §1.4; team members: [craftrules `standards/fonts.md`](https://github.com/storytold/craftrules/blob/main/standards/fonts.md), internal). It is the optional build input `CRAFT_FONTS_DIR`: `git clone https://github.com/storytold/craft-fonts ../craft-fonts && CRAFT_FONTS_DIR=../craft-fonts cargo test --workspace` embeds the Japanese fonts (UI fallback, Japanese text in edited PDFs) and runs their tests, which otherwise skip. Code using `pdfcraft_fonts::CRAFT_FONTS` must work when it is empty.- **Clean-room.**- Never read, disassemble or copy anything inside the Acrobat bundle (names and listings only). **Never open `Contents/Resources/JavaScripts/`.**- Behaviour comes from public docs, specs (ISO 32000-2, the Arlington model) and black-box observation (`plan/acrobat/`).@@ -35,13 +35,13 @@ PrintCraft is a clean-room, open-source, Rust-native PDF application targeting A- **Commits:** one task id per commit (e.g. `M1.4: xref stream reader`). Commit only green states. End messages with the attribution line required by the environment.## Running and looking at the app-- `cargo run -p printcraft -- <file.pdf>` opens the desktop app.-- `cargo run -p printcraft-cli -- run --script steps.json --root DIR` drives the engine headlessly through the automation tools (`printcraft-cli tools` lists them). Use it, together with `page_render`, to check engine changes. `printcraft-cli mcp` is the opt-in MCP server (AGENTS.md §3).+- `cargo run -p pdfcraft -- <file.pdf>` opens the desktop app.+- `cargo run -p pdfcraft-cli -- run --script steps.json --root DIR` drives the engine headlessly through the automation tools (`pdfcraft-cli tools` lists them). Use it, together with `page_render`, to check engine changes. `pdfcraft-cli mcp` is the opt-in MCP server (AGENTS.md §3).- `cargo xtask fuzz --time 300` mutation-fuzzes open/render/edit/save in child processes. Findings land in `fuzz-out/findings/` (git-ignored; never commit corpus-derived files). Turn every real finding into a small synthetic regression test before fixing it.- `cargo xtask parity [--partial]` reports Acrobat-parity progress from `parity/acrobat-features.toml`. Update the entry when a feature ships.-- `cargo xtask demo-pdf` builds `dist/demo/printcraft-showcase.pdf` (needs Chrome) for visual checks.-- For UI work, **look at the result**. Either launch `printcraft --control FILE doc.pdf` and use `printcraft-cli ui --control FILE screenshot --out x.png` (plus `inspect`, `click`, `key`, `type`, `command`, `set`), or take a headless shot with `cargo run -p printcraft-ui-egui --example shot`. Compare against `plan/acrobat/02-ui-ux.md`. Control-channel tests use kittest (`crates/ui-egui/tests/control.rs`).+- `cargo xtask demo-pdf` builds `dist/demo/pdfcraft-showcase.pdf` (needs Chrome) for visual checks.+- For UI work, **look at the result**. Either launch `pdfcraft --control FILE doc.pdf` and use `pdfcraft-cli ui --control FILE screenshot --out x.png` (plus `inspect`, `click`, `key`, `type`, `command`, `set`), or take a headless shot with `cargo run -p pdfcraft-ui-egui --example shot`. Compare against `plan/acrobat/02-ui-ux.md`. Control-channel tests use kittest (`crates/ui-egui/tests/control.rs`).- Parallel agents: use a separate `CARGO_TARGET_DIR` per agent and separate git worktrees.## Current bootstrap debt (tracked in STATUS.md)-- `printcraft-render` renders through the `hayro` crate directly and inspects documents through `lopdf`. Both get replaced by `cos` / `model` / the DisplayList device (M1–M2, ADR-0004).+- `pdfcraft-render` renders through the `hayro` crate directly and inspects documents through `lopdf`. Both get replaced by `cos` / `model` / the DisplayList device (M1–M2, ADR-0004).diff --git a/Cargo.lock b/Cargo.lockindex a6efac427..0b4ab6f4a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3445,6 +3445,365 @@ dependencies = ["hmac",]+[[package]]+name = "pdfcraft"+version = "0.2.1"+dependencies = [+ "eframe",+ "egui",+ "fmv-macos-events",+ "pdfcraft-ui-egui",+ "rustls-native-certs",+ "serde_json",+ "ureq",+ "winresource",+]++[[package]]+name = "pdfcraft-a11y"+version = "0.2.1"+dependencies = [+ "pdfcraft-content",+ "pdfcraft-cos",+ "pdfcraft-model",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-annot"+version = "0.2.1"+dependencies = [+ "hayro-syntax",+ "pdfcraft-cos",+ "pdfcraft-fonts",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-automation"+version = "0.2.1"+dependencies = [+ "base64 0.22.1",+ "image",+ "pdfcraft-engine",+ "pdfcraft-organize",+ "pdfcraft-render",+ "png 0.18.1",+ "serde_json",+]++[[package]]+name = "pdfcraft-cli"+version = "0.2.1"+dependencies = [+ "base64 0.22.1",+ "pdfcraft-automation",+ "pdfcraft-cos",+ "pdfcraft-engine",+ "pdfcraft-render",+ "serde_json",+]++[[package]]+name = "pdfcraft-compare"+version = "0.2.1"++[[package]]+name = "pdfcraft-content"+version = "0.2.1"+dependencies = [+ "pdfcraft-cos",+]++[[package]]+name = "pdfcraft-cos"+version = "0.2.1"+dependencies = [+ "hayro-syntax",+ "pdfcraft-crypt",+ "pdfcraft-filters",+ "proptest",+ "serde_json",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-create"+version = "0.2.1"+dependencies = [+ "hayro-syntax",+ "image",+ "pdfcraft-cos",+ "pdfcraft-fonts",+ "pdfcraft-model",+ "png 0.18.1",+ "thiserror 2.0.21",+ "tiff",+]++[[package]]+name = "pdfcraft-crypt"+version = "0.2.1"+dependencies = [+ "aes",+ "md-5",+ "proptest",+ "sha2",+ "stringprep",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-edit"+version = "0.2.1"+dependencies = [+ "hayro-syntax",+ "pdfcraft-annot",+ "pdfcraft-content",+ "pdfcraft-cos",+ "pdfcraft-fonts",+ "pdfcraft-model",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-engine"+version = "0.2.1"+dependencies = [+ "chrono",+ "image",+ "pdfcraft-a11y",+ "pdfcraft-annot",+ "pdfcraft-compare",+ "pdfcraft-cos",+ "pdfcraft-create",+ "pdfcraft-edit",+ "pdfcraft-export",+ "pdfcraft-fonts",+ "pdfcraft-forms",+ "pdfcraft-js",+ "pdfcraft-model",+ "pdfcraft-ocr",+ "pdfcraft-optimize",+ "pdfcraft-organize",+ "pdfcraft-preflight",+ "pdfcraft-print",+ "pdfcraft-redact",+ "pdfcraft-render",+ "pdfcraft-sign",+ "pdfcraft-xfdf",+ "png 0.18.1",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-export"+version = "0.2.1"+dependencies = [+ "flate2",+]++[[package]]+name = "pdfcraft-filters"+version = "0.2.1"+dependencies = [+ "flate2",+ "proptest",+ "thiserror 2.0.21",+ "weezl 0.2.1",+]++[[package]]+name = "pdfcraft-fonts"+version = "0.2.1"+dependencies = [+ "pdfcraft-cos",+ "skrifa 0.44.0",+]++[[package]]+name = "pdfcraft-forms"+version = "0.2.1"+dependencies = [+ "hayro-syntax",+ "pdfcraft-content",+ "pdfcraft-cos",+ "pdfcraft-fonts",+ "pdfcraft-model",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-geom"+version = "0.2.1"++[[package]]+name = "pdfcraft-js"+version = "0.2.1"+dependencies = [+ "boa_engine",+]++[[package]]+name = "pdfcraft-model"+version = "0.2.1"+dependencies = [+ "pdfcraft-cos",+]++[[package]]+name = "pdfcraft-ocr"+version = "0.2.1"+dependencies = [+ "ocrs",+ "pdfcraft-fonts",+ "rten",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-optimize"+version = "0.2.1"+dependencies = [+ "image",+ "pdfcraft-annot",+ "pdfcraft-content",+ "pdfcraft-cos",+ "pdfcraft-model",+ "pdfcraft-render",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-organize"+version = "0.2.1"+dependencies = [+ "hayro-syntax",+ "pdfcraft-cos",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-preflight"+version = "0.2.1"+dependencies = [+ "pdfcraft-cos",+ "pdfcraft-model",+]++[[package]]+name = "pdfcraft-print"+version = "0.2.1"+dependencies = [+ "pdfcraft-content",+ "pdfcraft-cos",+ "pdfcraft-model",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-redact"+version = "0.2.1"+dependencies = [+ "pdfcraft-annot",+ "pdfcraft-content",+ "pdfcraft-cos",+ "pdfcraft-edit",+ "pdfcraft-fonts",+ "pdfcraft-forms",+ "pdfcraft-model",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-render"+version = "0.2.1"+dependencies = [+ "getrandom 0.4.3",+ "hayro",+ "hayro-syntax",+ "kurbo 0.13.1",+ "log",+ "lopdf",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-sign"+version = "0.2.1"+dependencies = [+ "aes",+ "aws-lc-rs",+ "cbc",+ "des",+ "getrandom 0.4.3",+ "hmac",+ "p256",+ "p384",+ "pbkdf2",+ "pdfcraft-annot",+ "pdfcraft-cos",+ "pdfcraft-fonts",+ "rc2",+ "rsa",+ "security-framework",+ "sha1",+ "sha2",+ "thiserror 2.0.21",+]++[[package]]+name = "pdfcraft-ui-egui"+version = "0.2.1"+dependencies = [+ "arboard",+ "base64 0.22.1",+ "eframe",+ "egui",+ "egui_extras",+ "egui_kittest",+ "getrandom 0.4.3",+ "image",+ "js-sys",+ "log",+ "pdfcraft-cos",+ "pdfcraft-engine",+ "pdfcraft-fonts",+ "pdfcraft-model",+ "pdfcraft-render",+ "png 0.18.1",+ "rfd",+ "serde",+ "serde_json",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+]++[[package]]+name = "pdfcraft-web"+version = "0.2.1"+dependencies = [+ "eframe",+ "egui",+ "js-sys",+ "pdfcraft-ui-egui",+ "wasm-bindgen-futures",+ "web-sys",+]++[[package]]+name = "pdfcraft-xfdf"+version = "0.2.1"+dependencies = [+ "pdfcraft-annot",+ "pdfcraft-cos",+ "pdfcraft-forms",+ "pdfcraft-model",+ "roxmltree",+ "thiserror 2.0.21",+]+[[package]]name = "pem-rfc7468"version = "1.0.0"@@ -3776,365 +4135,6 @@ dependencies = ["wnaf",]-[[package]]-name = "printcraft"-version = "0.2.1"-dependencies = [- "eframe",- "egui",- "fmv-macos-events",- "printcraft-ui-egui",- "rustls-native-certs",- "serde_json",- "ureq",- "winresource",-]--[[package]]-name = "printcraft-a11y"-version = "0.2.1"-dependencies = [- "printcraft-content",- "printcraft-cos",- "printcraft-model",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-annot"-version = "0.2.1"-dependencies = [- "hayro-syntax",- "printcraft-cos",- "printcraft-fonts",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-automation"-version = "0.2.1"-dependencies = [- "base64 0.22.1",- "image",- "png 0.18.1",- "printcraft-engine",- "printcraft-organize",- "printcraft-render",- "serde_json",-]--[[package]]-name = "printcraft-cli"-version = "0.2.1"-dependencies = [- "base64 0.22.1",- "printcraft-automation",- "printcraft-cos",- "printcraft-engine",- "printcraft-render",- "serde_json",-]--[[package]]-name = "printcraft-compare"-version = "0.2.1"--[[package]]-name = "printcraft-content"-version = "0.2.1"-dependencies = [- "printcraft-cos",-]--[[package]]-name = "printcraft-cos"-version = "0.2.1"-dependencies = [- "hayro-syntax",- "printcraft-crypt",- "printcraft-filters",- "proptest",- "serde_json",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-create"-version = "0.2.1"-dependencies = [- "hayro-syntax",- "image",- "png 0.18.1",- "printcraft-cos",- "printcraft-fonts",- "printcraft-model",- "thiserror 2.0.21",- "tiff",-]--[[package]]-name = "printcraft-crypt"-version = "0.2.1"-dependencies = [- "aes",- "md-5",- "proptest",- "sha2",- "stringprep",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-edit"-version = "0.2.1"-dependencies = [- "hayro-syntax",- "printcraft-annot",- "printcraft-content",- "printcraft-cos",- "printcraft-fonts",- "printcraft-model",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-engine"-version = "0.2.1"-dependencies = [- "chrono",- "image",- "png 0.18.1",- "printcraft-a11y",- "printcraft-annot",- "printcraft-compare",- "printcraft-cos",- "printcraft-create",- "printcraft-edit",- "printcraft-export",- "printcraft-fonts",- "printcraft-forms",- "printcraft-js",- "printcraft-model",- "printcraft-ocr",- "printcraft-optimize",- "printcraft-organize",- "printcraft-preflight",- "printcraft-print",- "printcraft-redact",- "printcraft-render",- "printcraft-sign",- "printcraft-xfdf",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-export"-version = "0.2.1"-dependencies = [- "flate2",-]--[[package]]-name = "printcraft-filters"-version = "0.2.1"-dependencies = [- "flate2",- "proptest",- "thiserror 2.0.21",- "weezl 0.2.1",-]--[[package]]-name = "printcraft-fonts"-version = "0.2.1"-dependencies = [- "printcraft-cos",- "skrifa 0.44.0",-]--[[package]]-name = "printcraft-forms"-version = "0.2.1"-dependencies = [- "hayro-syntax",- "printcraft-content",- "printcraft-cos",- "printcraft-fonts",- "printcraft-model",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-geom"-version = "0.2.1"--[[package]]-name = "printcraft-js"-version = "0.2.1"-dependencies = [- "boa_engine",-]--[[package]]-name = "printcraft-model"-version = "0.2.1"-dependencies = [- "printcraft-cos",-]--[[package]]-name = "printcraft-ocr"-version = "0.2.1"-dependencies = [- "ocrs",- "printcraft-fonts",- "rten",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-optimize"-version = "0.2.1"-dependencies = [- "image",- "printcraft-annot",- "printcraft-content",- "printcraft-cos",- "printcraft-model",- "printcraft-render",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-organize"-version = "0.2.1"-dependencies = [- "hayro-syntax",- "printcraft-cos",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-preflight"-version = "0.2.1"-dependencies = [- "printcraft-cos",- "printcraft-model",-]--[[package]]-name = "printcraft-print"-version = "0.2.1"-dependencies = [- "printcraft-content",- "printcraft-cos",- "printcraft-model",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-redact"-version = "0.2.1"-dependencies = [- "printcraft-annot",- "printcraft-content",- "printcraft-cos",- "printcraft-edit",- "printcraft-fonts",- "printcraft-forms",- "printcraft-model",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-render"-version = "0.2.1"-dependencies = [- "getrandom 0.4.3",- "hayro",- "hayro-syntax",- "kurbo 0.13.1",- "log",- "lopdf",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-sign"-version = "0.2.1"-dependencies = [- "aes",- "aws-lc-rs",- "cbc",- "des",- "getrandom 0.4.3",- "hmac",- "p256",- "p384",- "pbkdf2",- "printcraft-annot",- "printcraft-cos",- "printcraft-fonts",- "rc2",- "rsa",- "security-framework",- "sha1",- "sha2",- "thiserror 2.0.21",-]--[[package]]-name = "printcraft-ui-egui"-version = "0.2.1"-dependencies = [- "arboard",- "base64 0.22.1",- "eframe",- "egui",- "egui_extras",- "egui_kittest",- "getrandom 0.4.3",- "image",- "js-sys",- "log",- "png 0.18.1",- "printcraft-cos",- "printcraft-engine",- "printcraft-fonts",- "printcraft-model",- "printcraft-render",- "rfd",- "serde",- "serde_json",- "wasm-bindgen",- "wasm-bindgen-futures",- "web-sys",-]--[[package]]-name = "printcraft-web"-version = "0.2.1"-dependencies = [- "eframe",- "egui",- "js-sys",- "printcraft-ui-egui",- "wasm-bindgen-futures",- "web-sys",-]--[[package]]-name = "printcraft-xfdf"-version = "0.2.1"-dependencies = [- "printcraft-annot",- "printcraft-cos",- "printcraft-forms",- "printcraft-model",- "roxmltree",- "thiserror 2.0.21",-]-[[package]]name = "proc-macro-crate"version = "3.5.0"diff --git a/Cargo.toml b/Cargo.tomlindex c94309e24..76be6e26a 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -2,44 +2,44 @@resolver = "3"members = ["crates/*", "apps/*", "xtask"]exclude = ["vendor"]-default-members = ["crates/*", "apps/printcraft", "apps/printcraft-cli", "xtask"]+default-members = ["crates/*", "apps/pdfcraft", "apps/pdfcraft-cli", "xtask"][workspace.package]version = "0.2.1"edition = "2024"license = "MIT OR Apache-2.0"rust-version = "1.90"-repository = "https://github.com/storytold/printcraft"+repository = "https://github.com/storytold/pdfcraft"[workspace.dependencies]# internal-printcraft-geom = { path = "crates/geom", version = "0.2.0" }-printcraft-filters = { path = "crates/filters", version = "0.2.0" }-printcraft-cos = { path = "crates/cos", version = "0.2.0" }-printcraft-crypt = { path = "crates/crypt", version = "0.2.0" }-printcraft-organize = { path = "crates/organize", version = "0.2.0" }-printcraft-annot = { path = "crates/annot", version = "0.2.0" }-printcraft-fonts = { path = "crates/fonts", version = "0.2.0" }-printcraft-model = { path = "crates/model", version = "0.2.0" }-printcraft-content = { path = "crates/content", version = "0.2.0" }-printcraft-redact = { path = "crates/redact", version = "0.2.0" }-printcraft-print = { path = "crates/print", version = "0.2.0" }-printcraft-xfdf = { path = "crates/xfdf", version = "0.2.0" }-printcraft-sign = { path = "crates/sign", version = "0.2.0" }-printcraft-optimize = { path = "crates/optimize", version = "0.2.0" }-printcraft-a11y = { path = "crates/a11y", version = "0.2.0" }-printcraft-ocr = { path = "crates/ocr", version = "0.2.0" }-printcraft-js = { path = "crates/js", version = "0.2.0" }-printcraft-compare = { path = "crates/compare", version = "0.2.0" }-printcraft-preflight = { path = "crates/preflight", version = "0.2.0" }-printcraft-export = { path = "crates/export", version = "0.2.0" }-printcraft-edit = { path = "crates/edit", version = "0.2.0" }-printcraft-create = { path = "crates/create", version = "0.2.0" }-printcraft-forms = { path = "crates/forms", version = "0.2.0" }-printcraft-render = { path = "crates/render", version = "0.2.0" }-printcraft-engine = { path = "crates/engine", version = "0.2.0" }-printcraft-ui-egui = { path = "crates/ui-egui", version = "0.2.0" }-printcraft-automation = { path = "crates/automation", version = "0.2.0", default-features = false }+pdfcraft-geom = { path = "crates/geom", version = "0.2.0" }+pdfcraft-filters = { path = "crates/filters", version = "0.2.0" }+pdfcraft-cos = { path = "crates/cos", version = "0.2.0" }+pdfcraft-crypt = { path = "crates/crypt", version = "0.2.0" }+pdfcraft-organize = { path = "crates/organize", version = "0.2.0" }+pdfcraft-annot = { path = "crates/annot", version = "0.2.0" }+pdfcraft-fonts = { path = "crates/fonts", version = "0.2.0" }+pdfcraft-model = { path = "crates/model", version = "0.2.0" }+pdfcraft-content = { path = "crates/content", version = "0.2.0" }+pdfcraft-redact = { path = "crates/redact", version = "0.2.0" }+pdfcraft-print = { path = "crates/print", version = "0.2.0" }+pdfcraft-xfdf = { path = "crates/xfdf", version = "0.2.0" }+pdfcraft-sign = { path = "crates/sign", version = "0.2.0" }+pdfcraft-optimize = { path = "crates/optimize", version = "0.2.0" }+pdfcraft-a11y = { path = "crates/a11y", version = "0.2.0" }+pdfcraft-ocr = { path = "crates/ocr", version = "0.2.0" }+pdfcraft-js = { path = "crates/js", version = "0.2.0" }+pdfcraft-compare = { path = "crates/compare", version = "0.2.0" }+pdfcraft-preflight = { path = "crates/preflight", version = "0.2.0" }+pdfcraft-export = { path = "crates/export", version = "0.2.0" }+pdfcraft-edit = { path = "crates/edit", version = "0.2.0" }+pdfcraft-create = { path = "crates/create", version = "0.2.0" }+pdfcraft-forms = { path = "crates/forms", version = "0.2.0" }+pdfcraft-render = { path = "crates/render", version = "0.2.0" }+pdfcraft-engine = { path = "crates/engine", version = "0.2.0" }+pdfcraft-ui-egui = { path = "crates/ui-egui", version = "0.2.0" }+pdfcraft-automation = { path = "crates/automation", version = "0.2.0", default-features = false }hayro = "0.7.1"diff --git a/LICENSE-MIT b/LICENSE-MITindex 8ba1dfe28..d2c0cd3fb 100644--- a/LICENSE-MIT+++ b/LICENSE-MIT@@ -1,6 +1,6 @@MIT License-Copyright (c) 2026 ArtCraft Team and the PrintCraft contributors+Copyright (c) 2026 ArtCraft Team and the PdfCraft contributorsPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealdiff --git a/NOTICE b/NOTICEindex efe5186a2..62e047ec0 100644--- a/NOTICE+++ b/NOTICE@@ -1,5 +1,5 @@-PrintCraft-Copyright (c) 2026 ArtCraft Team and the PrintCraft contributors.+PdfCraft+Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors.Licensed under the MIT License or the Apache License, Version 2.0, at your option(LICENSE-MIT, LICENSE-APACHE).diff --git a/README.md b/README.mdindex 55fdeb4fa..8b04e28cf 100644--- a/README.md+++ b/README.md@@ -8,7 +8,7 @@</p>-<h1 align="center">PrintCraft</h1>+<h1 align="center">PdfCraft</h1><p align="center"><b>The PDF workbench; an open-source, clean-room reimplementation of Adobe Acrobat, rebuilt in pure Rust.</b><br>@@ -28,7 +28,7 @@</p><p align="center">- <a href="https://getartcraft.com/apps/printcraft"><b>PrintCraft on getartcraft.com</b></a> ·+ <a href="https://getartcraft.com/apps/pdfcraft"><b>PdfCraft on getartcraft.com</b></a> ·<a href="https://getartcraft.com/">ArtCraft</a> ·<a href="https://getartcraft.com/apps">All Crafting Apps</a></p>@@ -36,9 +36,9 @@<br><p align="center">- <img src="docs/images/printcraft-viewer.png" alt="PrintCraft with the PrintCraft Showcase cover page open, the All tools panel on the left and 20 threaded comments on the right" width="100%">+ <img src="docs/images/pdfcraft-viewer.png" alt="PdfCraft with the PdfCraft Showcase cover page open, the All tools panel on the left and 20 threaded comments on the right" width="100%"><br>- <sub>The PrintCraft Showcase, a 13-page specimen PDF, open with the All tools panel and threaded comments.</sub>+ <sub>The PdfCraft Showcase, a 13-page specimen PDF, open with the All tools panel and threaded comments.</sub></p>> [!NOTE]@@ -65,13 +65,13 @@## Community-PrintCraft is part of [ArtCraft](https://getartcraft.com). Come say hello, get help and follow development:+PdfCraft is part of [ArtCraft](https://getartcraft.com). Come say hello, get help and follow development:- **Discord: [discord.gg/artcraft](https://discord.gg/artcraft)**. This is the fastest way to get help and share feedback. The app has a Discord button in its title bar.-- **Web page:** [getartcraft.com/apps/printcraft](https://getartcraft.com/apps/printcraft)-- **Source:** [github.com/storytold/printcraft](https://github.com/storytold/printcraft)+- **Web page:** [getartcraft.com/apps/pdfcraft](https://getartcraft.com/apps/pdfcraft)+- **Source:** [github.com/storytold/pdfcraft](https://github.com/storytold/pdfcraft)-The ArtCraft name and logos in `docs/brand/` are trademarks of the ArtCraft Team and are not open source. They may be used only unmodified, and only as part of PrintCraft (see `docs/brand/LICENSE-brand.txt`). Forks and modified versions must remove them.+The ArtCraft name and logos in `docs/brand/` are trademarks of the ArtCraft Team and are not open source. They may be used only unmodified, and only as part of PdfCraft (see `docs/brand/LICENSE-brand.txt`). Forks and modified versions must remove them.## Highlights@@ -102,10 +102,10 @@ No account, no telemetry, no cloud. It works offline and opens instantly. The en## Read anything, beautifully-PrintCraft renders PDFs with care for the details that make a page feel right: kerning and ligatures, right-to-left and complex scripts, vertical CJK, colour emoji, shadings, blend modes, soft masks and optional content.+PdfCraft renders PDFs with care for the details that make a page feel right: kerning and ligatures, right-to-left and complex scripts, vertical CJK, colour emoji, shadings, blend modes, soft masks and optional content.<p align="center">- <img src="docs/images/printcraft-scripts.png" alt="The Scripts of the World page: Arabic, Hebrew, Devanagari, Thai, Greek, Cyrillic, Chinese, Korean, IPA, Armenian, Georgian and Tamil samples, with vertical Japanese in the right margin" width="100%">+ <img src="docs/images/pdfcraft-scripts.png" alt="The Scripts of the World page: Arabic, Hebrew, Devanagari, Thai, Greek, Cyrillic, Chinese, Korean, IPA, Armenian, Georgian and Tamil samples, with vertical Japanese in the right margin" width="100%"><br><sub>Twelve writing systems on one page, plus vertical Japanese, at 125%.</sub></p>@@ -117,8 +117,8 @@ PrintCraft renders PDFs with care for the details that make a page feel right: k<table><tr>-<td width="50%"><img src="docs/images/printcraft-twoup.png" alt="Two facing pages in Read mode with the dark theme: the Foreword and the Setting Text chapter with its drop cap and pull quote"></td>-<td width="50%"><img src="docs/images/printcraft-dark.png" alt="The dark theme showing the Code and Images chapter, a syntax-coloured listing and a fractal image, with the comments panel open"></td>+<td width="50%"><img src="docs/images/pdfcraft-twoup.png" alt="Two facing pages in Read mode with the dark theme: the Foreword and the Setting Text chapter with its drop cap and pull quote"></td>+<td width="50%"><img src="docs/images/pdfcraft-dark.png" alt="The dark theme showing the Code and Images chapter, a syntax-coloured listing and a fractal image, with the comments panel open"></td></tr><tr><td align="center"><sub>Two-up Read mode, ready for long reading</sub></td>@@ -136,8 +136,8 @@ Bookmarks, page thumbnails and the document's own page labels (i, ii, 1, 2…) k<table><tr>-<td width="50%"><img src="docs/images/printcraft-find.png" alt="The find bar showing match 10 of 16 for the word 'type', highlighted in the Expressive Type chapter heading"></td>-<td width="50%"><img src="docs/images/printcraft-bookmarks.png" alt="The Bookmarks panel showing the nested outline of the showcase, with page labels such as Cover, i and ii, next to the Scripts of the World page"></td>+<td width="50%"><img src="docs/images/pdfcraft-find.png" alt="The find bar showing match 10 of 16 for the word 'type', highlighted in the Expressive Type chapter heading"></td>+<td width="50%"><img src="docs/images/pdfcraft-bookmarks.png" alt="The Bookmarks panel showing the nested outline of the showcase, with page labels such as Cover, i and ii, next to the Scripts of the World page"></td></tr><tr><td align="center"><sub>Find as you type: match 10 of 16</sub></td>@@ -155,7 +155,7 @@ Open **Organize pages** to see every page at once:- **Undo anything:** <kbd>⌘Z</kbd>, then save.<p align="center">- <img src="docs/images/printcraft-organize.png" alt="The Organize pages grid with the showcase's pages as thumbnails, three of them selected, and the page toolbar above" width="100%">+ <img src="docs/images/pdfcraft-organize.png" alt="The Organize pages grid with the showcase's pages as thumbnails, three of them selected, and the page toolbar above" width="100%"><br><sub>Organize pages with three pages selected and the page tools in the toolbar above.</sub></p>@@ -171,10 +171,10 @@ Open **Organize pages** to see every page at once:- *Atomic:* the file is written to a temporary copy, then swapped in.- *Verified:* independently checked with qpdf.-Unsaved documents carry a dot on their tab, and closing or quitting asks before anything is lost. Changes are autosaved every minute. If PrintCraft ever quits unexpectedly, it offers to recover your work the next time it opens. Encrypted documents stay encrypted on disk.+Unsaved documents carry a dot on their tab, and closing or quitting asks before anything is lost. Changes are autosaved every minute. If PdfCraft ever quits unexpectedly, it offers to recover your work the next time it opens. Encrypted documents stay encrypted on disk.</td>-<td width="50%" valign="top"><img src="docs/images/printcraft-split.png" alt="The Split document dialog over the organize view, set to one page per file and reporting that it creates 13 files from 13 pages"><br><sub>Split document: one page per file makes 13 files.</sub></td>+<td width="50%" valign="top"><img src="docs/images/pdfcraft-split.png" alt="The Split document dialog over the organize view, set to one page per file and reporting that it creates 13 files from 13 pages"><br><sub>Split document: one page per file makes 13 files.</sub></td></tr></table>@@ -193,25 +193,25 @@ Nothing quietly disappears along the way:Every page of a combined document renders pixel-identical to its source.```sh-printcraft-cli combine report.pdf appendix.pdf --out combined.pdf-printcraft-cli extract report.pdf --pages 1,3,5 --out highlights.pdf-printcraft-cli split report.pdf --every 10 --out-dir parts/+pdfcraft-cli combine report.pdf appendix.pdf --out combined.pdf+pdfcraft-cli extract report.pdf --pages 1,3,5 --out highlights.pdf+pdfcraft-cli split report.pdf --every 10 --out-dir parts/```---## Open protected documents and respect their rules-PrintCraft implements the PDF standard security handler completely:+PdfCraft implements the PDF standard security handler completely:- every revision, from 40-bit RC4 to AES-256;- user and owner passwords, including Unicode passwords normalised with SASLprep;- crypt filters and attachment-only encryption.-Documents restricted by their author show a clear notice, and PrintCraft honours their permissions. Enter the owner password and the restrictions lift. Edits to encrypted documents are saved encrypted, under the same keys.+Documents restricted by their author show a clear notice, and PdfCraft honours their permissions. Enter the owner password and the restrictions lift. Edits to encrypted documents are saved encrypted, under the same keys.<table><tr>-<td width="50%" valign="top"><img src="docs/images/printcraft-properties.png" alt="The Document Properties dialog on its Description tab, with editable title, author, subject and keywords, and tabs for Security, Fonts and Advanced"><br><sub>Document Properties, Description tab</sub></td>+<td width="50%" valign="top"><img src="docs/images/pdfcraft-properties.png" alt="The Document Properties dialog on its Description tab, with editable title, author, subject and keywords, and tabs for Security, Fonts and Advanced"><br><sub>Document Properties, Description tab</sub></td><td width="50%" valign="top">**Document Properties** shows:@@ -228,8 +228,8 @@ Documents restricted by their author show a clear notice, and PrintCraft honours<table><tr>-<td width="50%"><img src="docs/images/printcraft-forms.png" alt="The Interactive Form page with highlighted text fields, checkboxes, radio buttons, a list and a signature field, and the Fields panel listing all 13 fields and their values"></td>-<td width="50%"><img src="docs/images/printcraft-layers.png" alt="The Review and Markup page with highlights, shapes, ink and an APPROVED stamp under a DRAFT watermark, and the Layers panel with Draft watermark and Print-only notes"></td>+<td width="50%"><img src="docs/images/pdfcraft-forms.png" alt="The Interactive Form page with highlighted text fields, checkboxes, radio buttons, a list and a signature field, and the Fields panel listing all 13 fields and their values"></td>+<td width="50%"><img src="docs/images/pdfcraft-layers.png" alt="The Review and Markup page with highlights, shapes, ink and an APPROVED stamp under a DRAFT watermark, and the Layers panel with Draft watermark and Print-only notes"></td></tr><tr><td valign="top"><b>Forms</b>: every field with its current value, field highlighting, and checkboxes, radio buttons, lists and signatures drawn the way their author designed them.</td>@@ -243,8 +243,8 @@ Press <kbd>⌘K</kbd> to search every tool and command, or browse the **All tool<table><tr>-<td width="50%"><img src="docs/images/printcraft-palette.png" alt="The command palette searching for 'page', listing Page grid, Page labels, Rotate pages, Insert pages, Delete pages, Extract pages and more, each with the tool it belongs to"></td>-<td width="50%"><img src="docs/images/printcraft-tools.png" alt="The Welcome to PrintCraft home screen with recommended tools, a recent file, a privacy note, and the full tool catalogue in the side panel"></td>+<td width="50%"><img src="docs/images/pdfcraft-palette.png" alt="The command palette searching for 'page', listing Page grid, Page labels, Rotate pages, Insert pages, Delete pages, Extract pages and more, each with the tool it belongs to"></td>+<td width="50%"><img src="docs/images/pdfcraft-tools.png" alt="The Welcome to PdfCraft home screen with recommended tools, a recent file, a privacy note, and the full tool catalogue in the side panel"></td></tr><tr><td align="center"><sub>The <kbd>⌘K</kbd> command palette</sub></td>@@ -259,12 +259,12 @@ Press <kbd>⌘K</kbd> to search every tool and command, or browse the **All tool- **Native on macOS, Windows, Linux and FreeBSD**, and **in the browser** through WebAssembly, from the same Rust codebase. Windows builds come for x64, x86 and ARM64 (Windows on ARM, no emulation); every ARM64 change is tested on ARM64 hardware in CI.- **Private by design.** Documents never leave your machine. There's no account, no telemetry and no cloud processing.- **Engine first.** Parsing, rendering and editing live in reusable library crates. The interface is one swappable layer on top.-- **Scriptable.** The `printcraft-cli` tool (see [Built for agents, too](#built-for-agents-too)) covers inspecting, rendering, extracting text, editing, combining, extracting pages and splitting. Robustness sweeps run on the same engine as the app.+- **Scriptable.** The `pdfcraft-cli` tool (see [Built for agents, too](#built-for-agents-too)) covers inspecting, rendering, extracting text, editing, combining, extracting pages and splitting. Robustness sweeps run on the same engine as the app.```sh-printcraft-cli info form.pdf # structure as JSON-printcraft-cli text paper.pdf --page 3 # reading-order text-printcraft-cli edit in.pdf --rotate 1,2:90 --delete 5 --title "Q3" --out out.pdf+pdfcraft-cli info form.pdf # structure as JSON+pdfcraft-cli text paper.pdf --page 3 # reading-order text+pdfcraft-cli edit in.pdf --rotate 1,2:90 --delete 5 --title "Q3" --out out.pdf```---@@ -273,59 +273,59 @@ printcraft-cli edit in.pdf --rotate 1,2:90 --delete 5 --title "Q3" --out out.pdEvery engine feature is reachable without the GUI, through one table of JSON-Schema-described tools: open, inspect, render pages to PNG, extract and find text, rotate, delete, move and insert pages, edit bookmarks and page labels, add, reply to, restyle and delete comments (highlight a phrase just by naming it), list and fill in form fields, protect with passwords, set metadata, undo and redo, save, combine, extract and split. Three front doors share it:-- **`printcraft-cli run`**, for one-off calls and JSON scripts:+- **`pdfcraft-cli run`**, for one-off calls and JSON scripts:```sh- printcraft-cli tools # every tool and its JSON Schema- printcraft-cli run text_find doc=1 query=invoice # key=value; values parse as JSON- printcraft-cli run --script review.json # e.g. comment_add {"type": "highlight", "find": "total due"}- printcraft-cli run --script steps.json --root ./work # several steps in one session+ pdfcraft-cli tools # every tool and its JSON Schema+ pdfcraft-cli run text_find doc=1 query=invoice # key=value; values parse as JSON+ pdfcraft-cli run --script review.json # e.g. comment_add {"type": "highlight", "find": "total due"}+ pdfcraft-cli run --script steps.json --root ./work # several steps in one session```-- **An MCP server**, for AI agents such as Claude. **It is opt-in:** PrintCraft never starts it on its own, and it opens no network port. It runs only while an agent launches `printcraft-cli mcp`, talks over stdin/stdout, and stops when the agent disconnects. To enable it, add it to your agent's MCP configuration:+- **An MCP server**, for AI agents such as Claude. **It is opt-in:** PdfCraft never starts it on its own, and it opens no network port. It runs only while an agent launches `pdfcraft-cli mcp`, talks over stdin/stdout, and stops when the agent disconnects. To enable it, add it to your agent's MCP configuration:```json- { "mcpServers": { "printcraft": { "command": "printcraft-cli", "args": ["mcp", "--root", "/path/to/your/pdfs"] } } }+ { "mcpServers": { "pdfcraft": { "command": "pdfcraft-cli", "args": ["mcp", "--root", "/path/to/your/pdfs"] } } }```- `--root` confines every file the agent can read or write to one directory. Builds that should not include the server at all can use `cargo build -p printcraft-cli --no-default-features`.+ `--root` confines every file the agent can read or write to one directory. Builds that should not include the server at all can use `cargo build -p pdfcraft-cli --no-default-features`.-- **The Rust API** (`printcraft_automation::Automation::call`), for embedding.+- **The Rust API** (`pdfcraft_automation::Automation::call`), for embedding.Edits stay in memory, undoable, until `doc_save`. Saving to the same file appends an incremental update, so the original bytes are preserved, and the write is atomic. Unsaved changes are never discarded silently.### Driving the app itself-Start the desktop app with `printcraft --control /tmp/pc.json` and an agent can see and operate the real interface: the widget tree with labels and positions (from the accessibility tree), clicks, typing, keys, commands, view options and screenshots. This is also off by default. It listens only on loopback, and every connection must present the random token written to that file, which only you can read.+Start the desktop app with `pdfcraft --control /tmp/pc.json` and an agent can see and operate the real interface: the widget tree with labels and positions (from the accessibility tree), clicks, typing, keys, commands, view options and screenshots. This is also off by default. It listens only on loopback, and every connection must present the random token written to that file, which only you can read.```sh-printcraft-cli ui --control /tmp/pc.json inspect query=rotate # find widgets-printcraft-cli ui --control /tmp/pc.json click label="Organize pages"-printcraft-cli ui --control /tmp/pc.json key key=K modifiers='["command"]'-printcraft-cli ui --control /tmp/pc.json command id=comment.square # pick a tool, then draw:-printcraft-cli ui --control /tmp/pc.json drag from='[400,300]' to='[600,420]'-printcraft-cli ui --control /tmp/pc.json screenshot --out window.png+pdfcraft-cli ui --control /tmp/pc.json inspect query=rotate # find widgets+pdfcraft-cli ui --control /tmp/pc.json click label="Organize pages"+pdfcraft-cli ui --control /tmp/pc.json key key=K modifiers='["command"]'+pdfcraft-cli ui --control /tmp/pc.json command id=comment.square # pick a tool, then draw:+pdfcraft-cli ui --control /tmp/pc.json drag from='[400,300]' to='[600,420]'+pdfcraft-cli ui --control /tmp/pc.json screenshot --out window.png```---## How it's built-PrintCraft is a Cargo workspace of focused crates, layered so the core never depends on the UI:+PdfCraft is a Cargo workspace of focused crates, layered so the core never depends on the UI:| Crate | What it does ||---|---|-| `printcraft-filters` | Every PDF stream filter (Flate, LZW, ASCII85, RunLength, predictors), encode and decode, property-tested |-| `printcraft-crypt` | The standard security handler: RC4, AES-128/256, revisions 2–6, permissions |-| `printcraft-cos` | The PDF object layer: tolerant parsing, repair, copy-on-write edits, incremental and full writing |-| `printcraft-organize` | Page operations, combine / extract / split, bookmarks, page labels, document information |-| `printcraft-fonts` | Font metrics and encodings for generated appearances |-| `printcraft-annot` | Comments: builders and appearance streams for notes, text markup, shapes, ink and text boxes; replies, status, edits |-| `printcraft-forms` | Interactive forms: the field model, filling with regenerated appearances, Clear form |-| `printcraft-render` | Rendering, inspection and text extraction with reading order |-| `printcraft-engine` | The façade every frontend uses: sessions, edits, undo, saving, the tool catalogue |-| `printcraft-automation` | Agent control: the headless tool table, `printcraft-cli run`, and the opt-in MCP server |-| `printcraft-ui-egui` | The desktop and web interface |+| `pdfcraft-filters` | Every PDF stream filter (Flate, LZW, ASCII85, RunLength, predictors), encode and decode, property-tested |+| `pdfcraft-crypt` | The standard security handler: RC4, AES-128/256, revisions 2–6, permissions |+| `pdfcraft-cos` | The PDF object layer: tolerant parsing, repair, copy-on-write edits, incremental and full writing |+| `pdfcraft-organize` | Page operations, combine / extract / split, bookmarks, page labels, document information |+| `pdfcraft-fonts` | Font metrics and encodings for generated appearances |+| `pdfcraft-annot` | Comments: builders and appearance streams for notes, text markup, shapes, ink and text boxes; replies, status, edits |+| `pdfcraft-forms` | Interactive forms: the field model, filling with regenerated appearances, Clear form |+| `pdfcraft-render` | Rendering, inspection and text extraction with reading order |+| `pdfcraft-engine` | The façade every frontend uses: sessions, edits, undo, saving, the tool catalogue |+| `pdfcraft-automation` | Agent control: the headless tool table, `pdfcraft-cli run`, and the opt-in MCP server |+| `pdfcraft-ui-egui` | The desktop and web interface |**Quality gates.** Every change passes the same automated checks:- formatting, and Clippy with warnings as errors;@@ -339,14 +339,14 @@ On top of those, two corpus sweeps run over real-world files:The output is verified with independent tools: hayro, qpdf and poppler.-PrintCraft is a clean-room implementation. Its behaviour comes from the ISO 32000 specification and black-box observation, never from anyone else's code. Every icon, font and image is openly licensed and listed in [ATTRIBUTION.md](ATTRIBUTION.md).+PdfCraft is a clean-room implementation. Its behaviour comes from the ISO 32000 specification and black-box observation, never from anyone else's code. Every icon, font and image is openly licensed and listed in [ATTRIBUTION.md](ATTRIBUTION.md).## Get started```sh-git clone https://github.com/storytold/printcraft-cd printcraft-cargo run --release -p printcraft -- some.pdf # desktop app+git clone https://github.com/storytold/pdfcraft+cd pdfcraft+cargo run --release -p pdfcraft -- some.pdf # desktop appcargo xtask demo-pdf # build the showcase PDF used in these screenshotscargo xtask screenshots # regenerate every screenshot in this README```@@ -357,12 +357,12 @@ edited PDFs):```shgit clone https://github.com/storytold/craft-fonts ../craft-fonts-CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p printcraft -- some.pdf+CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p pdfcraft -- some.pdf```## What's next-PrintCraft is young and moving fast. The aim is a workbench where you can view, organize, annotate, fill, sign and edit PDFs, at parity with Acrobat Pro.+PdfCraft is young and moving fast. The aim is a workbench where you can view, organize, annotate, fill, sign and edit PDFs, at parity with Acrobat Pro.**Where it stands (October 2026), honestly:** about half of Acrobat Pro's offline features are in (88% of the must-haves), but that is roughly a third of the work, because the hardest parts are still ahead.@@ -379,7 +379,7 @@ The honest assessment by area, what's lacking and where we're going are in **[RO## The Crafting Apps-PrintCraft is one of the **Crafting Apps**: free, open-source creative tools from the+PdfCraft is one of the **Crafting Apps**: free, open-source creative tools from the[ArtCraft](https://getartcraft.com/) team, each written from scratch in Rust and each able tostand on its own.@@ -389,7 +389,7 @@ stand on its own.| <img src="https://raw.githubusercontent.com/storytold/vectorcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.vectorcraft.png" alt="" width="32" height="32"> | **VectorCraft** | Vector illustration | [GitHub](https://github.com/storytold/vectorcraft) | [Website](https://getartcraft.com/apps/vectorcraft) || <img src="https://raw.githubusercontent.com/storytold/filmcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.filmcraft.png" alt="" width="32" height="32"> | **FilmCraft** | Video editing, color and sound | [GitHub](https://github.com/storytold/filmcraft) | [Website](https://getartcraft.com/apps/filmcraft) || <img src="https://raw.githubusercontent.com/storytold/lightcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.lightcraft.png" alt="" width="32" height="32"> | **LightCraft** | Photo library and raw development | [GitHub](https://github.com/storytold/lightcraft) | [Website](https://getartcraft.com/apps/lightcraft) |-| <img src="https://raw.githubusercontent.com/storytold/printcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.printcraft.png" alt="" width="32" height="32"> | **PrintCraft** | **Reading, organizing and protecting PDFs · you are here** | [GitHub](https://github.com/storytold/printcraft) | [Website](https://getartcraft.com/apps/printcraft) |+| <img src="https://raw.githubusercontent.com/storytold/pdfcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.pdfcraft.png" alt="" width="32" height="32"> | **PdfCraft** | **Reading, organizing and protecting PDFs · you are here** | [GitHub](https://github.com/storytold/pdfcraft) | [Website](https://getartcraft.com/apps/pdfcraft) || <img src="https://raw.githubusercontent.com/storytold/effectcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.effectcraft.png" alt="" width="32" height="32"> | **EffectCraft** | Motion graphics and visual effects | [GitHub](https://github.com/storytold/effectcraft) | [Website](https://getartcraft.com/apps/effectcraft) || <img src="https://raw.githubusercontent.com/storytold/designcraft/main/assets/app-icon/hicolor/64x64/apps/ai.storyteller.designcraft.png" alt="" width="32" height="32"> | **DesignCraft** | Page layout and publishing | [GitHub](https://github.com/storytold/designcraft) | [Website](https://getartcraft.com/apps/designcraft) |@@ -414,15 +414,15 @@ And [**ArtCraft**](https://getartcraft.com/) itself, our AI image and video stud<a href="https://discord.gg/artcraft"><b>discord.gg/artcraft</b></a> ·<a href="https://getartcraft.com/">getartcraft.com</a> ·<a href="https://getartcraft.com/apps">The Crafting Apps</a> ·- <a href="https://getartcraft.com/apps/printcraft">PrintCraft</a>+ <a href="https://getartcraft.com/apps/pdfcraft">PdfCraft</a></p>---## License and credits-PrintCraft is dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option.-Copyright (c) 2026 ArtCraft Team and the PrintCraft contributors. Required notices are in [NOTICE](NOTICE).+PdfCraft is dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option.+Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors. Required notices are in [NOTICE](NOTICE).Bundled fonts, icons, images and other assets keep their own open licenses; each one is listedwith its author, source and license in [ATTRIBUTION.md](ATTRIBUTION.md). Release builds also embed@@ -431,10 +431,10 @@ the Japanese fonts of [craft-fonts](https://github.com/storytold/craft-fonts/bloThe ArtCraft name, wordmark and logos in [`docs/brand/`](docs/brand/) are trademarks of theArtCraft Team and are not covered by this license. They may be used only unmodified, and only as-part of this repository and PrintCraft, under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt).+part of this repository and PdfCraft, under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt).Forks and modified versions must remove them.-<sub>Adobe, Photoshop, Illustrator, Premiere Pro, Lightroom, Acrobat, After Effects and InDesign are trademarks or registered trademarks of Adobe Inc. in the United States and/or other countries. PrintCraft is an independent, open-source project and is not affiliated with, sponsored by or endorsed by Adobe Inc.; these names are used only to describe the workflows it is compatible with.</sub>+<sub>Adobe, Photoshop, Illustrator, Premiere Pro, Lightroom, Acrobat, After Effects and InDesign are trademarks or registered trademarks of Adobe Inc. in the United States and/or other countries. PdfCraft is an independent, open-source project and is not affiliated with, sponsored by or endorsed by Adobe Inc.; these names are used only to describe the workflows it is compatible with.</sub><p align="center"><a href="https://getartcraft.com/"><img alt="ArtCraft" src="docs/brand/artcraft-mark.svg" width="28"></a><br>diff --git a/ROADMAP.md b/ROADMAP.mdindex daa7c7b18..52fc9925c 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -1,4 +1,4 @@-# PrintCraft roadmap+# PdfCraft roadmapThe milestones, current progress and time estimates to Acrobat Pro feature parity. Keep this up to date:- **Every session:** update the progress column and add a line to the log.@@ -6,7 +6,7 @@ The milestones, current progress and time estimates to Acrobat Pro feature paritDetailed task lists and acceptance tests are in `plan/execution-plan.md` (local-only). This file is the public summary.-**What "parity" means here:** the offline feature set of Acrobat Pro, milestones M0–M14. It excludes Adobe's cloud services (Document Cloud storage, Adobe Sign, the Adobe AI Assistant). Those have no clean-room equivalent; PrintCraft's alternatives are local-first, plus opt-in providers (M13).+**What "parity" means here:** the offline feature set of Acrobat Pro, milestones M0–M14. It excludes Adobe's cloud services (Document Cloud storage, Adobe Sign, the Adobe AI Assistant). Those have no clean-room equivalent; PdfCraft's alternatives are local-first, plus opt-in providers (M13).## Estimate summary@@ -127,6 +127,7 @@ M0 → M1 → M2 → M3 → M4 must happen in order. After M4, M5–M12 can runNewest first. One line per session: the date, what moved, and the new overall percentage.+- **2026-10-07 (session 16):** PrintCraft is renamed PdfCraft: repo `storytold/pdfcraft`, crates and binaries `pdfcraft*`, bundle id `ai.storyteller.pdfcraft`. On first launch the app moves the old PrintCraft settings and crash-recovery folders to the new name, so upgrades keep recent files, preferences and unsaved work. No feature change. ≈ 30–35%.- **2026-10-07 (session 15):** Five community issues, each with a regression test: in two-page view, Next page moves a whole spread (#77, #70); Export to Word opens in Word again, with control characters dropped and receipt-length pages kept within Word's 22 in, checked in Microsoft Word (#78, #72); macOS opens PDFs from Finder, Open With and the Dock (Apple events through the audited `fmv-macos-events`, PDF declared in the Info.plist), and the packaging no longer describes the image editor it was copied from (#82, #73); Add text keeps the box being typed when you click elsewhere, with Done and Discard beside it, reproduced and checked with real OS input (#86, #74); sharper, higher-contrast text, most visible on Windows, with every text colour at WCAG AA in both themes (#84, #76; the console window was already gone in 0.2.1). Still open: #79 (layered "not verified" signature appearances), #80 (native macOS menu bar), #81 (Homebrew and Scoop). P0 88%, P1 53%; 805 features 50.2% shipped (53.7% weighted). ≈ 30–35%.- **2026-10-06 (session 14):** Issues: move and resize existing text boxes in Edit text (#59, closes #40); Windows release builds open no console window and the Start Menu shortcut has its icon (#58, #57; rolled out to every Craft app); native Windows ARM64 installers, installed and run on an ARM64 runner in CI (#66, #71; the intermittent ARM64 test crash was a WARP shader-JIT race between parallel GPU-rendering tests, not our code); XFA forms are detected and explained instead of failing silently (#65, #60 stays open for real XFA). Also: squiggly underline tool, comment opacity, Preferences ▸ Identity, drag-and-drop/hover tests; community table export to Word/HTML/RTF (#62, with linear-time detection and a column cap). #63 (timestamps/LTV with outbound network) held for review fixes and an owner decision on network access. ≈ 30–35% (unchanged).- **2026-10-05 (session 13, later):** FreeBSD: CI builds and tests the workspace in a FreeBSD 14.3 VM (#45) and the release ships a FreeBSD x86_64 tarball, checked in CI (#42); README lists FreeBSD. Fuzzing: the nightly job's 11 hangs fixed (#41: our parser's exponential retries, inline images, Type 3 fan-out), plus a JBIG2 hang (#43, vendored hayro-jbig2) and a Type 1 font stack overflow (#46, skrifa 0.47); a full run now finds 0 crashes. Landed community PRs #36 (text editing, Japanese replacements), #47 (English/Japanese interface) and #48 (XFDF colour crash). Windows launch crash with Intel's Vulkan driver fixed by using Direct3D 12 (#49, issue #37); one copy of the Japanese font instead of two (#51, −8.3 MB); full screen and About get real tests (#50). P0 88%, P1 52%. ≈ 30–35%.@@ -174,7 +175,7 @@ Newest first. One line per session: the date, what moved, and the new overall pe- Overall ≈ 9.5%.- **2026-09-30 (session 5, after a machine crash; no work lost):**- - Agent control: new `printcraft-automation` crate with 20 JSON-Schema tools, an opt-in MCP server (`printcraft-cli mcp`, stdio only, can be compiled out), and `printcraft-cli run`/`tools`.+ - Agent control: new `pdfcraft-automation` crate with 20 JSON-Schema tools, an opt-in MCP server (`pdfcraft-cli mcp`, stdio only, can be compiled out), and `pdfcraft-cli run`/`tools`.- Text on rotated pages now reads along its lines; the pdf.js oracle is unchanged at median 0.980.- Finding text in 520 pages: 17.9 s → 3.7 s (parallel), about 20 ms when repeated (cached).- CI: dependency licence audit (`deny.toml`, `xtask deny`) and a GitHub workflow for macOS, Windows, Linux and wasm.diff --git a/apps/pdfcraft-cli/Cargo.toml b/apps/pdfcraft-cli/Cargo.tomlnew file mode 100644index 000000000..d2add5d71--- /dev/null+++ b/apps/pdfcraft-cli/Cargo.toml@@ -0,0 +1,26 @@+[package]+name = "pdfcraft-cli"+description = "PdfCraft command-line tool: inspect, render and robustness-check PDFs"+version.workspace = true+edition.workspace = true+license.workspace = true++[[bin]]+name = "pdfcraft-cli"+path = "src/main.rs"++[lints]+workspace = true++[dependencies]+pdfcraft-render = { workspace = true }+serde_json = { workspace = true }+pdfcraft-engine = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-automation = { workspace = true }+base64 = "0.22"++[features]+default = ["mcp"]+# The opt-in MCP server (`pdfcraft-cli mcp`). Build with --no-default-features to leave it out.+mcp = ["pdfcraft-automation/mcp"]diff --git a/apps/printcraft-cli/src/main.rs b/apps/pdfcraft-cli/src/main.rssimilarity index 86%rename from apps/printcraft-cli/src/main.rsrename to apps/pdfcraft-cli/src/main.rsindex f703f676c..6e79ffe38 100644--- a/apps/printcraft-cli/src/main.rs+++ b/apps/pdfcraft-cli/src/main.rs@@ -1,24 +1,24 @@-//! printcraft-cli — headless PrintCraft.+//! pdfcraft-cli — headless PdfCraft.//!//! ```text-//! printcraft-cli info <file.pdf> [--password PW] document summary as JSON-//! printcraft-cli render <file.pdf> --page N [--dpi 96] --out x.pam-//! printcraft-cli text <file.pdf> [--page N] extracted text (pages separated by form feeds)-//! printcraft-cli edit <in.pdf> --out out.pdf [--rotate 1,3:90] [--delete 2,4] [--move 5:1]+//! pdfcraft-cli info <file.pdf> [--password PW] document summary as JSON+//! pdfcraft-cli render <file.pdf> --page N [--dpi 96] --out x.pam+//! pdfcraft-cli text <file.pdf> [--page N] extracted text (pages separated by form feeds)+//! pdfcraft-cli edit <in.pdf> --out out.pdf [--rotate 1,3:90] [--delete 2,4] [--move 5:1]//! [--insert-blank 1] [--title T] [--author A] [--full]-//! printcraft-cli combine <a.pdf> <b.pdf> … --out combined.pdf-//! printcraft-cli extract <in.pdf> --pages 1,3,5 --out out.pdf-//! printcraft-cli split <in.pdf> (--every N | --before 3,7) [--out-dir DIR]-//! printcraft-cli check <files or dirs…> [--timeout 20] [--dpi 36] [--json out.json]-//! printcraft-cli tools automation tools and their JSON Schemas-//! printcraft-cli run <tool> [key=value …] [--root DIR] [--out image.png]-//! printcraft-cli run --script steps.json [--root DIR] [{"tool": "doc_open", "args": {…}}, …]-//! printcraft-cli mcp [--root DIR] MCP server on stdin/stdout (opt-in)-//! printcraft-cli ui --control FILE <method> [key=value …] [--out shot.png]+//! pdfcraft-cli combine <a.pdf> <b.pdf> … --out combined.pdf+//! pdfcraft-cli extract <in.pdf> --pages 1,3,5 --out out.pdf+//! pdfcraft-cli split <in.pdf> (--every N | --before 3,7) [--out-dir DIR]+//! pdfcraft-cli check <files or dirs…> [--timeout 20] [--dpi 36] [--json out.json]+//! pdfcraft-cli tools automation tools and their JSON Schemas+//! pdfcraft-cli run <tool> [key=value …] [--root DIR] [--out image.png]+//! pdfcraft-cli run --script steps.json [--root DIR] [{"tool": "doc_open", "args": {…}}, …]+//! pdfcraft-cli mcp [--root DIR] MCP server on stdin/stdout (opt-in)+//! pdfcraft-cli ui --control FILE <method> [key=value …] [--out shot.png]//! drive a running app started with --control FILE//! ```//!-//! `run` and `mcp` drive the same tool table (`printcraft-automation`). In `run`, values parse as+//! `run` and `mcp` drive the same tool table (`pdfcraft-automation`). In `run`, values parse as//! JSON when they can (`pages=[1,3]`, `degrees=90`) and are strings otherwise. A script runs its//! steps in one session, so `doc_open` returns id 1, the next document id 2, and so on.//!@@ -37,7 +37,7 @@ use std::process::{Command, ExitCode, Stdio};use std::sync::Arc;use std::time::{Duration, Instant};-use printcraft_render::{PageRenderer, RenderConfig, RenderRequest, RequestKind, inspect};+use pdfcraft_render::{PageRenderer, RenderConfig, RenderRequest, RequestKind, inspect};fn main() -> ExitCode {let args: Vec<String> = std::env::args().skip(1).collect();@@ -58,19 +58,19 @@ fn main() -> ExitCode {#[cfg(feature = "mcp")]Some("mcp") => mcp(&args[1..]),Some("--version") => {- println!("printcraft-cli {}", env!("CARGO_PKG_VERSION"));- println!("Discord: {} (help and feedback)", printcraft_engine::links::DISCORD);- println!("Web: {}", printcraft_engine::links::APP_PAGE);- println!("Source: {}", printcraft_engine::links::GITHUB);+ println!("pdfcraft-cli {}", env!("CARGO_PKG_VERSION"));+ println!("Discord: {} (help and feedback)", pdfcraft_engine::links::DISCORD);+ println!("Web: {}", pdfcraft_engine::links::APP_PAGE);+ println!("Source: {}", pdfcraft_engine::links::GITHUB);Ok(())}- _ => Err("usage: printcraft-cli <info|render|text|edit|combine|extract|split|check|tools|run|mcp|ui> … (see source header for options)\nhelp and feedback: https://discord.gg/artcraft"+ _ => Err("usage: pdfcraft-cli <info|render|text|edit|combine|extract|split|check|tools|run|mcp|ui> … (see source header for options)\nhelp and feedback: https://discord.gg/artcraft".into()),};match result {Ok(()) => ExitCode::SUCCESS,Err(e) => {- eprintln!("printcraft-cli: {e}");+ eprintln!("pdfcraft-cli: {e}");ExitCode::FAILURE}}@@ -112,7 +112,7 @@ fn info(args: &[String]) -> Result<(), String> {"first_page_pt": info.pages.first().map(|p| [p.width, p.height]),"title": info.title, "author": info.author, "producer": info.producer, "creator": info.creator,"encrypted": info.encrypted, "tagged": info.tagged, "javascript": info.has_javascript,- "xfa": info.xfa.map(|x| match x { printcraft_render::Xfa::Static => "static", printcraft_render::Xfa::Dynamic => "dynamic" }),+ "xfa": info.xfa.map(|x| match x { pdfcraft_render::Xfa::Static => "static", pdfcraft_render::Xfa::Dynamic => "dynamic" }),"bookmarks": info.outline.len(), "annotations": info.annotations.len(), "fields": info.fields.len(),"links": info.links.len(), "layers": info.layers.len(), "attachments": info.attachments.len(),"page_labels": info.pages.iter().take(8).map(|p| p.label.clone()).collect::<Vec<_>>(),@@ -150,7 +150,7 @@ fn page_list(s: &str) -> Result<Vec<usize>, String> {/// Apply page and metadata edits through the engine and save (incrementally unless `--full`).fn edit(args: &[String]) -> Result<(), String> {- use printcraft_engine::{Edit, Session};+ use pdfcraft_engine::{Edit, Session};let path = *positional(args).first().ok_or("edit: missing file")?;let out = flag(args, "--out").ok_or("edit: missing --out")?;let mut session = Session::new();@@ -198,7 +198,7 @@ fn combine(args: &[String]) -> Result<(), String> {return Err("combine: give at least two input files".into());}let sources = inputs.iter().map(|p| Ok((file_stem(p), read(p)?))).collect::<Result<Vec<_>, String>>()?;- let bytes = printcraft_engine::Session::new().combine(&sources).map_err(|e| e.to_string())?;+ let bytes = pdfcraft_engine::Session::new().combine(&sources).map_err(|e| e.to_string())?;std::fs::write(out, bytes.as_slice()).map_err(|e| format!("{out}: {e}"))}@@ -206,14 +206,14 @@ fn extract(args: &[String]) -> Result<(), String> {let path = *positional(args).first().ok_or("extract: missing file")?;let out = flag(args, "--out").ok_or("extract: missing --out")?;let pages = page_list(flag(args, "--pages").ok_or("extract: missing --pages")?)?;- let mut session = printcraft_engine::Session::new();+ let mut session = pdfcraft_engine::Session::new();let id = session.open(path, None, read(path)?, flag(args, "--password")).map_err(|e| e.to_string())?;let bytes = session.extract(id, &pages).map_err(|e| e.to_string())?;std::fs::write(out, bytes.as_slice()).map_err(|e| format!("{out}: {e}"))}fn split(args: &[String]) -> Result<(), String> {- use printcraft_engine::SplitBy;+ use pdfcraft_engine::SplitBy;let path = *positional(args).first().ok_or("split: missing file")?;let by = match (flag(args, "--every"), flag(args, "--before")) {(Some(n), None) => SplitBy::PageCount(n.parse().map_err(|_| "bad --every")?),@@ -221,7 +221,7 @@ fn split(args: &[String]) -> Result<(), String> {_ => return Err("split: give either --every N or --before PAGES".into()),};let dir = PathBuf::from(flag(args, "--out-dir").unwrap_or("."));- let mut session = printcraft_engine::Session::new();+ let mut session = pdfcraft_engine::Session::new();let id = session.open(path, None, read(path)?, flag(args, "--password")).map_err(|e| e.to_string())?;let stem = file_stem(path);for (a, b, bytes) in session.split(id, &by).map_err(|e| e.to_string())? {@@ -288,7 +288,7 @@ fn check_one(args: &[String]) -> Result<(), String> {/// Open with cos, touch every object, edit the catalog, save incrementally and in full (both/// output styles), and reopen each result. Errors are fine; panics, hangs and aborts are bugs.fn edit_round_trip(bytes: &[u8]) {- use printcraft_cos::{Document, Object, SaveOptions, write_full, write_incremental};+ use pdfcraft_cos::{Document, Object, SaveOptions, write_full, write_incremental};let Ok(mut doc) = Document::open(Arc::new(bytes.to_vec())) else { return };for num in doc.object_numbers().into_iter().take(20_000) {if let Ok(o) = doc.try_get(num)@@ -298,7 +298,7 @@ fn edit_round_trip(bytes: &[u8]) {}}if let Some(root) = doc.root() {- let _ = doc.update_dict(root, |d| d.set(b"PrintCraftFuzz".to_vec(), Object::Bool(true)));+ let _ = doc.update_dict(root, |d| d.set(b"PdfCraftFuzz".to_vec(), Object::Bool(true)));}let classic = SaveOptions { object_streams: false, ..SaveOptions::default() };for out in [write_incremental(&doc, &SaveOptions::default()), write_full(&doc, &SaveOptions::default()), write_full(&doc, &classic)]@@ -397,8 +397,8 @@ fn run_child(exe: &Path, file: &Path, dpi: &str, timeout: Duration) -> serde_jso// ---- automation ---------------------------------------------------------------------------------fn automation(args: &[String]) -> Result<printcraft_automation::Automation, String> {- let a = printcraft_automation::Automation::new();+fn automation(args: &[String]) -> Result<pdfcraft_automation::Automation, String> {+ let a = pdfcraft_automation::Automation::new();match flag(args, "--root") {Some(root) => a.with_root(root).map_err(|e| format!("--root {root}: {e}")),None => Ok(a),@@ -406,7 +406,7 @@ fn automation(args: &[String]) -> Result<printcraft_automation::Automation, Stri}fn tools() -> Result<(), String> {- let list: Vec<serde_json::Value> = printcraft_automation::tools()+ let list: Vec<serde_json::Value> = pdfcraft_automation::tools().iter().map(|t| serde_json::json!({ "name": t.name, "description": t.description, "read_only": t.read_only, "command": t.command, "input_schema": t.input_schema })).collect();@@ -415,11 +415,11 @@ fn tools() -> Result<(), String> {}/// Print a tool's result: JSON as JSON; images go to `--out` (or are summarised).-fn print_output(content: Vec<printcraft_automation::Content>, out: Option<&str>) -> Result<(), String> {+fn print_output(content: Vec<pdfcraft_automation::Content>, out: Option<&str>) -> Result<(), String> {for c in content {match c {- printcraft_automation::Content::Json(v) => println!("{}", serde_json::to_string_pretty(&v).unwrap_or_default()),- printcraft_automation::Content::Png { data, width, height } => match out {+ pdfcraft_automation::Content::Json(v) => println!("{}", serde_json::to_string_pretty(&v).unwrap_or_default()),+ pdfcraft_automation::Content::Png { data, width, height } => match out {Some(path) => {std::fs::write(path, &data).map_err(|e| format!("{path}: {e}"))?;println!("{}", serde_json::json!({ "image": path, "width": width, "height": height }));@@ -446,7 +446,7 @@ fn run(args: &[String]) -> Result<(), String> {}return Ok(());}- let tool = *positional(args).first().ok_or("run: missing tool name (see `printcraft-cli tools`)")?;+ let tool = *positional(args).first().ok_or("run: missing tool name (see `pdfcraft-cli tools`)")?;let mut obj = serde_json::Map::new();for kv in positional(args).iter().skip(1) {let (k, v) = kv.split_once('=').ok_or(format!("run: expected key=value, got {kv:?}"))?;@@ -459,17 +459,17 @@ fn run(args: &[String]) -> Result<(), String> {#[cfg(feature = "mcp")]fn mcp(args: &[String]) -> Result<(), String> {- let mut server = printcraft_automation::mcp::McpServer::new(automation(args)?);- eprintln!("printcraft-cli: MCP server on stdio (protocol {}); close stdin to stop", printcraft_automation::mcp::PROTOCOL_VERSIONS[0]);+ let mut server = pdfcraft_automation::mcp::McpServer::new(automation(args)?);+ eprintln!("pdfcraft-cli: MCP server on stdio (protocol {}); close stdin to stop", pdfcraft_automation::mcp::PROTOCOL_VERSIONS[0]);server.serve(std::io::stdin().lock(), std::io::stdout().lock()).map_err(|e| e.to_string())}// ---- UI control channel client ------------------------------------------------------------------/// One request to a running app's control channel (`printcraft --control FILE`).+/// One request to a running app's control channel (`pdfcraft --control FILE`).fn ui(args: &[String]) -> Result<(), String> {use std::io::{BufRead, BufReader, Write as _};- let file = flag(args, "--control").ok_or("ui: missing --control FILE (start the app with `printcraft --control FILE`)")?;+ let file = flag(args, "--control").ok_or("ui: missing --control FILE (start the app with `pdfcraft --control FILE`)")?;let info: serde_json::Value =serde_json::from_str(&std::fs::read_to_string(file).map_err(|e| format!("{file}: {e}"))?).map_err(|e| format!("{file}: {e}"))?;let port = info["port"].as_u64().ok_or(format!("{file}: no port"))?;diff --git a/apps/printcraft-web/Cargo.toml b/apps/pdfcraft-web/Cargo.tomlsimilarity index 75%rename from apps/printcraft-web/Cargo.tomlrename to apps/pdfcraft-web/Cargo.tomlindex dc7ad99cf..a8d472d4f 100644--- a/apps/printcraft-web/Cargo.toml+++ b/apps/pdfcraft-web/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft-web"-description = "PrintCraft in the browser (wasm32; build with `trunk build --release` in this directory)"+name = "pdfcraft-web"+description = "PdfCraft in the browser (wasm32; build with `trunk build --release` in this directory)"version.workspace = trueedition.workspace = truelicense.workspace = true@@ -10,7 +10,7 @@ publish = falseworkspace = true[dependencies]-printcraft-ui-egui = { workspace = true }+pdfcraft-ui-egui = { workspace = true }eframe = { workspace = true, features = ["default_fonts", "glow", "persistence", "accesskit"] }egui = { workspace = true }diff --git a/apps/printcraft-web/Trunk.toml b/apps/pdfcraft-web/Trunk.tomlsimilarity index 77%rename from apps/printcraft-web/Trunk.tomlrename to apps/pdfcraft-web/Trunk.tomlindex 7a3074779..563c2267c 100644--- a/apps/printcraft-web/Trunk.toml+++ b/apps/pdfcraft-web/Trunk.toml@@ -1,4 +1,4 @@-# Build with: trunk build --release (from apps/printcraft-web)+# Build with: trunk build --release (from apps/pdfcraft-web)# The release zip (packaging/web/package.sh) expects the site in dist/web with relative URLs.[build]target = "index.html"diff --git a/apps/printcraft-web/index.html b/apps/pdfcraft-web/index.htmlsimilarity index 88%rename from apps/printcraft-web/index.htmlrename to apps/pdfcraft-web/index.htmlindex 5980e3676..46b3a25e2 100644--- a/apps/printcraft-web/index.html+++ b/apps/pdfcraft-web/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />- <title>PrintCraft</title>+ <title>PdfCraft</title><link data-trunk rel="rust" data-wasm-opt="z" /><style>html, body { margin: 0; height: 100%; overflow: hidden; background: #f1f1f3; }@@ -12,6 +12,6 @@</style></head><body>- <canvas id="printcraft"></canvas>+ <canvas id="pdfcraft"></canvas></body></html>diff --git a/apps/printcraft-web/src/main.rs b/apps/pdfcraft-web/src/main.rssimilarity index 84%rename from apps/printcraft-web/src/main.rsrename to apps/pdfcraft-web/src/main.rsindex b96a91b72..cf37bda97 100644--- a/apps/printcraft-web/src/main.rs+++ b/apps/pdfcraft-web/src/main.rs@@ -1,4 +1,4 @@-//! PrintCraft in the browser. Build: `cd apps/printcraft-web && trunk build --release`+//! PdfCraft in the browser. Build: `cd apps/pdfcraft-web && trunk build --release`//! (trunk generates the JS loader; no handwritten JS — plan/execution-plan.md §1).#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]@@ -6,13 +6,13 @@#[cfg(target_arch = "wasm32")]fn main() {use eframe::wasm_bindgen::JsCast;- use printcraft_ui_egui::PrintCraftApp;+ use pdfcraft_ui_egui::PdfCraftApp;let options = eframe::WebOptions { renderer: eframe::Renderer::Glow, ..Default::default() };wasm_bindgen_futures::spawn_local(async move {let Some(canvas) = web_sys::window().and_then(|w| w.document())- .and_then(|d| d.get_element_by_id("printcraft"))+ .and_then(|d| d.get_element_by_id("pdfcraft")).and_then(|e| e.dyn_into::<web_sys::HtmlCanvasElement>().ok())else {return;@@ -22,8 +22,9 @@ fn main() {canvas,options,Box::new(|cc| {- let mut app = PrintCraftApp::new();- if let Some(json) = cc.storage.and_then(|s| s.get_string("printcraft")) {+ let mut app = PdfCraftApp::new();+ // "printcraft": settings saved under the app's former name, PrintCraft.+ if let Some(json) = cc.storage.and_then(|s| s.get_string("pdfcraft").or_else(|| s.get_string("printcraft"))) {app.restore(&json);}// `?file=<url>` opens a PDF from a URL (same-origin or CORS-enabled).@@ -40,7 +41,7 @@ fn main() {}ctx.request_repaint();}- Err(e) => eframe::web_sys::console::error_1(&format!("PrintCraft: could not fetch {url}: {e}").into()),+ Err(e) => eframe::web_sys::console::error_1(&format!("PdfCraft: could not fetch {url}: {e}").into()),}});}@@ -75,5 +76,5 @@ async fn fetch_bytes(url: &str) -> Result<Vec<u8>, String> {#[cfg(not(target_arch = "wasm32"))]fn main() {- eprintln!("printcraft-web targets wasm32: run `trunk serve` or `trunk build --release` in apps/printcraft-web");+ eprintln!("pdfcraft-web targets wasm32: run `trunk serve` or `trunk build --release` in apps/pdfcraft-web");}diff --git a/apps/printcraft/Cargo.toml b/apps/pdfcraft/Cargo.tomlsimilarity index 84%rename from apps/printcraft/Cargo.tomlrename to apps/pdfcraft/Cargo.tomlindex e02158857..df5cc75f0 100644--- a/apps/printcraft/Cargo.toml+++ b/apps/pdfcraft/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft"-description = "PrintCraft desktop app"+name = "pdfcraft"+description = "PdfCraft desktop app"version.workspace = trueedition.workspace = truelicense.workspace = true@@ -13,7 +13,7 @@ workspace = true# trusted roots. No bundled root list (webpki-roots and webpki-root-certs are CDLA-licensed).ureq = { version = "3.4", default-features = false, features = ["rustls-no-provider", "_ring"] }rustls-native-certs = "0.8"-printcraft-ui-egui = { workspace = true }+pdfcraft-ui-egui = { workspace = true }eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "wayland", "x11", "persistence", "links"] }egui = { workspace = true }serde_json = { workspace = true }@@ -25,5 +25,5 @@ serde_json = { workspace = true }fmv-macos-events = "=0.1.0"[build-dependencies]-# Icon + VERSIONINFO for printcraft.exe; build.rs only uses it when targeting Windows.+# Icon + VERSIONINFO for pdfcraft.exe; build.rs only uses it when targeting Windows.winresource = "0.1"diff --git a/apps/pdfcraft/build.rs b/apps/pdfcraft/build.rsnew file mode 100644index 000000000..df73faa2a--- /dev/null+++ b/apps/pdfcraft/build.rs@@ -0,0 +1,29 @@+//! Windows only: embed the app icon and version info (VERSIONINFO) into `pdfcraft.exe`, so it+//! shows in Explorer, the taskbar, the Start menu and Alt-Tab.+//!+//! On every other target this does nothing. A missing resource compiler is a warning, so a+//! cross-compile from macOS or Linux still links, unless `PDFCRAFT_REQUIRE_WINRES=1` turns it+//! into an error (for release builds).++fn main() {+ println!("cargo:rerun-if-changed=build.rs");+ println!("cargo:rerun-if-changed=../../assets/app-icon/pdfcraft.ico");+ println!("cargo:rerun-if-env-changed=PDFCRAFT_REQUIRE_WINRES");+ if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {+ return;+ }+ let mut res = winresource::WindowsResource::new();+ res.set_icon("../../assets/app-icon/pdfcraft.ico")+ .set("ProductName", "PdfCraft")+ .set("FileDescription", "PdfCraft PDF workbench")+ .set("LegalCopyright", "Copyright (c) the PdfCraft contributors. MIT OR Apache-2.0.")+ .set("OriginalFilename", "pdfcraft.exe")+ .set("InternalName", "pdfcraft");+ if let Err(e) = res.compile() {+ if std::env::var_os("PDFCRAFT_REQUIRE_WINRES").is_some() {+ println!("cargo::error=embedding Windows resources failed: {e}");+ return;+ }+ println!("cargo:warning=pdfcraft.exe built without icon/version resources: {e}");+ }+}diff --git a/apps/printcraft/src/apple_events.rs b/apps/pdfcraft/src/apple_events.rssimilarity index 87%rename from apps/printcraft/src/apple_events.rsrename to apps/pdfcraft/src/apple_events.rsindex 37f8aaf6d..36cab0e0c 100644--- a/apps/printcraft/src/apple_events.rs+++ b/apps/pdfcraft/src/apple_events.rs@@ -1,9 +1,9 @@//! macOS open-documents and quit Apple events (#73).//!-//! Finder double-clicks, Open With, drops on the Dock icon and `open -a PrintCraft file.pdf` don't+//! Finder double-clicks, Open With, drops on the Dock icon and `open -a PdfCraft file.pdf` don't//! pass paths on the command line: LaunchServices sends the running (or just-launched) app a//! `kAEOpenDocuments` ('odoc') Apple event. winit 0.30 doesn't handle it and owns the-//! `NSApplicationDelegate`, so AppKit answered "PrintCraft cannot open files in the PDF document+//! `NSApplicationDelegate`, so AppKit answered "PdfCraft cannot open files in the PDF document//! format". Handling it ourselves needs Objective-C class declarations, i.e. `unsafe`, which this//! workspace forbids. The audited `fmv-macos-events` crate (also used by PhotoCraft) wraps exactly//! that, an `NSAppleEventManager` handler registered before Finder's launch event that leaves@@ -11,7 +11,7 @@//! [`OsEvent`]s that the UI polls every frame.use fmv_macos_events::{Event, Inbox, Registration};-use printcraft_ui_egui::{OsEvent, OsEventsFn};+use pdfcraft_ui_egui::{OsEvent, OsEventsFn};/// Keeps the Apple-event handlers registered; hold it until the event loop returns.pub struct AppleEvents {@@ -27,7 +27,7 @@ impl AppleEvents {Self { _registration: registration, inbox }}- /// The queue the UI drains (`PrintCraftApp::os_events`); events arriving later wake `ctx`.+ /// The queue the UI drains (`PdfCraftApp::os_events`); events arriving later wake `ctx`.pub fn connect(&self, ctx: &egui::Context) -> OsEventsFn {let ctx = ctx.clone();self.inbox.set_wake(move || ctx.request_repaint());diff --git a/apps/printcraft/src/main.rs b/apps/pdfcraft/src/main.rssimilarity index 74%rename from apps/printcraft/src/main.rsrename to apps/pdfcraft/src/main.rsindex cf7963600..c36b09f70 100644--- a/apps/printcraft/src/main.rs+++ b/apps/pdfcraft/src/main.rs@@ -1,6 +1,6 @@-//! PrintCraft desktop app.+//! PdfCraft desktop app.//!-//! Usage: `printcraft [options] [files…]`+//! Usage: `pdfcraft [options] [files…]`//!//! View options (applied after the files open; also the seed of the UI control channel)://! `--page N --zoom 150 --layout continuous|two-up|single --panel comments|bookmarks|pages|fields|layers|attachments|none@@ -9,7 +9,7 @@//!//! `--control <file>` enables the UI control channel (off by default): the app listens on a random//! loopback port and writes `{"port", "token", "pid"}` to `<file>` (owner-only permissions).-//! Agents then drive it with `printcraft-cli ui --control <file> <method> …`.+//! Agents then drive it with `pdfcraft-cli ui --control <file> <method> …`.// Release builds on Windows are GUI-subsystem programs, so launching the app doesn't open a console// window next to it (#57). `--version` and diagnostics then go nowhere when started from a terminal@@ -17,27 +17,54 @@#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")]#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;#[cfg(target_os = "macos")]mod apple_events;mod updates;/// Freedesktop app id: the `.desktop` file name and the hicolor icon name.-const APP_ID: &str = "ai.storyteller.printcraft";+const APP_ID: &str = "ai.storyteller.pdfcraft";/// The app icon (assets/app-icon/README.md). macOS gets the version on Apple's icon grid, with a/// transparent margin; Windows and Linux get the full-bleed tile.#[cfg(target_os = "macos")]-const APP_ICON_PNG: &[u8] = include_bytes!("../../../assets/app-icon/printcraft-1024.png");+const APP_ICON_PNG: &[u8] = include_bytes!("../../../assets/app-icon/pdfcraft-1024.png");#[cfg(not(target_os = "macos"))]-const APP_ICON_PNG: &[u8] = include_bytes!("../../../assets/app-icon/hicolor/256x256/apps/ai.storyteller.printcraft.png");+const APP_ICON_PNG: &[u8] = include_bytes!("../../../assets/app-icon/hicolor/256x256/apps/ai.storyteller.pdfcraft.png");++/// The app was called PrintCraft before; settings saved then are under this key.+const LEGACY_STORAGE_KEY: &str = "printcraft";++/// Move the settings and crash-recovery folders of the app's former name, PrintCraft, to the new+/// name once, so an upgrade keeps recent files, preferences and unsaved work. Best effort: a+/// folder is left alone when the new one already exists or the move fails.+fn migrate_legacy_folders() {+ let mut moves = vec![(eframe::storage_dir("PrintCraft"), eframe::storage_dir("PdfCraft"))];+ // Recovery lives in the settings folder except on Windows, where it is under %LOCALAPPDATA%.+ if cfg!(windows) {+ let local = std::env::var_os("LOCALAPPDATA").filter(|v| !v.is_empty()).map(std::path::PathBuf::from);+ moves.push((local.as_ref().map(|d| d.join("PrintCraft")), local.map(|d| d.join("PdfCraft"))));+ }+ for (old, new) in moves {+ let (Some(old), Some(new)) = (old, new) else { continue };+ if !old.is_dir() || new.exists() {+ continue;+ }+ if let Some(parent) = new.parent() {+ let _ = std::fs::create_dir_all(parent);+ }+ if let Err(e) = std::fs::rename(&old, &new) {+ eprintln!("pdfcraft: moving {} to {}: {e}", old.display(), new.display());+ }+ }+}fn main() -> eframe::Result {// Last-resort guard (AGENTS.md §4): commands, edits, opens and saves catch panics and report// them; this hook logs every panic, caught or not, with a backtrace when RUST_BACKTRACE is set.std::panic::set_hook(Box::new(|info| {- eprintln!("printcraft: internal error: {info}");+ eprintln!("pdfcraft: internal error: {info}");let trace = std::backtrace::Backtrace::capture();if trace.status() == std::backtrace::BacktraceStatus::Captured {eprintln!("{trace}");@@ -50,7 +77,7 @@ fn main() -> eframe::Result {while let Some(a) = args.next() {match a.as_str() {"--version" => {- println!("printcraft {}", env!("CARGO_PKG_VERSION"));+ println!("pdfcraft {}", env!("CARGO_PKG_VERSION"));return Ok(());}"--control" => control_file = args.next(),@@ -63,22 +90,23 @@ fn main() -> eframe::Result {}let integrated = cfg!(target_os = "macos");let mut viewport = egui::ViewportBuilder::default()- .with_title("PrintCraft")+ .with_title("PdfCraft").with_inner_size([1440.0, 920.0]).with_min_inner_size([820.0, 520.0]).with_drag_and_drop(true)- // Wayland app id: matches packaging/linux/ai.storyteller.printcraft.desktop.+ // Wayland app id: matches packaging/linux/ai.storyteller.pdfcraft.desktop..with_app_id(APP_ID);// Dock, taskbar, Alt-Tab and launcher icon when running unbundled.match eframe::icon_data::from_png_bytes(APP_ICON_PNG) {Ok(icon) => viewport = viewport.with_icon(icon),- Err(e) => eprintln!("printcraft: app icon: {e}"),+ Err(e) => eprintln!("pdfcraft: app icon: {e}"),}if integrated {viewport = viewport.with_fullsize_content_view(true).with_titlebar_shown(false).with_title_shown(false);}- // eframe would otherwise derive the settings folder from the app id: keep it under "PrintCraft".- let persistence_path = eframe::storage_dir("PrintCraft").map(|d| d.join("app.ron"));+ migrate_legacy_folders();+ // eframe would otherwise derive the settings folder from the app id: keep it under "PdfCraft".+ let persistence_path = eframe::storage_dir("PdfCraft").map(|d| d.join("app.ron"));let mut native = eframe::NativeOptions { viewport, persistence_path, ..Default::default() };configure_gpu(&mut native);// Finder, Open With and the Dock deliver files as Apple events, not arguments; catch the one@@ -88,11 +116,11 @@ fn main() -> eframe::Result {#[cfg(target_os = "macos")]let apple_events = &apple_events;eframe::run_native(- "PrintCraft",+ "PdfCraft",native,Box::new(move |cc| {- let mut app = PrintCraftApp::new();- if let Some(json) = cc.storage.and_then(|s| s.get_string("printcraft")) {+ let mut app = PdfCraftApp::new();+ if let Some(json) = cc.storage.and_then(|s| s.get_string("pdfcraft").or_else(|| s.get_string(LEGACY_STORAGE_KEY))) {app.restore(&json);}app.integrated_titlebar = integrated;@@ -104,21 +132,21 @@ fn main() -> eframe::Result {}if let Some(file) = &control_file {let client = app.attach_control(&cc.egui_ctx);- match printcraft_ui_egui::control::serve(client).and_then(|ep| write_control_file(file, ep.port, &ep.token).map(|()| ep.port)) {- Ok(port) => eprintln!("printcraft: UI control channel on 127.0.0.1:{port} (connection details in {file})"),- Err(e) => eprintln!("printcraft: --control {file}: {e}"),+ match pdfcraft_ui_egui::control::serve(client).and_then(|ep| write_control_file(file, ep.port, &ep.token).map(|()| ep.port)) {+ Ok(port) => eprintln!("pdfcraft: UI control channel on 127.0.0.1:{port} (connection details in {file})"),+ Err(e) => eprintln!("pdfcraft: --control {file}: {e}"),}}// Autosave unsaved changes; offer to recover documents a crashed session left behind.- if let Some(dir) = printcraft_ui_egui::RecoveryStore::default_dir() {- app.enable_recovery(printcraft_ui_egui::RecoveryStore::new(dir));+ if let Some(dir) = pdfcraft_ui_egui::RecoveryStore::default_dir() {+ app.enable_recovery(pdfcraft_ui_egui::RecoveryStore::new(dir));}for f in files {app.open_path(&f);}for (k, v) in options {if let Err(e) = app.set_option(&k, &v) {- eprintln!("printcraft: --{k} {v}: {e}");+ eprintln!("pdfcraft: --{k} {v}: {e}");}}Ok(Box::new(app))@@ -154,7 +182,7 @@ fn write_control_file(path: &str, port: u16, token: &str) -> std::io::Result<()>/// It also saves battery. Machines with one GPU are unaffected./// - On Windows, use Direct3D 12, falling back to OpenGL, and never load Vulkan drivers unless/// `WGPU_BACKEND` asks for them. Creating a Vulkan instance loads every installed Vulkan driver-/// into the process, and a faulty one (an Intel driver in issue #37) crashed PrintCraft before+/// into the process, and a faulty one (an Intel driver in issue #37) crashed PdfCraft before/// its window appeared. D3D12 is the native, best-supported backend there.fn configure_gpu(native: &mut eframe::NativeOptions) {let eframe::egui_wgpu::WgpuSetup::CreateNew(setup) = &mut native.wgpu_options.wgpu_setup else { return };diff --git a/apps/printcraft/src/updates.rs b/apps/pdfcraft/src/updates.rssimilarity index 78%rename from apps/printcraft/src/updates.rsrename to apps/pdfcraft/src/updates.rsindex 708065f43..e88c2f97f 100644--- a/apps/printcraft/src/updates.rs+++ b/apps/pdfcraft/src/updates.rs@@ -1,10 +1,10 @@-//! Asks GitHub for the latest PrintCraft release (Help ▸ Check for updates, issue #28).+//! Asks GitHub for the latest PdfCraft release (Help ▸ Check for updates, issue #28).use std::time::Duration;-use printcraft_ui_egui::updates::{RELEASES_PAGE, Release};+use pdfcraft_ui_egui::updates::{RELEASES_PAGE, Release};-const LATEST: &str = "https://api.github.com/repos/storytold/printcraft/releases/latest";+const LATEST: &str = "https://api.github.com/repos/storytold/pdfcraft/releases/latest";/// The latest release. The answer is untrusted: its size is capped, and only a page under/// [`RELEASES_PAGE`] is ever offered for download (anything else falls back to that list).@@ -17,7 +17,7 @@ pub fn latest_release() -> Result<Release, String> {let mut response = agent.get(LATEST).header("Accept", "application/vnd.github+json")- .header("User-Agent", concat!("PrintCraft/", env!("CARGO_PKG_VERSION")))+ .header("User-Agent", concat!("PdfCraft/", env!("CARGO_PKG_VERSION"))).call().map_err(|e| format!("couldn't reach GitHub ({e})"))?;let body = response.body_mut().with_config().limit(1 << 20).read_to_string().map_err(|e| format!("unreadable answer ({e})"))?;@@ -51,9 +51,9 @@ mod tests {#[test]fn answers_are_read_and_only_our_release_pages_are_offered() {- let r = parse(r#"{"tag_name":"v0.2.0","html_url":"https://github.com/storytold/printcraft/releases/tag/v0.2.0"}"#).unwrap();- assert_eq!(r, Release { version: "v0.2.0".into(), url: "https://github.com/storytold/printcraft/releases/tag/v0.2.0".into() });- for elsewhere in ["https://example.com/printcraft.exe", "https://github.com/storytold/printcraft/releases.evil/x", "javascript:alert(1)"] {+ let r = parse(r#"{"tag_name":"v0.2.0","html_url":"https://github.com/storytold/pdfcraft/releases/tag/v0.2.0"}"#).unwrap();+ assert_eq!(r, Release { version: "v0.2.0".into(), url: "https://github.com/storytold/pdfcraft/releases/tag/v0.2.0".into() });+ for elsewhere in ["https://example.com/pdfcraft.exe", "https://github.com/storytold/pdfcraft/releases.evil/x", "javascript:alert(1)"] {let r = parse(&format!(r#"{{"tag_name":"v9.9.9","html_url":"{elsewhere}"}}"#)).unwrap();assert_eq!(r.url, RELEASES_PAGE, "{elsewhere}");}@@ -61,12 +61,12 @@ mod tests {assert!(parse("<html>").is_err());}- /// Live: asks GitHub over TLS with the OS's roots (`cargo test -p printcraft -- --ignored`).+ /// Live: asks GitHub over TLS with the OS's roots (`cargo test -p pdfcraft -- --ignored`).#[test]#[ignore = "needs network access"]fn github_answers_with_the_latest_release() {let r = latest_release().unwrap();- assert!(printcraft_ui_egui::updates::is_newer(&r.version, "0.0.0"), "{r:?}");+ assert!(pdfcraft_ui_egui::updates::is_newer(&r.version, "0.0.0"), "{r:?}");assert!(r.url.starts_with(RELEASES_PAGE), "{r:?}");}}diff --git a/apps/printcraft-cli/Cargo.toml b/apps/printcraft-cli/Cargo.tomldeleted file mode 100644index 371c13283..000000000--- a/apps/printcraft-cli/Cargo.toml+++ /dev/null@@ -1,26 +0,0 @@-[package]-name = "printcraft-cli"-description = "PrintCraft command-line tool: inspect, render and robustness-check PDFs"-version.workspace = true-edition.workspace = true-license.workspace = true--[[bin]]-name = "printcraft-cli"-path = "src/main.rs"--[lints]-workspace = true--[dependencies]-printcraft-render = { workspace = true }-serde_json = { workspace = true }-printcraft-engine = { workspace = true }-printcraft-cos = { workspace = true }-printcraft-automation = { workspace = true }-base64 = "0.22"--[features]-default = ["mcp"]-# The opt-in MCP server (`printcraft-cli mcp`). Build with --no-default-features to leave it out.-mcp = ["printcraft-automation/mcp"]diff --git a/apps/printcraft/build.rs b/apps/printcraft/build.rsdeleted file mode 100644index 778cffc10..000000000--- a/apps/printcraft/build.rs+++ /dev/null@@ -1,29 +0,0 @@-//! Windows only: embed the app icon and version info (VERSIONINFO) into `printcraft.exe`, so it-//! shows in Explorer, the taskbar, the Start menu and Alt-Tab.-//!-//! On every other target this does nothing. A missing resource compiler is a warning, so a-//! cross-compile from macOS or Linux still links, unless `PRINTCRAFT_REQUIRE_WINRES=1` turns it-//! into an error (for release builds).--fn main() {- println!("cargo:rerun-if-changed=build.rs");- println!("cargo:rerun-if-changed=../../assets/app-icon/printcraft.ico");- println!("cargo:rerun-if-env-changed=PRINTCRAFT_REQUIRE_WINRES");- if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {- return;- }- let mut res = winresource::WindowsResource::new();- res.set_icon("../../assets/app-icon/printcraft.ico")- .set("ProductName", "PrintCraft")- .set("FileDescription", "PrintCraft PDF workbench")- .set("LegalCopyright", "Copyright (c) the PrintCraft contributors. MIT OR Apache-2.0.")- .set("OriginalFilename", "printcraft.exe")- .set("InternalName", "printcraft");- if let Err(e) = res.compile() {- if std::env::var_os("PRINTCRAFT_REQUIRE_WINRES").is_some() {- println!("cargo::error=embedding Windows resources failed: {e}");- return;- }- println!("cargo:warning=printcraft.exe built without icon/version resources: {e}");- }-}diff --git a/assets/app-icon/LICENSE.txt b/assets/app-icon/LICENSE.txtindex d472892a1..1480a31c5 100644--- a/assets/app-icon/LICENSE.txt+++ b/assets/app-icon/LICENSE.txt@@ -1,8 +1,8 @@-PrintCraft app icon (printcraft.svg, printcraft-small.svg and every file derived from them in this-directory: printcraft-1024.png, printcraft.icns, printcraft.ico, hicolor/).+PdfCraft app icon (pdfcraft.svg, pdfcraft-small.svg and every file derived from them in this+directory: pdfcraft-1024.png, pdfcraft.icns, pdfcraft.ico, hicolor/).Original artwork made for this project by the project owner, drawn in ArtCraft and vectorised for-PrintCraft (no third-party material). Licensed like the rest of PrintCraft, under either of+PdfCraft (no third-party material). Licensed like the rest of PdfCraft, under either of* Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0)* MIT license (https://opensource.org/licenses/MIT)diff --git a/assets/app-icon/README.md b/assets/app-icon/README.mdindex 208effe01..64eb9a30e 100644--- a/assets/app-icon/README.md+++ b/assets/app-icon/README.md@@ -1,6 +1,6 @@-# PrintCraft app icon+# PdfCraft app icon-<img src="printcraft-small.svg" alt="PrintCraft app icon: an engraved lion's head on green" width="128">+<img src="pdfcraft-small.svg" alt="PdfCraft app icon: an engraved lion's head on green" width="128">**Creature:** a lion, in a frontal head-and-shoulders portrait, mane running off the bottom of the tile.@@ -13,7 +13,7 @@ a full-bleed colour field, no frame or roundel, the animal looking at the viewer|---|---|---|| Ink | `#0b0b0c` | line work and the figure's contour || Paper | `#efe9dc` | the figure (the lion's silhouette) |-| PrintCraft green (app colour) | `#12a58a` | the full-bleed field |+| PdfCraft green (app colour) | `#12a58a` | the full-bleed field |**Tile:** `viewBox="0 0 512 512"`, a rounded square with `rx=112` that clips everything. Windows and Linuxicons use the full-bleed tile. macOS icons put it on Apple's grid (an 824 px body centred on a transparent@@ -21,23 +21,23 @@ icons use the full-bleed tile. macOS icons put it on Apple's grid (an 824 px bod**Provenance:** the project owner's original drawing, made in ArtCraft (2880 px, keyed to the palette), thenvectorised with craftrules `assets/logo-options/_tools/vectorize_tile.py` (potrace; no filtering or-warping). The source drawing is kept in craftrules at `assets/app-icons/printcraft/source.png`, not here.+warping). The source drawing is kept in craftrules at `assets/app-icons/pdfcraft/source.png`, not here.Licence: [LICENSE.txt](LICENSE.txt) (`MIT OR Apache-2.0`, like the repo).## Files| File | What it is ||---|---|-| `printcraft.svg` | the master vector (traced at 2048 px); every PNG, `.ico` and `.icns` is rendered from it |-| `printcraft-small.svg` | a lighter vector (traced at 1024 px) for places where size matters, such as this README |-| `printcraft-1024.png` | 1024 px on Apple's grid; also the runtime Dock icon on macOS |-| `printcraft.icns` | macOS icon (16–1024 px) |-| `printcraft.ico` | Windows icon (16–256 px), embedded in `printcraft.exe` by `apps/printcraft/build.rs` |-| `hicolor/<n>x<n>/apps/ai.storyteller.printcraft.png` | Linux hicolor theme, 16–512 px; the 256 px one is the runtime icon on Windows and Linux |-| `hicolor/scalable/apps/ai.storyteller.printcraft.svg` | Linux scalable icon (copy of the master) |--Where it shows: `apps/printcraft/src/main.rs` sets the window icon (Dock, taskbar, Alt-Tab, launcher) and the-Wayland app id `ai.storyteller.printcraft`; `packaging/linux/ai.storyteller.printcraft.desktop` names the+| `pdfcraft.svg` | the master vector (traced at 2048 px); every PNG, `.ico` and `.icns` is rendered from it |+| `pdfcraft-small.svg` | a lighter vector (traced at 1024 px) for places where size matters, such as this README |+| `pdfcraft-1024.png` | 1024 px on Apple's grid; also the runtime Dock icon on macOS |+| `pdfcraft.icns` | macOS icon (16–1024 px) |+| `pdfcraft.ico` | Windows icon (16–256 px), embedded in `pdfcraft.exe` by `apps/pdfcraft/build.rs` |+| `hicolor/<n>x<n>/apps/ai.storyteller.pdfcraft.png` | Linux hicolor theme, 16–512 px; the 256 px one is the runtime icon on Windows and Linux |+| `hicolor/scalable/apps/ai.storyteller.pdfcraft.svg` | Linux scalable icon (copy of the master) |++Where it shows: `apps/pdfcraft/src/main.rs` sets the window icon (Dock, taskbar, Alt-Tab, launcher) and the+Wayland app id `ai.storyteller.pdfcraft`; `packaging/linux/ai.storyteller.pdfcraft.desktop` names thehicolor icon.## Regeneratediff --git a/assets/app-icon/hicolor/128x128/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/128x128/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/128x128/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/128x128/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/16x16/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/16x16/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/16x16/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/16x16/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/24x24/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/24x24/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/24x24/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/24x24/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/256x256/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/256x256/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/256x256/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/256x256/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/32x32/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/32x32/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/32x32/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/32x32/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/48x48/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/48x48/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/48x48/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/48x48/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/512x512/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/512x512/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/512x512/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/512x512/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/64x64/apps/ai.storyteller.printcraft.png b/assets/app-icon/hicolor/64x64/apps/ai.storyteller.pdfcraft.pngsimilarity index 100%rename from assets/app-icon/hicolor/64x64/apps/ai.storyteller.printcraft.pngrename to assets/app-icon/hicolor/64x64/apps/ai.storyteller.pdfcraft.pngdiff --git a/assets/app-icon/hicolor/scalable/apps/ai.storyteller.printcraft.svg b/assets/app-icon/hicolor/scalable/apps/ai.storyteller.pdfcraft.svgsimilarity index 100%rename from assets/app-icon/hicolor/scalable/apps/ai.storyteller.printcraft.svgrename to assets/app-icon/hicolor/scalable/apps/ai.storyteller.pdfcraft.svgdiff --git a/assets/app-icon/printcraft-1024.png b/assets/app-icon/pdfcraft-1024.pngsimilarity index 100%rename from assets/app-icon/printcraft-1024.pngrename to assets/app-icon/pdfcraft-1024.pngdiff --git a/assets/app-icon/printcraft-small.svg b/assets/app-icon/pdfcraft-small.svgsimilarity index 100%rename from assets/app-icon/printcraft-small.svgrename to assets/app-icon/pdfcraft-small.svgdiff --git a/assets/app-icon/printcraft.icns b/assets/app-icon/pdfcraft.icnssimilarity index 100%rename from assets/app-icon/printcraft.icnsrename to assets/app-icon/pdfcraft.icnsdiff --git a/assets/app-icon/printcraft.ico b/assets/app-icon/pdfcraft.icosimilarity index 100%rename from assets/app-icon/printcraft.icorename to assets/app-icon/pdfcraft.icodiff --git a/assets/app-icon/printcraft.svg b/assets/app-icon/pdfcraft.svgsimilarity index 100%rename from assets/app-icon/printcraft.svgrename to assets/app-icon/pdfcraft.svgdiff --git a/assets/demo/README.md b/assets/demo/README.mdindex f68a9480e..30fda8ab3 100644--- a/assets/demo/README.md+++ b/assets/demo/README.md@@ -1,15 +1,15 @@-# PrintCraft showcase PDF+# PdfCraft showcase PDF`showcase.html` is the source of a 13-page, US Letter test document forviewing and rendering. The PDF is built on your machine and is not committed:```sh-cargo xtask demo-pdf # writes dist/demo/printcraft-showcase.pdf+cargo xtask demo-pdf # writes dist/demo/pdfcraft-showcase.pdfcargo xtask demo-pdf --chrome /path/to/chrome --out /tmp/showcase.pdf```You need Google Chrome, Chromium or Edge. The tool looks for it in the usual-install locations and on `PATH`, or uses `--chrome` or the `PRINTCRAFT_CHROME`+install locations and on `PATH`, or uses `--chrome` or the `PDFCRAFT_CHROME`environment variable if you set one.## How it is built@@ -27,7 +27,7 @@ environment variable if you set one.3. **Post-processing with `lopdf`** (`xtask/src/demo_pdf/`) adds what abrowser cannot emit:- **Annotations.** The HTML contains marker links to- `https://mark.printcraft.invalid/<kind>/<id>`. Chrome turns each one into+ `https://mark.pdfcraft.invalid/<kind>/<id>`. Chrome turns each one intoa Link annotation whose `/Rect` follows the layout. The xtask replaceseach marker with a real annotation: Highlight, Underline, StrikeOut,Squiggly, Caret, Text with Popup and a threaded reply and review state,@@ -75,4 +75,4 @@ count is not 12, because the post-processing uses fixed page indices.To check the result, look at the output of `pdfinfo`, `pdffonts` and`qpdf --check`, and render the pages with-`pdftoppm -r 60 -png dist/demo/printcraft-showcase.pdf /tmp/showcase`.+`pdftoppm -r 60 -png dist/demo/pdfcraft-showcase.pdf /tmp/showcase`.diff --git a/assets/demo/showcase-data.csv b/assets/demo/showcase-data.csvindex 2ae4f4ad4..59d52864b 100644--- a/assets/demo/showcase-data.csv+++ b/assets/demo/showcase-data.csv@@ -1,4 +1,4 @@-# Illustrative sample data behind the charts on page 7 of the PrintCraft showcase.+# Illustrative sample data behind the charts on page 7 of the PdfCraft showcase.# These are made-up numbers for demonstration, not measurements.chart,series,label,valuepages_per_second,throughput,Text,189diff --git a/assets/demo/showcase.html b/assets/demo/showcase.htmlindex 924557eca..267e56a56 100644--- a/assets/demo/showcase.html+++ b/assets/demo/showcase.html@@ -2,14 +2,14 @@<html lang="en"><head><meta charset="utf-8">-<title>PrintCraft Showcase</title>+<title>PdfCraft Showcase</title><!--- PrintCraft Showcase: source for `cargo xtask demo-pdf`.- All prose in this file is original to the PrintCraft project.+ PdfCraft Showcase: source for `cargo xtask demo-pdf`.+ All prose in this file is original to the PdfCraft project.Placeholders substituted by the xtask:{{ASSETS}} file:// URL of the repository's assets/ directory{{MANDELBROT_PNG}} data: URI of a procedurally generated PNG- Links to https://mark.printcraft.invalid/<kind>/<id> are *markers*: the xtask+ Links to https://mark.pdfcraft.invalid/<kind>/<id> are *markers*: the xtaskconverts the link rectangles Chrome emits for them into real PDF annotations(highlight, sticky note, stamp, ...), so annotation geometry follows the layout.-->@@ -351,7 +351,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<div class="grad">A tour of the page, glyph by glyph.</div><p class="sub">Typography, world scripts, vector graphics, mathematics, forms and annotations — gathered in one document to put a PDF engine through its paces.</p><div class="meta">- <div><strong>PrintCraft</strong><br>Open-source PDF toolkit in Rust</div>+ <div><strong>PdfCraft</strong><br>Open-source PDF toolkit in Rust</div><div style="text-align:right">Generated by <span style="font-family:var(--mono)">cargo xtask demo-pdf</span><br>US Letter · 8.5 × 11 in</div></div></div>@@ -359,7 +359,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 2. CONTENTS ============================ --><section class="page" id="contents">- <div class="runhead"><span>PrintCraft Showcase</span><span>Contents</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>Contents</span></div><div class="kicker">Inside this specimen</div><h2 class="sec">Contents</h2><ol class="toc">@@ -378,19 +378,19 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<div><h4>Colophon</h4>Body text is set in EB Garamond with Playfair Display for display, Inter for labels, and JetBrains Mono for code. Every font is openly licensed (OFL) and listed in ATTRIBUTION.md. Layout is authored in HTML and CSS, printed by headless Chrome, then post-processed with <span style="font-family:var(--mono)">lopdf</span>.</div><div><h4>What to look for</h4>Open the bookmarks, layers, attachments and comments panels. Page labels run Cover, i–ii, then 1–10. One layer adds a draft watermark; another holds print-only notes and starts hidden.</div></div>- <div class="folio"><span>PrintCraft Showcase</span><b>i</b></div>+ <div class="folio"><span>PdfCraft Showcase</span><b>i</b></div></section><!-- ============================ 3. FOREWORD ============================ --><section class="page foreword" id="foreword">- <div class="runhead"><span>PrintCraft Showcase</span><span>Foreword</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>Foreword</span></div><div class="kicker">Foreword</div><h2 class="sec">Why a <em>specimen?</em></h2><p class="lead">A PDF reader is judged in the first second. The page appears, and either the letters sit on it the way the author intended or they do not. Every kerning pair, every ligature and every soft gradient is a small promise the file makes and the renderer must keep.</p>- <p>This document collects those promises in one place. It was written for the people who build PrintCraft, as a single file to open after every change: if all of it still looks right, the change is probably safe. It is also, we hope, pleasant to read on its own.</p>+ <p>This document collects those promises in one place. It was written for the people who build PdfCraft, as a single file to open after every change: if all of it still looks right, the change is probably safe. It is also, we hope, pleasant to read on its own.</p><p>Nothing here is exotic. Each feature is something ordinary documents use every day — an invoice with a form field, a thesis full of equations, a contract with comments in the margin, a brochure with a translucent photograph laid over a tinted panel. What is unusual is only that they are all together, and that each page says plainly what it is testing.</p><p>The layout is authored in HTML and printed by a browser; the interactive parts are then written into the file by hand, object by object. That split mirrors the real world, where most PDFs are produced by one program and amended by several others.</p>- <div class="signoff">The PrintCraft contributors</div>+ <div class="signoff">The PdfCraft contributors</div><h3>Tracking, from tight to airy</h3><div class="tracking">@@ -413,12 +413,12 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 4. SETTING TEXT ============================ --><section class="page" id="setting">- <div class="runhead"><span>PrintCraft Showcase</span><span>1 · Setting Text</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>1 · Setting Text</span></div><div class="kicker">Chapter one</div><h2 class="sec" id="h-setting">Setting <em>Text</em></h2><p class="dek">Two justified columns with automatic hyphenation, old-style figures, a drop cap and a pull quote — the everyday machinery of a well-made page.</p><div class="cols">- <p class="first">Long before there were screens, a page of type was a negotiation between the width of a column and the length of the words that had to fill it. The compositor adjusted spaces, divided a word at a sensible syllable, and occasionally rewrote a line so the paragraph would lie flat. Justified text asks for exactly that care, and a renderer must <a class="mk" href="https://mark.printcraft.invalid/highlight/body">honour the spacing</a> it was given.<sup class="fn">1</sup></p>+ <p class="first">Long before there were screens, a page of type was a negotiation between the width of a column and the length of the words that had to fill it. The compositor adjusted spaces, divided a word at a sensible syllable, and occasionally rewrote a line so the paragraph would lie flat. Justified text asks for exactly that care, and a renderer must <a class="mk" href="https://mark.pdfcraft.invalid/highlight/body">honour the spacing</a> it was given.<sup class="fn">1</sup></p><p>A PDF does not reflow. Every glyph has already been placed by the program that wrote the file, and the reader’s job is to reproduce those positions faithfully at any zoom. That sounds simple until one remembers that a single line may mix three fonts, a ligature standing in for two letters, and a hyphen that exists only because the line happened to break there in 1994 or 2026.</p><p>Old-style figures, like the ones in this paragraph’s 1,280 characters and 36 lines, rise and fall with the lowercase so that numbers do not shout. Ligatures such as <i>fi</i>, <i>fl</i> and <i>ffi</i> in words like <i>officially</i>, <i>affluent</i> and <i>afflicted</i> join letters that would otherwise collide.<sup class="fn">2</sup></p><div class="pull">“Good typography is noticed only when it is missing.”<cite>A working maxim of the trade</cite></div>@@ -437,7 +437,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 5. OPENTYPE ============================ --><section class="page" id="opentype">- <div class="runhead"><span>PrintCraft Showcase</span><span>2 · OpenType Features</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>2 · OpenType Features</span></div><div class="kicker">Chapter two</div><h2 class="sec" id="h-opentype">OpenType <em>Features</em></h2><p class="dek">Each row shows the same text with a feature off, then on. The glyphs differ; the underlying characters do not.</p>@@ -476,7 +476,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 6. EXPRESSIVE ============================ --><section class="page" id="expressive">- <div class="runhead"><span>PrintCraft Showcase</span><span>3 · Expressive Type</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>3 · Expressive Type</span></div><div class="kicker">Chapter three</div><h2 class="sec" id="h-expressive">Expressive <em>Type</em></h2><p class="dek">Effects that become transparency groups, soft masks, clipping paths and transformed text objects once they reach PDF.</p>@@ -513,7 +513,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 7. SCRIPTS ============================ --><section class="page" id="scripts">- <div class="runhead"><span>PrintCraft Showcase</span><span>4 · Scripts of the World</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>4 · Scripts of the World</span></div><div class="kicker">Chapter four</div><h2 class="sec" id="h-scripts">Scripts of the <em>World</em></h2><p class="dek">A short greeting — roughly, “every letter deserves a good home” — in writing systems that need bidirectional layout, contextual shaping, reordering and vertical setting.</p>@@ -551,7 +551,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 8. MATH ============================ --><section class="page" id="math">- <div class="runhead"><span>PrintCraft Showcase</span><span>5 · Mathematics</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>5 · Mathematics</span></div><div class="kicker">Chapter five</div><h2 class="sec" id="h-math"><em>Mathematics</em></h2><p class="dek">Equations written in MathML Core and laid out by the browser: stretchy delimiters, radicals, large operators, scripts and matrices.</p>@@ -592,7 +592,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 9. VECTOR ============================ --><section class="page" id="vector">- <div class="runhead"><span>PrintCraft Showcase</span><span>6 · Vector Graphics</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>6 · Vector Graphics</span></div><div class="kicker">Chapter six</div><h2 class="sec" id="h-vector">Vector <em>Graphics</em></h2><p class="dek">Nine small plates, each exercising one piece of the PDF imaging model.</p>@@ -652,7 +652,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 10. DATA ============================ --><section class="page" id="data">- <div class="runhead"><span>PrintCraft Showcase</span><span>7 · Data & Tables</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>7 · Data & Tables</span></div><div class="kicker">Chapter seven</div><h2 class="sec" id="h-data">Data & <em>Tables</em></h2><p class="dek">Charts drawn as SVG and a striped table. All figures are illustrative sample data, not measurements.</p>@@ -731,7 +731,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 11. CODE ============================ --><section class="page" id="code">- <div class="runhead"><span>PrintCraft Showcase</span><span>8 · Code & Images</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>8 · Code & Images</span></div><div class="kicker">Chapter eight</div><h2 class="sec" id="h-code">Code & <em>Images</em></h2><p class="dek">A monospaced listing with syntax colouring, and the raster that it describes.</p>@@ -761,7 +761,7 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<h3>Links</h3><ul class="links" style="padding-left:14pt;margin:0;font-size:10pt"><li>External: <a href="https://example.com/">https://example.com/</a></li>- <li>External: <a href="https://example.org/printcraft">example.org/printcraft</a></li>+ <li>External: <a href="https://example.org/pdfcraft">example.org/pdfcraft</a></li><li>Internal: back to <a href="#contents">the contents</a> or ahead to <a href="#review">review & markup</a></li></ul></div>@@ -771,15 +771,15 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;<!-- ============================ 12. REVIEW ============================ --><section class="page" id="review">- <div class="runhead"><span>PrintCraft Showcase</span><span>9 · Review & Markup</span></div>+ <div class="runhead"><span>PdfCraft Showcase</span><span>9 · Review & Markup</span></div><div class="kicker">Chapter nine</div><h2 class="sec" id="h-review">Review & <em>Markup</em></h2><p class="dek">Every annotation on this page was added after printing, each with its own appearance stream, author, date and unique name.</p><div class="review"><div><h3 style="margin-top:0">Text markup</h3>- <p>Reviewers rarely rewrite a document; they <a class="mk" href="https://mark.printcraft.invalid/highlight/review">highlight the phrase that matters</a>, <a class="mk" href="https://mark.printcraft.invalid/underline/review">underline a claim that needs a source</a>, and <a class="mk" href="https://mark.printcraft.invalid/strikeout/review">strike out a redundant word</a> before moving on.</p>- <p>A wavy line says <a class="mk" href="https://mark.printcraft.invalid/squiggly/review">check the spelling here</a>, while a caret marks where text should<a class="mk" href="https://mark.printcraft.invalid/caret/review"> </a>be inserted.</p>+ <p>Reviewers rarely rewrite a document; they <a class="mk" href="https://mark.pdfcraft.invalid/highlight/review">highlight the phrase that matters</a>, <a class="mk" href="https://mark.pdfcraft.invalid/underline/review">underline a claim that needs a source</a>, and <a class="mk" href="https://mark.pdfcraft.invalid/strikeout/review">strike out a redundant word</a> before moving on.</p>+ <p>A wavy line says <a class="mk" href="https://mark.pdfcraft.invalid/squiggly/review">check the spelling here</a>, while a caret marks where text should<a class="mk" href="https://mark.pdfcraft.invalid/caret/review"> </a>be inserted.</p><h3>Comments</h3><p>Sticky notes carry threaded replies, and a free-text box writes directly on the page. The paperclip holds an attached file that can be saved from the comment itself.</p><h3>Legend</h3>@@ -789,16 +789,16 @@ a.box { position: absolute; display: block; color: transparent; font-size: 1pt;</div><div class="canvas"><span class="lab" style="left:10pt;top:8pt">Review canvas</span>- <a class="box" style="left:12pt;top:26pt;width:152pt;height:40pt" href="https://mark.printcraft.invalid/freetext/1">.</a>- <a class="box" style="left:196pt;top:22pt;width:20pt;height:20pt" href="https://mark.printcraft.invalid/note/1">.</a>- <a class="box" style="left:196pt;top:60pt;width:18pt;height:22pt" href="https://mark.printcraft.invalid/attach/1">.</a>- <a class="box" style="left:16pt;top:88pt;width:90pt;height:60pt" href="https://mark.printcraft.invalid/square/1">.</a>- <a class="box" style="left:120pt;top:92pt;width:90pt;height:60pt" href="https://mark.printcraft.invalid/circle/1">.</a>- <a class="box" style="left:16pt;top:170pt;width:94pt;height:80pt" href="https://mark.printcraft.invalid/polygon/1">.</a>- <a class="box" style="left:120pt;top:170pt;width:96pt;height:80pt" href="https://mark.printcraft.invalid/polyline/1">.</a>- <a class="box" style="left:16pt;top:268pt;width:196pt;height:40pt" href="https://mark.printcraft.invalid/line/1">.</a>- <a class="box" style="left:16pt;top:322pt;width:196pt;height:50pt" href="https://mark.printcraft.invalid/ink/1">.</a>- <a class="box" style="left:30pt;top:388pt;width:170pt;height:56pt" href="https://mark.printcraft.invalid/stamp/1">.</a>+ <a class="box" style="left:12pt;top:26pt;width:152pt;height:40pt" href="https://mark.pdfcraft.invalid/freetext/1">.</a>+ <a class="box" style="left:196pt;top:22pt;width:20pt;height:20pt" href="https://mark.pdfcraft.invalid/note/1">.</a>+ <a class="box" style="left:196pt;top:60pt;width:18pt;height:22pt" href="https://mark.pdfcraft.invalid/attach/1">.</a>+ <a class="box" style="left:16pt;top:88pt;width:90pt;height:60pt" href="https://mark.pdfcraft.invalid/square/1">.</a>+ <a class="box" style="left:120pt;top:92pt;width:90pt;height:60pt" href="https://mark.pdfcraft.invalid/circle/1">.</a>+ <a class="box" style="left:16pt;top:170pt;width:94pt;height:80pt" href="https://mark.pdfcraft.invalid/polygon/1">.</a>+ <a class="box" style="left:120pt;top:170pt;width:96pt;height:80pt" href="https://mark.pdfcraft.invalid/polyline/1">.</a>+ <a class="box" style="left:16pt;top:268pt;width:196pt;height:40pt" href="https://mark.pdfcraft.invalid/line/1">.</a>+ <a class="box" style="left:16pt;top:322pt;width:196pt;height:50pt" href="https://mark.pdfcraft.invalid/ink/1">.</a>+ <a class="box" style="left:30pt;top:388pt;width:170pt;height:56pt" href="https://mark.pdfcraft.invalid/stamp/1">.</a></div></div><div class="folio"><span>Review & Markup</span><b>9</b></div>diff --git a/crates/a11y/Cargo.toml b/crates/a11y/Cargo.tomlindex 47a958bde..a5900e54b 100644--- a/crates/a11y/Cargo.toml+++ b/crates/a11y/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-a11y"+name = "pdfcraft-a11y"description = "Accessibility: the Accessibility Checker (32 rules), its report and fixes"version.workspace = trueedition.workspace = true@@ -11,7 +11,7 @@ repository.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-model = { workspace = true }-printcraft-content = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-model = { workspace = true }+pdfcraft-content = { workspace = true }thiserror.workspace = truediff --git a/crates/a11y/README.md b/crates/a11y/README.mdindex be85efd6d..f00f429b8 100644--- a/crates/a11y/README.md+++ b/crates/a11y/README.md@@ -1,4 +1,4 @@-# printcraft-a11y+# pdfcraft-a11yLayer L4: accessibility (execution plan M12.3). Today: the Accessibility Checker's full check.diff --git a/crates/a11y/src/alt.rs b/crates/a11y/src/alt.rsindex 653a3a5a9..95e272d3d 100644--- a/crates/a11y/src/alt.rs+++ b/crates/a11y/src/alt.rs@@ -3,8 +3,8 @@use std::collections::{HashMap, HashSet};-use printcraft_content::Matrix;-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};+use pdfcraft_content::Matrix;+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};/// A Figure element (after the role map).#[derive(Clone, Debug, PartialEq)]@@ -24,7 +24,7 @@ pub enum AltError {#[error("object {0} is not a figure")]NotAFigure(u32),#[error("{0}")]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}fn tree_root(doc: &Document) -> Option<Dict> {@@ -139,7 +139,7 @@ fn content_bbox(doc: &Document, page: &Dict, ids: &HashSet<i64>) -> Option<[f64;let mut marks: Vec<bool> = Vec::new();let mut bbox = None;let mut path: Vec<(f64, f64)> = Vec::new();- for op in printcraft_content::parse(&page_content(doc, page)).ops {+ for op in pdfcraft_content::parse(&page_content(doc, page)).ops {let inside = marks.iter().any(|m| *m);let top = ctm.last().copied().unwrap_or(Matrix([1.0, 0.0, 0.0, 1.0, 0.0, 0.0]));match op.op.as_slice() {@@ -216,7 +216,7 @@ fn content_bbox(doc: &Document, page: &Dict, ids: &HashSet<i64>) -> Option<[f64;pub fn figures(doc: &Document) -> Vec<Figure> {let Some(root) = tree_root(doc) else { return Vec::new() };let role_map = root.get(b"RoleMap").map(|o| doc.resolve(o)).and_then(|o| o.as_dict().cloned()).unwrap_or_default();- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);let index: HashMap<ObjRef, usize> = pages.iter().enumerate().map(|(i, p)| (p.obj, i)).collect();elements(doc).into_iter()@@ -259,21 +259,21 @@ pub fn set_alt(doc: &mut Document, obj: ObjRef, alt: Option<&str>) -> Result<(),pub fn mark_decorative(doc: &mut Document, obj: ObjRef) -> Result<(), AltError> {let d = check_figure(doc, obj)?;let ids: HashSet<i64> = mcids(&d).into_iter().collect();- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);let pg = d.get(b"Pg").and_then(Object::as_ref).or_else(|| elements(doc).into_iter().find(|(r, _, _)| *r == obj).and_then(|(_, _, p)| p));if let Some(page) = pg.and_then(|p| pages.iter().find(|x| x.obj == p)).filter(|_| !ids.is_empty()) {- let mut ops = printcraft_content::parse(&page_content(doc, &page.dict)).ops;+ let mut ops = pdfcraft_content::parse(&page_content(doc, &page.dict)).ops;let mut changed = false;for op in ops.iter_mut() {let ours = op.op == b"BDC"&& matches!(op.operands.get(1), Some(Object::Dict(m)) if m.get(b"MCID").and_then(Object::as_int).is_some_and(|n| ids.contains(&n)));if ours {- *op = printcraft_content::Op::new("BMC", vec![Object::name("Artifact")]);+ *op = pdfcraft_content::Op::new("BMC", vec![Object::name("Artifact")]);changed = true;}}if changed {- let s = doc.add(Object::Stream(Stream::flate(Dict::new(), &printcraft_content::serialize_ops(&ops))));+ let s = doc.add(Object::Stream(Stream::flate(Dict::new(), &pdfcraft_content::serialize_ops(&ops))));doc.update_dict(page.obj, |p| p.set(b"Contents".to_vec(), Object::Ref(s)))?;// The parent tree no longer points those ids at the figure.if let Some(key) = page.dict.get(b"StructParents").and_then(Object::as_int) {diff --git a/crates/a11y/src/content.rs b/crates/a11y/src/content.rsindex 22373e887..2c6a100ef 100644--- a/crates/a11y/src/content.rs+++ b/crates/a11y/src/content.rs@@ -3,8 +3,8 @@use std::collections::{BTreeMap, BTreeSet, HashSet};-use printcraft_cos::{Dict, Document, ObjRef, Object};-use printcraft_model::Page;+use pdfcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_model::Page;use crate::structure::Tree;use crate::{Finding, Rule};@@ -73,7 +73,7 @@ impl Walk<'_> {// Marked-content stack: whether each level is tagged or an artifact.let mut stack: Vec<bool> = Vec::new();let mut untagged = 0;- for op in printcraft_content::parse(data).ops {+ for op in pdfcraft_content::parse(data).ops {let inside = covered || stack.last().copied().unwrap_or(false);match op.op.as_slice() {b"BMC" => stack.push(inside || op.name(0) == Some(b"Artifact")),diff --git a/crates/a11y/src/lib.rs b/crates/a11y/src/lib.rsindex 281fa1c5a..550b4e6ab 100644--- a/crates/a11y/src/lib.rs+++ b/crates/a11y/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-a11y — accessibility (L4): the Accessibility Checker's full check.+//! pdfcraft-a11y — accessibility (L4): the Accessibility Checker's full check.//!//! [`check`] runs the 32 rules in Acrobat's seven categories (Document, Page Content, Forms,//! Alternate Text, Tables, Lists, Headings) and returns, per rule, Passed, Failed, Needs manual@@ -10,7 +10,7 @@use std::collections::BTreeSet;-use printcraft_cos::Document;+use pdfcraft_cos::Document;mod alt;mod content;@@ -458,7 +458,7 @@ const MAX_FINDINGS: usize = 200;/// Run the full check.pub fn check(doc: &Document, options: &Options) -> Report {- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);let page_list: Vec<usize> = match &options.pages {Some(p) => p.iter().copied().filter(|p| *p < pages.len()).collect(),None => (0..pages.len()).collect(),diff --git a/crates/a11y/src/structure.rs b/crates/a11y/src/structure.rsindex d46e5fc99..9f9783613 100644--- a/crates/a11y/src/structure.rs+++ b/crates/a11y/src/structure.rs@@ -3,8 +3,8 @@use std::collections::{HashMap, HashSet};-use printcraft_cos::{Dict, Document, ObjRef, Object};-use printcraft_model::Page;+use pdfcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_model::Page;use crate::{Finding, Rule};diff --git a/crates/a11y/src/tests.rs b/crates/a11y/src/tests.rsindex 0131d9245..3534eeb1f 100644--- a/crates/a11y/src/tests.rs+++ b/crates/a11y/src/tests.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use printcraft_cos::Document;+use pdfcraft_cos::Document;use super::*;@@ -265,7 +265,7 @@ fn setting_alt_text_and_marking_decorative() {assert_eq!(r.result(Rule::FiguresAltText).unwrap().status, Status::Passed);set_alt(&mut doc, f[0].obj, None).unwrap();assert_eq!(figures(&doc)[0].alt, None);- assert_eq!(set_alt(&mut doc, printcraft_cos::ObjRef::new(6, 0), Some("x")), Err(AltError::NotAFigure(6)));+ assert_eq!(set_alt(&mut doc, pdfcraft_cos::ObjRef::new(6, 0), Some("x")), Err(AltError::NotAFigure(6)));// Decorative: the figure leaves the tags and its content becomes an artifact.mark_decorative(&mut doc, f[0].obj).unwrap();let left = figures(&doc);@@ -273,9 +273,9 @@ fn setting_alt_text_and_marking_decorative() {assert_eq!(left[0].alt.as_deref(), Some("A bar"));let r = check(&doc, &Options { rules: [Rule::FiguresAltText, Rule::TaggedContent].into(), pages: None });assert_eq!(failed(&r), Vec::<Rule>::new(), "{:?}", r.results);- let pages = printcraft_model::pages(&doc);+ let pages = pdfcraft_model::pages(&doc);let c = doc.resolve(pages[0].dict.get(b"Contents").unwrap());- let printcraft_cos::Object::Stream(c) = &*c else { panic!("one content stream") };+ let pdfcraft_cos::Object::Stream(c) = &*c else { panic!("one content stream") };let text = String::from_utf8(c.decoded().unwrap()).unwrap();assert!(text.contains("/Artifact BMC") && !text.contains("/MCID 0"), "{text}");}diff --git a/crates/annot/Cargo.toml b/crates/annot/Cargo.tomlindex 36b75bbdd..9603e5722 100644--- a/crates/annot/Cargo.toml+++ b/crates/annot/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-annot"+name = "pdfcraft-annot"description = "Annotations (comments): builders, appearance streams and edits, ISO 32000-2 §12.5"version.workspace = trueedition.workspace = true@@ -9,8 +9,8 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-fonts = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-fonts = { workspace = true }thiserror = { workspace = true }[dev-dependencies]diff --git a/crates/annot/README.md b/crates/annot/README.mdindex 85d83065a..b3224b7bf 100644--- a/crates/annot/README.md+++ b/crates/annot/README.md@@ -1,6 +1,6 @@-# printcraft-annot+# pdfcraft-annot-Comments (annotations), ISO 32000-2 §12.5. Layer L3, depends only on `printcraft-cos`.+Comments (annotations), ISO 32000-2 §12.5. Layer L3, depends only on `pdfcraft-cos`.## What it does@@ -9,7 +9,7 @@ Comments (annotations), ISO 32000-2 §12.5. Layer L3, depends only on `printcrafline and arrow (`Line` with `/LE`), freehand drawing (`Ink`) and text box (`FreeText`).- **Appearance streams** (`appearance::build`) generated from the annotation dictionary, so newand restyled comments look the same in every viewer. Highlights multiply (`/BM /Multiply`).- Note icons are PrintCraft's own drawings. Text boxes use standard Helvetica (WinAnsi), with+ Note icons are PdfCraft's own drawings. Text boxes use standard Helvetica (WinAnsi), withline breaking by approximate Helvetica proportions (no font program is bundled).- **Edits:** reply (`/IRT`), set review status (a `/State` reply, as Acrobat's "Set status"does), change text, move, resize, restyle, delete (with pop-up and replies).@@ -26,7 +26,7 @@ delete_annotation(&mut doc, page, index)?;```A comment is addressed by `(page, index in /Annots)`, the same pair-`printcraft_render::Annotation` reports. `Meta` carries the date and the `/NM` id so edits stay+`pdfcraft_render::Annotation` reports. `Meta` carries the date and the `/NM` id so edits staydeterministic; the engine supplies them.## Fidelity rulesdiff --git a/crates/annot/src/appearance.rs b/crates/annot/src/appearance.rsindex 3397f4297..ee51446b7 100644--- a/crates/annot/src/appearance.rs+++ b/crates/annot/src/appearance.rs@@ -1,4 +1,4 @@-//! Appearance streams (§12.5.5) for the comment types PrintCraft creates, execution plan M5.2.+//! Appearance streams (§12.5.5) for the comment types PdfCraft creates, execution plan M5.2.//!//! [`build`] draws a normal appearance (`/AP /N`) from the annotation dictionary alone, so the//! same code serves new comments and restyled ones. Drawings are in page space with@@ -6,13 +6,13 @@//! It returns `None` for anything it cannot draw faithfully (cloudy borders, unknown line//! endings, indirect geometry), so callers never replace an appearance with a worse one.//!-//! The note icons are PrintCraft's own drawings (AGENTS.md §1). Text boxes use the standard+//! The note icons are PdfCraft's own drawings (AGENTS.md §1). Text boxes use the standard//! Helvetica font with WinAnsi encoding; line breaking uses [`text_width`], an approximation of//! Helvetica's proportions by character class (no font program or metrics file is bundled).-use printcraft_cos::{Dict, Object, PdfString, Stream};-pub use printcraft_fonts::{helvetica_width as text_width, wrap};-use printcraft_fonts::{literal, win_ansi};+use pdfcraft_cos::{Dict, Object, PdfString, Stream};+pub use pdfcraft_fonts::{helvetica_width as text_width, wrap};+use pdfcraft_fonts::{literal, win_ansi};use crate::{NOTE_SIZE, Rgb, n};@@ -435,7 +435,7 @@ pub fn build(d: &Dict) -> Option<Stream> {res.set(b"XObject".to_vec(), Object::Dict(xo));return Some(form(rect, c.as_bytes(), res));}- // Only PrintCraft's own Fill & Sign marks are drawn here.+ // Only PdfCraft's own Fill & Sign marks are drawn here.let name = d.name(b"Name")?;let col = stroke.unwrap_or([0.0; 3]);let [x0, y0, x1, y1] = rect;@@ -482,7 +482,7 @@ pub fn build(d: &Dict) -> Option<Stream> {n(y0 + h / 2.0))),other => {- // Only stamps PrintCraft made: others keep their own artwork.+ // Only stamps PdfCraft made: others keep their own artwork.if !matches!(d.get(b"PCStamp"), Some(Object::Bool(true))) {return None;}@@ -727,9 +727,9 @@ fn ellipse(x0: f64, y0: f64, x1: f64, y1: f64) -> String {s}-/// PrintCraft's note icons, drawn in a 20 × 20 box: a speech bubble for `/Comment`, a page+/// PdfCraft's note icons, drawn in a 20 × 20 box: a speech bubble for `/Comment`, a page/// with a folded corner for everything else, both filled with the note colour.-/// File attachment icons in a 20 × 20 box: PrintCraft's own drawings.+/// File attachment icons in a 20 × 20 box: PdfCraft's own drawings.fn attach_icon(name: &str, col: Rgb) -> String {let mut s = format!("{}{}1.2 w 1 j 1 J\n", rg(col), rg_stroke(col));match name {diff --git a/crates/annot/src/lib.rs b/crates/annot/src/lib.rsindex 0c5350a36..a0f763064 100644--- a/crates/annot/src/lib.rs+++ b/crates/annot/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-annot — comments (annotations), ISO 32000-2 §12.5, execution plan M5.1–M5.3.+//! pdfcraft-annot — comments (annotations), ISO 32000-2 §12.5, execution plan M5.1–M5.3.//!//! Builders for the comment types Acrobat's commenting tools create (sticky note, highlight,//! underline, strikethrough, squiggly, rectangle, oval, line/arrow, freehand ink, text box),@@ -6,15 +6,15 @@//! change its text, recolour, move, resize and delete.//!//! Addressing: a comment is `(page, index)`, its position in the page's `/Annots` array, which-//! is what `printcraft_render::Annotation::index` reports. Inline annotation dictionaries are+//! is what `pdfcraft_render::Annotation::index` reports. Inline annotation dictionaries are//! promoted to indirect objects when they are edited (replies need a reference to point at).//!-//! Every edit mutates a `printcraft_cos::Document` (copy-on-write); callers snapshot it first+//! Every edit mutates a `pdfcraft_cos::Document` (copy-on-write); callers snapshot it first//! for undo. Keys we do not understand are left alone.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};pub mod appearance;pub mod links;@@ -35,7 +35,7 @@ pub enum AnnotError {#[error("{0} comments can't be restyled yet (their appearance can't be regenerated)")]Unsupported(String),#[error("{0}")]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}pub type Rgb = [f64; 3];@@ -101,7 +101,7 @@ pub enum FillMark {}impl FillMark {- /// The `/Name` of the stamp PrintCraft draws for it.+ /// The `/Name` of the stamp PdfCraft draws for it.pub fn name(self) -> &'static str {match self {FillMark::Check => "PCCheck",@@ -121,7 +121,7 @@ impl FillMark {}}-/// The stamps of Acrobat's stamp palette (drawn in PrintCraft's own style).+/// The stamps of Acrobat's stamp palette (drawn in PdfCraft's own style).#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]pub enum StampKind {// Standard business.@@ -921,7 +921,7 @@ pub fn add_annotation(doc: &mut Document, new: &NewAnnotation, meta: &Meta) -> RShape::Stamp { stamp, by, .. } => {d.set(b"C".to_vec(), rgb(style.color));d.set(b"Name".to_vec(), Object::name(stamp.name()));- // Marks the stamp as drawn by PrintCraft: other stamps with standard names keep+ // Marks the stamp as drawn by PdfCraft: other stamps with standard names keep// their own artwork.d.set(b"PCStamp".to_vec(), Object::Bool(true));if let Some(b) = by {@@ -987,7 +987,7 @@ pub fn add_annotation(doc: &mut Document, new: &NewAnnotation, meta: &Meta) -> Rlet mut ef = Dict::new();ef.set(b"Type".to_vec(), Object::name("EmbeddedFile"));ef.set(b"Params".to_vec(), Object::Dict(params));- let ef = doc.add(Object::Stream(printcraft_cos::Stream::flate(ef, data)));+ let ef = doc.add(Object::Stream(pdfcraft_cos::Stream::flate(ef, data)));let mut efd = Dict::new();efd.set(b"F".to_vec(), Object::Ref(ef));efd.set(b"UF".to_vec(), Object::Ref(ef));@@ -1255,7 +1255,7 @@ fn reply(fd.set(b"Type".to_vec(), Object::name("XObject"));fd.set(b"Subtype".to_vec(), Object::name("Form"));fd.set(b"BBox".to_vec(), num_array(&[0.0, 0.0, 0.0, 0.0]));- let ap = doc.add(Object::Stream(printcraft_cos::Stream::from_raw(fd, Vec::new())));+ let ap = doc.add(Object::Stream(pdfcraft_cos::Stream::from_raw(fd, Vec::new())));let mut apd = Dict::new();apd.set(b"N".to_vec(), Object::Ref(ap));d.set(b"AP".to_vec(), Object::Dict(apd));@@ -1460,7 +1460,7 @@ pub fn set_style(// ── reading ─────────────────────────────────────────────────────────────────────────────────/// One comment as the viewer lists it (the same fields and rules as-/// `printcraft_render::Annotation`), read straight from the object graph. The engine uses it to+/// `pdfcraft_render::Annotation`), read straight from the object graph. The engine uses it to/// refresh the comment list after a comment edit without re-inspecting the whole document.#[derive(Clone, Debug, PartialEq)]pub struct Summary {diff --git a/crates/annot/src/links.rs b/crates/annot/src/links.rsindex 70ab267f7..3d8d6d4d1 100644--- a/crates/annot/src/links.rs+++ b/crates/annot/src/links.rs@@ -1,7 +1,7 @@//! Links (ISO 32000-2 §12.5.6.5): create, edit and remove link annotations with Acrobat's Link//! Properties (appearance and a go-to-page or open-a-web-page action).-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};use crate::{AnnotError, annots, page_ref, page_refs, set_annots};@@ -11,7 +11,7 @@ pub enum LinkAction {/// A page of this document (0-based), shown fitting the window (`/Fit`).Page(usize),Uri(String),- /// Something PrintCraft doesn't edit yet (named destination, JavaScript…): kept as is.+ /// Something PdfCraft doesn't edit yet (named destination, JavaScript…): kept as is.Other(String),}diff --git a/crates/annot/src/tests.rs b/crates/annot/src/tests.rsindex c1b7929f5..afcee4bb4 100644--- a/crates/annot/src/tests.rs+++ b/crates/annot/src/tests.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use printcraft_cos::{Document, ObjRef, Object, SaveOptions, write_incremental};+use pdfcraft_cos::{Document, ObjRef, Object, SaveOptions, write_incremental};use super::*;diff --git a/crates/automation/Cargo.toml b/crates/automation/Cargo.tomlindex 7d59e1526..1033ab289 100644--- a/crates/automation/Cargo.toml+++ b/crates/automation/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft-automation"-description = "Agent control for PrintCraft: a headless tool set over the engine and an MCP server"+name = "pdfcraft-automation"+description = "Agent control for PdfCraft: a headless tool set over the engine and an MCP server"version.workspace = trueedition.workspace = truelicense.workspace = true@@ -9,9 +9,9 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-engine = { workspace = true }-printcraft-render = { workspace = true }-printcraft-organize = { workspace = true }+pdfcraft-engine = { workspace = true }+pdfcraft-render = { workspace = true }+pdfcraft-organize = { workspace = true }serde_json = { workspace = true }png = "0.18"base64 = { version = "0.22", optional = true }diff --git a/crates/automation/README.md b/crates/automation/README.mdindex a536a7f1c..f680ae80d 100644--- a/crates/automation/README.md+++ b/crates/automation/README.md@@ -1,9 +1,9 @@-# printcraft-automation+# pdfcraft-automation-Agent control for PrintCraft: a headless tool table over the engine, and an opt-in MCP server.+Agent control for PdfCraft: a headless tool table over the engine, and an opt-in MCP server.- **Layer:** L7 (architecture §13), but headless. It depends on `engine`, `render` and `organize`, never on a UI toolkit.-- **Status:** over a hundred tools; `printcraft-cli tools` lists the current set with their schemas (the count isn't repeated here, so it can't go stale). They cover inspection, rendering, text, page edits and organizing, page labels, bookmarks, comments and their review, form filling and authoring (fields, properties, scripts, data exchange, detection), redaction and sanitizing, password protection and signatures, adding text, images, links and stamps, optimizing, OCR, printing, export, metadata, undo/redo, save, combine, extract and split. Comment tools take geometry in the same top-left-origin points as everything else, and `comment_add` can mark text by searching for it (`find`). The MCP server also serves the open documents as resources, page images included. The running app's UI is driven separately, through the `ui.*` control channel in `printcraft-ui-egui`.+- **Status:** over a hundred tools; `pdfcraft-cli tools` lists the current set with their schemas (the count isn't repeated here, so it can't go stale). They cover inspection, rendering, text, page edits and organizing, page labels, bookmarks, comments and their review, form filling and authoring (fields, properties, scripts, data exchange, detection), redaction and sanitizing, password protection and signatures, adding text, images, links and stamps, optimizing, OCR, printing, export, metadata, undo/redo, save, combine, extract and split. Comment tools take geometry in the same top-left-origin points as everything else, and `comment_add` can mark text by searching for it (`find`). The MCP server also serves the open documents as resources, page images included. The running app's UI is driven separately, through the `ui.*` control channel in `pdfcraft-ui-egui`.## API@@ -27,9 +27,9 @@ mcp::McpServer::new(a).serve(stdin, stdout)? // newline-delimited JS## MCP server-**Opt-in only.** Nothing starts it automatically, and it opens no port. It runs while `printcraft-cli mcp [--root DIR]` runs, normally launched by an agent from its MCP configuration. It stops when stdin closes. The CLI's `mcp` Cargo feature (on by default) compiles it out entirely when disabled.+**Opt-in only.** Nothing starts it automatically, and it opens no port. It runs while `pdfcraft-cli mcp [--root DIR]` runs, normally launched by an agent from its MCP configuration. It stops when stdin closes. The CLI's `mcp` Cargo feature (on by default) compiles it out entirely when disabled.-Implemented: `initialize` (protocol 2025-06-18, 2025-03-26, 2024-11-05), `ping`, `tools/list` (with `readOnlyHint`/`destructiveHint` annotations), `tools/call` (JSON results also returned as `structuredContent`; images as `image/png`), and `resources/list`, `resources/templates/list` and `resources/read`. The resources expose the open documents read-only: `printcraft://doc/{doc}/info` (JSON), `…/text`, `…/page/{page}/text` and `…/page/{page}/image{?dpi}` (PNG, 1–600 dpi). Tool failures come back as `isError: true` results, so the agent can read and recover from them.+Implemented: `initialize` (protocol 2025-06-18, 2025-03-26, 2024-11-05), `ping`, `tools/list` (with `readOnlyHint`/`destructiveHint` annotations), `tools/call` (JSON results also returned as `structuredContent`; images as `image/png`), and `resources/list`, `resources/templates/list` and `resources/read`. The resources expose the open documents read-only: `pdfcraft://doc/{doc}/info` (JSON), `…/text`, `…/page/{page}/text` and `…/page/{page}/image{?dpi}` (PNG, 1–600 dpi). Tool failures come back as `isError: true` results, so the agent can read and recover from them.## Adding a tooldiff --git a/crates/automation/src/a11y.rs b/crates/automation/src/a11y.rsindex 383dbf10e..2c015623e 100644--- a/crates/automation/src/a11y.rs+++ b/crates/automation/src/a11y.rs@@ -1,6 +1,6 @@//! Accessibility tools: the full check, the accessibility report, and the automatic fixes.-use printcraft_engine::a11y::{Category, Options, Report, Rule, Status};+use pdfcraft_engine::a11y::{Category, Options, Report, Rule, Status};use serde_json::{Value, json};use crate::{Args, Automation, Result, ToolError, failed, write_atomic};@@ -84,7 +84,7 @@ impl Automation {let r = doc.accessibility_check(&o).ok_or_else(|| failed("the document can't be read for checking"))?;let path = self.resolve(a.str("path")?, true)?;let (y, m, d) = self.session.today();- let html = printcraft_engine::a11y::report_html(&r, &doc.name, &format!("{y}-{m:02}-{d:02}"));+ let html = pdfcraft_engine::a11y::report_html(&r, &doc.name, &format!("{y}-{m:02}-{d:02}"));write_atomic(&path, html.as_bytes())?;let mut out = report_json(&r);out["path"] = json!(path.to_string_lossy());@@ -125,9 +125,9 @@ impl Automation {let figure = u32::try_from(a.int("figure")?).map_err(|_| ToolError::InvalidArgs("figure must be a figure number from accessibility_figures".into()))?;let edit = if a.opt_bool("decorative")?.unwrap_or(false) {- printcraft_engine::Edit::MarkDecorative { figure }+ pdfcraft_engine::Edit::MarkDecorative { figure }} else {- printcraft_engine::Edit::SetAltText { figure, alt: a.opt_str("alt")?.map(str::to_owned) }+ pdfcraft_engine::Edit::SetAltText { figure, alt: a.opt_str("alt")?.map(str::to_owned) }};let id = self.doc(a)?.id;self.session.apply(id, edit).map_err(failed)?;@@ -136,13 +136,13 @@ impl Automation {}impl Automation {- fn ocr_settings(&self, a: &Args) -> Result<printcraft_engine::ocr::OcrSettings> {- let mut settings = printcraft_engine::ocr::OcrSettings::default();+ fn ocr_settings(&self, a: &Args) -> Result<pdfcraft_engine::ocr::OcrSettings> {+ let mut settings = pdfcraft_engine::ocr::OcrSettings::default();if let Some(d) = a.opt_num("dpi")? {settings.dpi = d.clamp(72.0, 600.0) as f32;}if let Some(l) = a.opt_str("language")? {- if !printcraft_engine::ocr::LANGUAGES.iter().any(|x| x.0 == l) {+ if !pdfcraft_engine::ocr::LANGUAGES.iter().any(|x| x.0 == l) {return Err(ToolError::InvalidArgs(format!("unsupported language {l:?}")));}settings.language = l.into();@@ -157,13 +157,13 @@ impl Automation {let settings = self.ocr_settings(a)?;let folder = self.resolve(a.str("folder")?, true)?;std::fs::create_dir_all(&folder).map_err(|e| failed(e.to_string()))?;- let ocr = printcraft_engine::ocr::engine().map_err(failed)?;+ let ocr = pdfcraft_engine::ocr::engine().map_err(failed)?;let mut out = Vec::new();for p in a.strs("paths")? {let name = std::path::Path::new(p).file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| "document.pdf".into());let result =self.resolve(p, false).map_err(|e| e.to_string()).and_then(|src| std::fs::read(&src).map_err(|e| e.to_string())).and_then(|bytes| {- printcraft_engine::ocr::recognize_file(&name, std::sync::Arc::new(bytes), None, settings.clone(), &ocr, |_, _| true)+ pdfcraft_engine::ocr::recognize_file(&name, std::sync::Arc::new(bytes), None, settings.clone(), &ocr, |_, _| true)});out.push(match result {Ok(r) => {@@ -194,15 +194,15 @@ impl Automation {}pub(crate) fn ocr_status(&self) -> Result<Value> {- use printcraft_engine::ocr;+ use pdfcraft_engine::ocr;let dirs: Vec<String> = ocr::Models::search_dirs().iter().map(|d| d.to_string_lossy().into_owned()).collect();let langs: Vec<Value> = ocr::LANGUAGES.iter().map(|(c, n)| json!({ "code": c, "name": n })).collect();Ok(json!({ "available": ocr::available(), "search_dirs": dirs, "languages": langs }))}}-fn request_json(r: &printcraft_engine::js::Request) -> Value {- use printcraft_engine::js::Request as R;+fn request_json(r: &pdfcraft_engine::js::Request) -> Value {+ use pdfcraft_engine::js::Request as R;match r {R::Reset(n) => json!({ "reset": n }),R::Print => json!({ "print": true }),@@ -228,14 +228,14 @@ impl Automation {}pub(crate) fn js_set_document_script(&mut self, a: &Args) -> Result<Value> {- let edit = printcraft_engine::Edit::SetDocumentScript { name: a.str("name")?.into(), script: a.opt_str("script")?.map(str::to_string) };+ let edit = pdfcraft_engine::Edit::SetDocumentScript { name: a.str("name")?.into(), script: a.opt_str("script")?.map(str::to_string) };let id = self.doc(a)?.id;self.session.apply(id, edit).map_err(failed)?;self.js_document_scripts(a)}pub(crate) fn form_set_script(&mut self, a: &Args) -> Result<Value> {- let edit = printcraft_engine::Edit::SetFieldScript {+ let edit = pdfcraft_engine::Edit::SetFieldScript {name: a.str("field")?.into(),event: a.str("event")?.into(),script: a.opt_str("script")?.map(str::to_string),@@ -252,7 +252,7 @@ impl Automation {let path = self.resolve(p, false)?;files.push((p.to_string(), std::fs::read(&path).map_err(|e| failed(format!("{p}: {e}")))?));}- let csv = printcraft_engine::merge_data_files(&files).map_err(failed)?;+ let csv = pdfcraft_engine::merge_data_files(&files).map_err(failed)?;let target = self.resolve(a.str("path")?, true)?;write_atomic(&target, csv.as_bytes())?;let columns = csv.lines().next().map_or(0, |h| h.split(',').count());@@ -262,16 +262,16 @@ impl Automation {pub(crate) fn doc_export_office(&self, a: &Args) -> Result<Value> {let path = self.resolve(a.str("path")?, true)?;let ext = path.extension().map(|e| e.to_string_lossy().into_owned()).unwrap_or_default();- let format = printcraft_engine::compare::OfficeFormat::from_extension(&ext)+ let format = pdfcraft_engine::compare::OfficeFormat::from_extension(&ext).ok_or_else(|| ToolError::InvalidArgs(format!("unsupported extension {ext:?} (docx, html or rtf)")))?;let bytes = self.doc(a)?.export_office(format);write_atomic(&path, &bytes)?;Ok(json!({ "path": path.to_string_lossy(), "bytes": bytes.len(), "format": format.extension() }))}- fn pdfa_level(&self, a: &Args) -> Result<printcraft_engine::pdfa::Level> {+ fn pdfa_level(&self, a: &Args) -> Result<pdfcraft_engine::pdfa::Level> {let l = a.opt_str("level")?.unwrap_or("2b");- printcraft_engine::pdfa::Level::from_id(l).ok_or_else(|| ToolError::InvalidArgs(format!("unknown PDF/A level {l:?} (2b or 3b)")))+ pdfcraft_engine::pdfa::Level::from_id(l).ok_or_else(|| ToolError::InvalidArgs(format!("unknown PDF/A level {l:?} (2b or 3b)")))}pub(crate) fn pdfa_verify(&self, a: &Args) -> Result<Value> {@@ -294,12 +294,12 @@ impl Automation {pub(crate) fn pdfa_convert(&mut self, a: &Args) -> Result<Value> {let level = self.pdfa_level(a)?;let id = self.doc(a)?.id;- self.session.apply(id, printcraft_engine::Edit::ConvertPdfA { level }).map_err(failed)?;+ self.session.apply(id, pdfcraft_engine::Edit::ConvertPdfA { level }).map_err(failed)?;self.pdfa_verify(a)}pub(crate) fn action_list(&self) -> Result<Value> {- use printcraft_engine::actions::{Step, builtin};+ use pdfcraft_engine::actions::{Step, builtin};let step_json = |s: &Step| json!({ "step": s.id(), "arg": s.arg() });let actions: Vec<Value> = builtin().iter()@@ -310,7 +310,7 @@ impl Automation {}pub(crate) fn action_run(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::actions::{Action, Step, builtin, run_on};+ use pdfcraft_engine::actions::{Action, Step, builtin, run_on};let action = if let Some(name) = a.opt_str("action")? {builtin().into_iter()@@ -349,25 +349,25 @@ impl Automation {Ok(json!({ "action": action.name, "files": out }))}- fn compare_ids(&self, a: &Args) -> Result<(printcraft_engine::DocId, printcraft_engine::DocId)> {+ fn compare_ids(&self, a: &Args) -> Result<(pdfcraft_engine::DocId, pdfcraft_engine::DocId)> {let new = self.doc(a)?.id;let other = a.int("other")?;let old = u64::try_from(other).ok()- .and_then(|o| self.session.get(printcraft_engine::DocId(o)))+ .and_then(|o| self.session.get(pdfcraft_engine::DocId(o))).map(|d| d.id).ok_or_else(|| ToolError::InvalidArgs(format!("no open document {other}")))?;Ok((old, new))}pub(crate) fn doc_compare(&self, a: &Args) -> Result<Value> {- use printcraft_engine::compare::Kind;+ use pdfcraft_engine::compare::Kind;let (old, new) = self.compare_ids(a)?;let c = self.session.compare(old, new).map_err(failed)?;let limit = a.opt_int("limit")?.unwrap_or(500).max(1) as usize;let r2 = |r: &[f64; 4]| r.map(|v| (v * 100.0).round() / 100.0);let side =- |s: &printcraft_engine::compare::Side| json!({ "text": s.text, "page": s.page + 1, "rects": s.rects.iter().map(r2).collect::<Vec<_>>() });+ |s: &pdfcraft_engine::compare::Side| json!({ "text": s.text, "page": s.page + 1, "rects": s.rects.iter().map(r2).collect::<Vec<_>>() });let list: Vec<Value> = c.changes.iter()@@ -413,8 +413,8 @@ impl Automation {.iter().map(|(p, c)| {let kind = match c.kind {- printcraft_engine::detect::Kind::Text => "text",- printcraft_engine::detect::Kind::CheckBox => "checkbox",+ pdfcraft_engine::detect::Kind::Text => "text",+ pdfcraft_engine::detect::Kind::CheckBox => "checkbox",};json!({ "page": p + 1, "kind": kind, "name": c.name, "rect": c.rect.map(|v| (v * 100.0).round() / 100.0) })})@@ -426,7 +426,7 @@ impl Automation {}pub(crate) fn form_actions(&self, a: &Args) -> Result<Value> {- use printcraft_engine::FieldAction as A;+ use pdfcraft_engine::FieldAction as A;let list: Vec<Value> = self.doc(a)?.field_actions(a.str("field")?)@@ -451,7 +451,7 @@ impl Automation {}pub(crate) fn form_set_actions(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::{FieldAction as A, FieldTrigger as T};+ use pdfcraft_engine::{FieldAction as A, FieldTrigger as T};let items = a.get("actions").and_then(Value::as_array).ok_or_else(|| ToolError::InvalidArgs("actions must be an array".into()))?;let bad = |m: String| ToolError::InvalidArgs(m);let names = |v: &Value| -> Vec<String> {@@ -483,10 +483,8 @@ impl Automation {acts.push((t, act));}let name = a.str("field")?.to_string();- let edit = printcraft_engine::Edit::SetFieldProps {- name,- props: Box::new(printcraft_engine::FieldProps { actions: Some(acts), ..Default::default() }),- };+ let edit =+ pdfcraft_engine::Edit::SetFieldProps { name, props: Box::new(pdfcraft_engine::FieldProps { actions: Some(acts), ..Default::default() }) };let id = self.doc(a)?.id;self.session.apply(id, edit).map_err(failed)?;self.form_actions(a)diff --git a/crates/automation/src/comments.rs b/crates/automation/src/comments.rsindex 80961e768..0d9f58709 100644--- a/crates/automation/src/comments.rs+++ b/crates/automation/src/comments.rs@@ -3,14 +3,14 @@//! Geometry follows the automation convention: points from the top-left of the displayed page,//! y down. It is converted to PDF user space (crop box, `/Rotate`) here.-use printcraft_engine::{Edit, Markup, NewAnnotation, NoteIcon, ReviewState, Rgb, Shape, StampGroup, StampKind, Style, SummarySort};-use printcraft_render::{Annotation, PageInfo};+use pdfcraft_engine::{Edit, Markup, NewAnnotation, NoteIcon, ReviewState, Rgb, Shape, StampGroup, StampKind, Style, SummarySort};+use pdfcraft_render::{Annotation, PageInfo};use serde_json::{Value, json};use crate::{Args, Automation, Result, ToolError, failed};/// Author used when a tool call names none.-pub(crate) const DEFAULT_AUTHOR: &str = "PrintCraft";+pub(crate) const DEFAULT_AUTHOR: &str = "PdfCraft";pub(crate) fn parse_color(s: &str) -> Result<Rgb> {let named = match s.to_ascii_lowercase().as_str() {@@ -277,9 +277,9 @@ impl Automation {let data = std::fs::read(&path).map_err(|e| failed(format!("{}: {e}", path.display())))?;let file = path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();let icon = match a.opt_str("icon")? {- Some(n) => printcraft_engine::AttachIcon::from_name(n)+ Some(n) => pdfcraft_engine::AttachIcon::from_name(n).ok_or_else(|| ToolError::InvalidArgs(format!("unknown icon {n:?} (PushPin, Paperclip, Graph, Tag)")))?,- None => printcraft_engine::AttachIcon::PushPin,+ None => pdfcraft_engine::AttachIcon::PushPin,};Shape::Attachment { at: to_user(&info, x, y), icon, file, data }}@@ -332,7 +332,7 @@ impl Automation {}pub(crate) fn fill_sign_add(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::FillMark;+ use pdfcraft_engine::FillMark;let page = self.page(a)?;let info = self.doc(a)?.info.pages[page].clone();let [x, y] = a.need::<2>("at", "Fill & Sign")?;@@ -340,7 +340,7 @@ impl Automation {let author = a.opt_str("author")?.unwrap_or(DEFAULT_AUTHOR).to_string();let size = 10.0;let text_at = |t: &str| {- let w = (printcraft_engine::annot_text::text_width(t, size) + 8.0).clamp(20.0, 600.0);+ let w = (pdfcraft_engine::annot_text::text_width(t, size) + 8.0).clamp(20.0, 600.0);let h = size * 1.2 + 6.0;Shape::Typewriter { rect: [at[0], at[1] - h, at[0] + w, at[1]], font_size: size }};@@ -359,7 +359,7 @@ impl Automation {let t = a.str("text")?;let h = if kind == "initials" { 24.0 } else { 32.0 };let shape =- printcraft_engine::typed_signature_shape(at, t, h).ok_or_else(|| ToolError::InvalidArgs("text has nothing to draw".into()))?;+ pdfcraft_engine::typed_signature_shape(at, t, h).ok_or_else(|| ToolError::InvalidArgs("text has nothing to draw".into()))?;(shape, String::new())}kind => {@@ -470,7 +470,7 @@ impl Automation {page,rect: [ux, uy, ux, uy],name,- file: printcraft_engine::MarkFile {+ file: pdfcraft_engine::MarkFile {name: file,bytes: std::sync::Arc::new(bytes),page: a.opt_int("file_page")?.unwrap_or(1).max(1) as usize - 1,diff --git a/crates/automation/src/content.rs b/crates/automation/src/content.rsindex 79f29a2f1..9a0448856 100644--- a/crates/automation/src/content.rs+++ b/crates/automation/src/content.rs@@ -2,7 +2,7 @@//! move/resize/retype/restyle it, delete it. Geometry is in points from the top-left of the//! displayed page (y down), like every other tool.-use printcraft_engine::{AddedContent, AddedText, Edit, FontFamily, TextAlign};+use pdfcraft_engine::{AddedContent, AddedText, Edit, FontFamily, TextAlign};use serde_json::{Value, json};use crate::comments::parse_color;diff --git a/crates/automation/src/forms.rs b/crates/automation/src/forms.rsindex 6ed1a3285..0203934b7 100644--- a/crates/automation/src/forms.rs+++ b/crates/automation/src/forms.rs@@ -1,8 +1,8 @@//! Form tools: list fields, fill them (several at once, one undo step), clear the form, and//! prepare a form (add, change and delete fields).-use printcraft_engine::form_scripts::{CalcOp, Calculate, Format, Validate};-use printcraft_engine::{Edit, FieldProps, FieldValue, FormField, FormFieldKind, NewField, field_flags};+use pdfcraft_engine::form_scripts::{CalcOp, Calculate, Format, Validate};+use pdfcraft_engine::{Edit, FieldProps, FieldValue, FormField, FormFieldKind, NewField, field_flags};use serde_json::{Value, json};use crate::{Args, Automation, Result, ToolError, failed};@@ -43,8 +43,8 @@ fn format_arg(v: &Value) -> Result<Format> {/// `{"border": "#FF0000" | "none", "fill": …, "width": 1-3, "style": "solid"|…, "text_color": …,/// "font": "helvetica"|"times"|"courier"}`, changing only what is given.-fn look_arg(v: &Value, mut l: printcraft_engine::FieldLook) -> Result<printcraft_engine::FieldLook> {- use printcraft_engine::{BorderStyle, FieldFont};+fn look_arg(v: &Value, mut l: pdfcraft_engine::FieldLook) -> Result<pdfcraft_engine::FieldLook> {+ use pdfcraft_engine::{BorderStyle, FieldFont};let o = v.as_object().ok_or_else(|| bad("appearance must be an object"))?;let colour = |k: &str| -> Result<Option<Option<[f64; 3]>>> {match o.get(k) {@@ -206,7 +206,7 @@ impl Automation {}if f.actions.format != Format::None {o.insert("format".into(), format_json(&f.actions.format));- o.insert("display".into(), json!(f.value.first().map(|v| printcraft_engine::form_scripts::format_value(&f.actions.format, v))));+ o.insert("display".into(), json!(f.value.first().map(|v| pdfcraft_engine::form_scripts::format_value(&f.actions.format, v))));}if let Validate::Range { min, max } = &f.actions.validate {o.insert("validate".into(), json!({ "min": min, "max": max }));@@ -367,7 +367,7 @@ impl Automation {flags: match a.get("flags") {None => Vec::new(),Some(v) => {- use printcraft_engine::field_flags as ff;+ use pdfcraft_engine::field_flags as ff;let obj = v.as_object().ok_or_else(|| bad("flags must be an object of booleans"))?;let mut out = Vec::new();for (k, on) in obj {@@ -397,7 +397,7 @@ impl Automation {check_style: match a.opt_str("check_style")? {None => None,Some(s) => Some(- printcraft_engine::CheckStyle::ALL+ pdfcraft_engine::CheckStyle::ALL.into_iter().find(|c| c.label().eq_ignore_ascii_case(s)).ok_or_else(|| bad(format!("unknown check style {s:?} (check, circle, cross, diamond, square, star)")))?,@@ -431,10 +431,10 @@ impl Automation {return Ok(out);}let order = match a.str("order")? {- "row" | "rows" => printcraft_engine::TabOrder::Row,- "column" | "columns" => printcraft_engine::TabOrder::Column,- "structure" => printcraft_engine::TabOrder::Structure,- "annotations" | "unspecified" => printcraft_engine::TabOrder::Annotations,+ "row" | "rows" => pdfcraft_engine::TabOrder::Row,+ "column" | "columns" => pdfcraft_engine::TabOrder::Column,+ "structure" => pdfcraft_engine::TabOrder::Structure,+ "annotations" | "unspecified" => pdfcraft_engine::TabOrder::Annotations,o => return Err(bad(format!("unknown order {o:?} (row, column, structure, annotations)"))),};let mut out = self.apply(a, Edit::SetTabOrder { pages, order })?;@@ -463,15 +463,14 @@ impl Automation {let id = self.doc(a)?.id;let path = self.resolve(a.str("path")?, true)?;let ext = path.extension().map(|e| e.to_string_lossy().into_owned()).unwrap_or_default();- let format =- printcraft_engine::DataFormat::from_extension(&ext).ok_or_else(|| bad("the path must end in .xfdf, .fdf, .xml, .csv or .txt"))?;+ let format = pdfcraft_engine::DataFormat::from_extension(&ext).ok_or_else(|| bad("the path must end in .xfdf, .fdf, .xml, .csv or .txt"))?;let (comments, fields) = match a.opt_str("what")?.unwrap_or("all") {"all" => (true, true),"comments" => (true, false),"fields" => (false, true),w => return Err(bad(format!("unknown what {w:?} (all, comments, fields)"))),};- if comments && !matches!(format, printcraft_engine::DataFormat::Xfdf | printcraft_engine::DataFormat::Fdf) {+ if comments && !matches!(format, pdfcraft_engine::DataFormat::Xfdf | pdfcraft_engine::DataFormat::Fdf) {return Err(bad("comments travel as .xfdf or .fdf; .xml, .csv and .txt hold form data (use what: fields)"));}let bytes = self.session.export_data(id, format, comments, fields).map_err(failed)?;diff --git a/crates/automation/src/lib.rs b/crates/automation/src/lib.rsindex bf16225df..9adde658d 100644--- a/crates/automation/src/lib.rs+++ b/crates/automation/src/lib.rs@@ -1,10 +1,10 @@-//! printcraft-automation — agent control for PrintCraft (architecture §13).+//! pdfcraft-automation — agent control for PdfCraft (architecture §13).//!//! - **Layer:** L7. Headless: depends on the engine, never on a UI toolkit.//! - [`Automation`] is a tool set over an engine [`Session`]: open, inspect, render, extract and//! find text, edit pages and metadata, undo/redo, save, combine, extract and split. Every tool//! has a JSON Schema ([`tools`]) and takes and returns JSON, so the same table drives the MCP-//! server ([`mcp`]), `printcraft-cli run` and (later) the UI control channel.+//! server ([`mcp`]), `pdfcraft-cli run` and (later) the UI control channel.//! - Pages are **1-based** in every tool, as people number them. Rectangles are in PDF points//! with the origin at the top-left of the displayed page.//! - An optional root directory confines every path a tool reads or writes.@@ -27,8 +27,8 @@ use std::collections::HashMap;use std::path::{Path, PathBuf};use std::sync::Arc;-use printcraft_engine::{DocId, Document, Edit, Session, commands};-use printcraft_render::{PageRenderer, PageText, RenderConfig, RenderRequest, RequestKind};+use pdfcraft_engine::{DocId, Document, Edit, Session, commands};+use pdfcraft_render::{PageRenderer, PageText, RenderConfig, RenderRequest, RequestKind};use serde_json::{Value, json};pub use tools::{ToolDef, tools};@@ -77,7 +77,7 @@ const MAX_DPI: f64 = 600.0;/// Page texts of one document version: (the working bytes, one slot per page).type TextCache = (Arc<Vec<u8>>, Vec<Option<Arc<PageText>>>);-/// A headless PrintCraft session driven by tool calls.+/// A headless PdfCraft session driven by tool calls.pub struct Automation {session: Session,root: Option<PathBuf>,@@ -148,18 +148,18 @@ impl Automation {None => (0..doc.info.pages.len()).collect(),};let parity = match a.opt_str("subset")?.unwrap_or("all") {- "all" => printcraft_engine::PageParity::Both,- "even" => printcraft_engine::PageParity::Even,- "odd" => printcraft_engine::PageParity::Odd,+ "all" => pdfcraft_engine::PageParity::Both,+ "even" => pdfcraft_engine::PageParity::Even,+ "odd" => pdfcraft_engine::PageParity::Odd,s => return Err(ToolError::InvalidArgs(format!("unknown subset {s:?} (all, even, odd)"))),};let orientation = match a.opt_str("orientation")?.unwrap_or("all") {- "all" => printcraft_engine::PageOrientation::Both,- "landscape" => printcraft_engine::PageOrientation::Landscape,- "portrait" => printcraft_engine::PageOrientation::Portrait,+ "all" => pdfcraft_engine::PageOrientation::Both,+ "landscape" => pdfcraft_engine::PageOrientation::Landscape,+ "portrait" => pdfcraft_engine::PageOrientation::Portrait,o => return Err(ToolError::InvalidArgs(format!("unknown orientation {o:?} (all, landscape, portrait)"))),};- let pages = printcraft_engine::filter_pages(&self.doc(&a)?.info, &base, parity, orientation);+ let pages = pdfcraft_engine::filter_pages(&self.doc(&a)?.info, &base, parity, orientation);if pages.is_empty() {return Err(failed("no pages match the filters"));}@@ -194,7 +194,7 @@ impl Automation {}"command_list" => self.command_list(&a)?,"page_number" => {- use printcraft_organize::LabelStyle as L;+ use pdfcraft_organize::LabelStyle as L;let n = self.doc(&a)?.info.pages.len();let (from, to) = (a.int("from")?, a.int("to")?);if from < 1 || to < from || to as usize > n {@@ -332,7 +332,7 @@ impl Automation {write_atomic(&path, &bytes)?;json!({ "path": path.to_string_lossy(), "format": ext, "bytes": bytes.len() })} else {- use printcraft_engine::ImageEdit;+ use pdfcraft_engine::ImageEdit;let change = match a.str("action")? {"move" => {let r: Vec<f64> =@@ -392,7 +392,7 @@ impl Automation {}let block = self.doc(&a)?.text_blocks(page)[k as usize - 1].clone();let text = a.opt_str("text")?.map(str::to_owned).unwrap_or(block.text);- let mut style = printcraft_engine::BlockStyle {+ let mut style = pdfcraft_engine::BlockStyle {size: a.opt_num("size")?,underline: a.opt_bool("underline")?,line_spacing: a.opt_num("line_spacing")?,@@ -407,9 +407,9 @@ impl Automation {}if let Some(f) = a.opt_str("font")? {let family = match f {- "helvetica" => printcraft_engine::FontFamily::Helvetica,- "times" => printcraft_engine::FontFamily::Times,- "courier" => printcraft_engine::FontFamily::Courier,+ "helvetica" => pdfcraft_engine::FontFamily::Helvetica,+ "times" => pdfcraft_engine::FontFamily::Times,+ "courier" => pdfcraft_engine::FontFamily::Courier,other => return Err(ToolError::InvalidArgs(format!("unknown font {other:?} (helvetica, times, courier)"))),};style.family = Some((family, a.opt_bool("bold")?.unwrap_or(false), a.opt_bool("italic")?.unwrap_or(false)));@@ -419,10 +419,10 @@ impl Automation {}if let Some(al) = a.opt_str("align")? {style.align = Some(match al {- "left" => printcraft_engine::TextAlign::Left,- "center" => printcraft_engine::TextAlign::Center,- "right" => printcraft_engine::TextAlign::Right,- "justify" => printcraft_engine::TextAlign::Justify,+ "left" => pdfcraft_engine::TextAlign::Left,+ "center" => pdfcraft_engine::TextAlign::Center,+ "right" => pdfcraft_engine::TextAlign::Right,+ "justify" => pdfcraft_engine::TextAlign::Justify,other => return Err(ToolError::InvalidArgs(format!("unknown align {other:?}"))),});}@@ -537,10 +537,10 @@ impl Automation {"sign_document" => self.sign_document(&a)?,"sign_keychain_ids" => {#[cfg(target_os = "macos")]- let ids: Vec<Value> = printcraft_engine::sign::keychain::identities(None)+ let ids: Vec<Value> = pdfcraft_engine::sign::keychain::identities(None).map_err(failed)?.iter()- .map(|id| json!({ "id": printcraft_engine::sign::keychain::reference(&id.certificate), "certificate": signing::cert_json(&id.certificate) }))+ .map(|id| json!({ "id": pdfcraft_engine::sign::keychain::reference(&id.certificate), "certificate": signing::cert_json(&id.certificate) })).collect();#[cfg(not(target_os = "macos"))]let ids: Vec<Value> = Vec::new();@@ -623,7 +623,7 @@ impl Automation {}fn doc_initial_view(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::{InitialLayout as L, Magnification as M, Navigation as N};+ use pdfcraft_engine::{InitialLayout as L, Magnification as M, Navigation as N};let bad = |m: String| ToolError::InvalidArgs(m);let mut v = self.doc(a)?.initial_view();let before = v.clone();@@ -711,7 +711,7 @@ impl Automation {}fn doc_optimize(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::optimize::{Compression, ImageSettings, Settings};+ use pdfcraft_engine::optimize::{Compression, ImageSettings, Settings};let id = self.doc(a)?.id;let before = self.doc(a)?.bytes.len();let path = self.resolve(a.str("path")?, true)?;@@ -755,7 +755,7 @@ impl Automation {*flag = b;}}- let discard: Vec<printcraft_engine::Hidden> = match a.get("discard") {+ let discard: Vec<pdfcraft_engine::Hidden> = match a.get("discard") {None => Vec::new(),Some(v) => v.as_array()@@ -763,7 +763,7 @@ impl Automation {.iter().map(|x| {x.as_str()- .and_then(printcraft_engine::Hidden::from_id)+ .and_then(pdfcraft_engine::Hidden::from_id).ok_or_else(|| ToolError::InvalidArgs(format!("unknown discard category {x}")))}).collect::<Result<_>>()?,@@ -793,12 +793,12 @@ impl Automation {}/// A watermark or background picture: `file` (an image or a PDF) and `file_page` (1-based).- fn mark_file(&self, a: &Args) -> Result<Option<printcraft_engine::MarkFile>> {+ fn mark_file(&self, a: &Args) -> Result<Option<pdfcraft_engine::MarkFile>> {let Some(p) = a.opt_str("file")? else { return Ok(None) };let path = self.resolve(p, false)?;let bytes = std::fs::read(&path).map_err(|e| failed(format!("{}: {e}", path.display())))?;let page = a.opt_int("file_page")?.unwrap_or(1).max(1) as usize - 1;- Ok(Some(printcraft_engine::MarkFile {+ Ok(Some(pdfcraft_engine::MarkFile {name: path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(),bytes: Arc::new(bytes),page,@@ -812,7 +812,7 @@ impl Automation {}fn marks(&mut self, tool: &str, a: &Args) -> Result<Value> {- use printcraft_engine::{Background, HeaderFooter, MarkKind, Watermark};+ use pdfcraft_engine::{Background, HeaderFooter, MarkKind, Watermark};let n = self.doc(a)?.info.pages.len();let pages = match a.opt_ints("pages")? {Some(_) => self.pages(a, "pages")?,@@ -891,7 +891,7 @@ impl Automation {None => (0..doc.info.pages.len()).collect(),};let stem = doc.name.trim_end_matches(".pdf").trim_end_matches(".PDF").to_string();- let mut ex = printcraft_engine::export::Exporter::new(doc);+ let mut ex = pdfcraft_engine::export::Exporter::new(doc);if tool == "doc_export_text" {let path = self.resolve(a.str("path")?, true)?;let text = ex.text_of(&pages).map_err(failed)?;@@ -902,10 +902,10 @@ impl Automation {std::fs::create_dir_all(&folder).map_err(|e| failed(format!("{}: {e}", folder.display())))?;if tool == "doc_export_all_images" {let min = u32::try_from(a.opt_int("min_size")?.unwrap_or(0).max(0)).unwrap_or(u32::MAX);- let out = printcraft_engine::export::extract_images(&doc.export_source(), &pages, min).map_err(failed)?;+ let out = pdfcraft_engine::export::extract_images(&doc.export_source(), &pages, min).map_err(failed)?;let mut files = Vec::new();for (k, img) in out.images.iter().enumerate() {- let path = folder.join(printcraft_engine::export::image_file_name(&stem, img, k + 1));+ let path = folder.join(pdfcraft_engine::export::image_file_name(&stem, img, k + 1));write_atomic(&path, &img.data)?;files.push(json!({ "path": path.to_string_lossy(), "page": img.page + 1, "width": img.width, "height": img.height }));}@@ -915,9 +915,9 @@ impl Automation {let dpi = a.opt_num("dpi")?.unwrap_or(150.0);let quality = a.opt_int("quality")?.unwrap_or(85).clamp(1, 100) as u8;let format = match a.opt_str("format")?.unwrap_or("png") {- "png" => printcraft_engine::export::ImageFormat::Png,- "jpeg" | "jpg" => printcraft_engine::export::ImageFormat::Jpeg { quality },- "tiff" | "tif" => printcraft_engine::export::ImageFormat::Tiff,+ "png" => pdfcraft_engine::export::ImageFormat::Png,+ "jpeg" | "jpg" => pdfcraft_engine::export::ImageFormat::Jpeg { quality },+ "tiff" | "tif" => pdfcraft_engine::export::ImageFormat::Tiff,f => return Err(ToolError::InvalidArgs(format!("unknown format {f:?} (png, jpeg, tiff)"))),};let mut files = Vec::new();@@ -971,7 +971,7 @@ impl Automation {}fn page_set_box(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::{BoxSpec, PageBox};+ use pdfcraft_engine::{BoxSpec, PageBox};let doc = self.doc(a)?;let n = doc.info.pages.len();let pages = match a.opt_ints("pages")? {@@ -1010,7 +1010,7 @@ impl Automation {}fn doc_protect(&mut self, a: &Args) -> Result<Value> {- use printcraft_engine::{Algorithm, Changes, Printing, Protection};+ use pdfcraft_engine::{Algorithm, Changes, Printing, Protection};let d = Protection::default();let p = Protection {open_password: a.opt_str("open_password")?.map(str::to_owned),@@ -1155,14 +1155,14 @@ impl Automation {self.session.split_by_size(id, (mb * 1_048_576.0) as usize).map_err(failed)?} else {let by = match (a.opt_int("every")?, a.opt_ints("before")?) {- (Some(n), None) if n > 0 => printcraft_organize::SplitBy::PageCount(n as usize),- (None, Some(b)) => printcraft_organize::SplitBy::Before(one_based(&b)?),+ (Some(n), None) if n > 0 => pdfcraft_organize::SplitBy::PageCount(n as usize),+ (None, Some(b)) => pdfcraft_organize::SplitBy::Before(one_based(&b)?),_ if bookmarks => {titles = self.session.bookmark_splits(id);if titles.is_empty() {return Err(failed("the document has no top-level bookmarks"));}- printcraft_organize::SplitBy::Before(titles.iter().map(|t| t.0).collect())+ pdfcraft_organize::SplitBy::Before(titles.iter().map(|t| t.0).collect())}_ => return Err(ToolError::InvalidArgs("every must be a positive page count".into())),};@@ -1414,7 +1414,7 @@ impl Args<'_> {}/// The bookmark tree as JSON, with 1-based paths and pages.-fn bookmark_tree(items: &[printcraft_render::OutlineItem], parent: &[usize]) -> Vec<Value> {+fn bookmark_tree(items: &[pdfcraft_render::OutlineItem], parent: &[usize]) -> Vec<Value> {items.iter().enumerate()@@ -1483,7 +1483,7 @@ fn info(d: &Document) -> Value {"tagged": i.tagged,"has_javascript": i.has_javascript,// XFA forms aren't read yet: "static" (fields work, XFA data ignored) or "dynamic" (placeholder pages).- "xfa": i.xfa.map(|x| match x { printcraft_render::Xfa::Static => "static", printcraft_render::Xfa::Dynamic => "dynamic" }),+ "xfa": i.xfa.map(|x| match x { pdfcraft_render::Xfa::Static => "static", pdfcraft_render::Xfa::Dynamic => "dynamic" }),"security": security,"pages": i.pages.iter().enumerate().map(|(n, p)| json!({"page": n + 1, "label": p.label, "width": p.width, "height": p.height, "rotation": p.rotation,@@ -1500,9 +1500,9 @@ fn info(d: &Document) -> Value {"links": i.links.iter().map(|l| json!({"page": page1(l.page), "rect": l.rect,"target": match &l.target {- printcraft_render::LinkTarget::Page(p) => json!({ "page": page1(*p) }),- printcraft_render::LinkTarget::Uri(u) => json!({ "uri": u }),- printcraft_render::LinkTarget::Other(o) => json!({ "other": o }),+ pdfcraft_render::LinkTarget::Page(p) => json!({ "page": page1(*p) }),+ pdfcraft_render::LinkTarget::Uri(u) => json!({ "uri": u }),+ pdfcraft_render::LinkTarget::Other(o) => json!({ "other": o }),},})).collect::<Vec<_>>(),"layers": i.layers.iter().map(|l| json!({ "name": l.name, "visible": l.visible })).collect::<Vec<_>>(),@@ -1515,7 +1515,7 @@ fn info(d: &Document) -> Value {})}-fn outline(items: &[printcraft_render::OutlineItem]) -> Value {+fn outline(items: &[pdfcraft_render::OutlineItem]) -> Value {Value::Array(items.iter().map(|o| json!({ "title": o.title, "page": o.page.map(|p| p + 1), "children": outline(&o.children) })).collect())}@@ -1582,7 +1582,7 @@ fn write_atomic(path: &Path, bytes: &[u8]) -> Result<()> {let dir = path.parent().filter(|p| !p.as_os_str().is_empty()).unwrap_or(Path::new("."));let name = path.file_name().ok_or_else(|| failed(format!("{}: not a file path", path.display())))?;std::fs::create_dir_all(dir).map_err(|e| failed(format!("{}: {e}", dir.display())))?;- let tmp = dir.join(format!(".{}.printcraft-tmp", name.to_string_lossy()));+ let tmp = dir.join(format!(".{}.pdfcraft-tmp", name.to_string_lossy()));std::fs::write(&tmp, bytes).map_err(|e| failed(format!("{}: {e}", tmp.display())))?;std::fs::rename(&tmp, path).map_err(|e| {let _ = std::fs::remove_file(&tmp);diff --git a/crates/automation/src/links.rs b/crates/automation/src/links.rsindex 17fdee941..381f7a043 100644--- a/crates/automation/src/links.rs+++ b/crates/automation/src/links.rs@@ -1,7 +1,7 @@//! Link tools: list, add, edit and delete links; create links from URLs in the text; remove//! all links. Rectangles are points from the top-left of the displayed page.-use printcraft_engine::{Edit, LinkAction, LinkHighlight, LinkStyle};+use pdfcraft_engine::{Edit, LinkAction, LinkHighlight, LinkStyle};use serde_json::{Value, json};use crate::comments::parse_color;diff --git a/crates/automation/src/mcp.rs b/crates/automation/src/mcp.rsindex bfa335444..e746cf534 100644--- a/crates/automation/src/mcp.rs+++ b/crates/automation/src/mcp.rs@@ -1,13 +1,13 @@//! A Model Context Protocol server over the automation tools.//!-//! **Opt-in only.** Nothing in PrintCraft starts this server on its own: it runs when a user-//! launches `printcraft-cli mcp` (usually by adding that command to their agent's MCP+//! **Opt-in only.** Nothing in PdfCraft starts this server on its own: it runs when a user+//! launches `pdfcraft-cli mcp` (usually by adding that command to their agent's MCP//! configuration), and stops when its input closes. It opens no network port; the transport is//! newline-delimited JSON-RPC 2.0 over stdin/stdout.//!//! Implemented: `initialize`, `ping`, `tools/list`, `tools/call`, `resources/list`,//! `resources/templates/list`, `resources/read`, and the `notifications/*` the client sends.-//! Resources expose the open documents read-only: `printcraft://doc/{doc}/info` (JSON),+//! Resources expose the open documents read-only: `pdfcraft://doc/{doc}/info` (JSON),//! `…/text` (plain text), `…/page/{page}/text` and `…/page/{page}/image` (PNG; `?dpi=` 1–600). Tool failures are reported in the result (`isError: true`) so the agent can read//! them; protocol errors use JSON-RPC error codes.@@ -26,10 +26,10 @@ const INVALID_REQUEST: i64 = -32600;const METHOD_NOT_FOUND: i64 = -32601;const INVALID_PARAMS: i64 = -32602;-const INSTRUCTIONS: &str = "PrintCraft edits PDFs. Open a file with doc_open to get a document id, then inspect \+const INSTRUCTIONS: &str = "PdfCraft edits PDFs. Open a file with doc_open to get a document id, then inspect \(doc_info, text_extract, text_find, page_render) or edit it (page_*, doc_set_info). Edits are undoable \(edit_undo) and stay in memory until doc_save. Page numbers are 1-based. Open documents are also \-resources: printcraft://doc/{doc}/info, /text, /page/{page}/text and /page/{page}/image.";+resources: pdfcraft://doc/{doc}/info, /text, /page/{page}/text and /page/{page}/image.";pub struct McpServer {automation: Automation,@@ -92,7 +92,7 @@ impl McpServer {Ok(json!({"protocolVersion": version,"capabilities": { "tools": { "listChanged": false }, "resources": { "listChanged": false, "subscribe": false } },- "serverInfo": { "name": "printcraft", "title": "PrintCraft", "version": env!("CARGO_PKG_VERSION"), "websiteUrl": printcraft_engine::links::APP_PAGE },+ "serverInfo": { "name": "pdfcraft", "title": "PdfCraft", "version": env!("CARGO_PKG_VERSION"), "websiteUrl": pdfcraft_engine::links::APP_PAGE },"instructions": INSTRUCTIONS,}))}@@ -118,7 +118,7 @@ impl McpServer {}}-/// The resource behind a `printcraft://` URI.+/// The resource behind a `pdfcraft://` URI.#[derive(Debug, PartialEq)]enum Resource {Info(u64),@@ -128,7 +128,7 @@ enum Resource {}fn parse_uri(uri: &str) -> Option<Resource> {- let rest = uri.strip_prefix("printcraft://doc/")?;+ let rest = uri.strip_prefix("pdfcraft://doc/")?;let (path, query) = rest.split_once('?').unwrap_or((rest, ""));let dpi = query.split('&').find_map(|kv| kv.strip_prefix("dpi=")).and_then(|v| v.parse::<f64>().ok());let parts: Vec<&str> = path.split('/').collect();@@ -144,13 +144,13 @@ fn parse_uri(uri: &str) -> Option<Resource> {fn resource_templates() -> Value {json!([- { "uriTemplate": "printcraft://doc/{doc}/info", "name": "Document information", "mimeType": "application/json",+ { "uriTemplate": "pdfcraft://doc/{doc}/info", "name": "Document information", "mimeType": "application/json","description": "Metadata, pages, bookmarks, annotations, fields, links, layers, attachments, fonts and security of an open document (as doc_info)." },- { "uriTemplate": "printcraft://doc/{doc}/text", "name": "Document text", "mimeType": "text/plain",+ { "uriTemplate": "pdfcraft://doc/{doc}/text", "name": "Document text", "mimeType": "text/plain","description": "The text of every page in reading order, each page under a \"Page n\" heading." },- { "uriTemplate": "printcraft://doc/{doc}/page/{page}/text", "name": "Page text", "mimeType": "text/plain",+ { "uriTemplate": "pdfcraft://doc/{doc}/page/{page}/text", "name": "Page text", "mimeType": "text/plain","description": "The text of one page (1-based) in reading order." },- { "uriTemplate": "printcraft://doc/{doc}/page/{page}/image{?dpi}", "name": "Page image", "mimeType": "image/png",+ { "uriTemplate": "pdfcraft://doc/{doc}/page/{page}/image{?dpi}", "name": "Page image", "mimeType": "image/png","description": "One page (1-based) rendered to PNG; dpi 1–600, default 96." },])}@@ -164,15 +164,15 @@ impl McpServer {let mut out = Vec::new();for d in docs.unwrap_or_default() {let (id, name) = (d["doc"].as_u64().unwrap_or(0), d["name"].as_str().unwrap_or("document"));- out.push(- json!({ "uri": format!("printcraft://doc/{id}/info"), "name": format!("{name} (information)"), "mimeType": "application/json" }),- );- out.push(json!({ "uri": format!("printcraft://doc/{id}/text"), "name": format!("{name} (text)"), "mimeType": "text/plain" }));+ out.push(json!({ "uri": format!("pdfcraft://doc/{id}/info"), "name": format!("{name} (information)"), "mimeType": "application/json" }));+ out.push(json!({ "uri": format!("pdfcraft://doc/{id}/text"), "name": format!("{name} (text)"), "mimeType": "text/plain" }));// Pages are listed for short documents; longer ones use the templates.let pages = d["pages"].as_u64().unwrap_or(0);if pages <= 50 {for p in 1..=pages {- out.push(json!({ "uri": format!("printcraft://doc/{id}/page/{p}/image"), "name": format!("{name}, page {p}"), "mimeType": "image/png" }));+ out.push(+ json!({ "uri": format!("pdfcraft://doc/{id}/page/{p}/image"), "name": format!("{name}, page {p}"), "mimeType": "image/png" }),+ );}}}@@ -266,10 +266,10 @@ mod tests {#[test]fn resource_uris_parse() {- assert_eq!(parse_uri("printcraft://doc/3/info"), Some(Resource::Info(3)));- assert_eq!(parse_uri("printcraft://doc/3/page/2/image?dpi=36"), Some(Resource::PageImage(3, 2, Some(36.0))));- assert_eq!(parse_uri("printcraft://doc/3/page/2/text"), Some(Resource::PageText(3, 2)));- assert_eq!(parse_uri("printcraft://doc/x/info"), None);+ assert_eq!(parse_uri("pdfcraft://doc/3/info"), Some(Resource::Info(3)));+ assert_eq!(parse_uri("pdfcraft://doc/3/page/2/image?dpi=36"), Some(Resource::PageImage(3, 2, Some(36.0))));+ assert_eq!(parse_uri("pdfcraft://doc/3/page/2/text"), Some(Resource::PageText(3, 2)));+ assert_eq!(parse_uri("pdfcraft://doc/x/info"), None);assert_eq!(parse_uri("file:///etc/passwd"), None);}}diff --git a/crates/automation/src/printing.rs b/crates/automation/src/printing.rsindex a56e8ca62..34fd799b8 100644--- a/crates/automation/src/printing.rs+++ b/crates/automation/src/printing.rs@@ -1,7 +1,7 @@//! Printing tools: list printers, and print (or save the print-ready PDF) with Acrobat's Print//! dialog options.-use printcraft_engine::print::{self, Binding, BookletSubset, Content, Layout, Orientation, PAPERS, PageOrder, SizeMode, Subset, spool};+use pdfcraft_engine::print::{self, Binding, BookletSubset, Content, Layout, Orientation, PAPERS, PageOrder, SizeMode, Subset, spool};use serde_json::{Value, json};use crate::{Args, Automation, Result, ToolError, failed, write_atomic};diff --git a/crates/automation/src/redact.rs b/crates/automation/src/redact.rsindex 6c68ade66..6f322cd93 100644--- a/crates/automation/src/redact.rs+++ b/crates/automation/src/redact.rs@@ -1,7 +1,7 @@//! Redaction tools: mark areas, text, patterns or whole pages for redaction, apply the marks//! (removing what they cover for good) or clear them.-use printcraft_engine::{Edit, Hidden, NewAnnotation, RedactPattern, Shape, Style, find_pattern, rect_quad};+use pdfcraft_engine::{Edit, Hidden, NewAnnotation, RedactPattern, Shape, Style, find_pattern, rect_quad};use serde_json::{Value, json};use crate::comments::{DEFAULT_AUTHOR, parse_color};diff --git a/crates/automation/src/signing.rs b/crates/automation/src/signing.rsindex c9bfebe9f..ce60b33c3 100644--- a/crates/automation/src/signing.rs+++ b/crates/automation/src/signing.rs@@ -2,8 +2,8 @@//! document, and manage trusted certificates. Rectangles are points from the top-left of the//! displayed page.-use printcraft_engine::sign::{self, Certificate, DigitalId, Modification, Name, PrivateKey};-use printcraft_engine::{SignOptions, SignatureInfo, SignatureStatus};+use pdfcraft_engine::sign::{self, Certificate, DigitalId, Modification, Name, PrivateKey};+use pdfcraft_engine::{SignOptions, SignatureInfo, SignatureStatus};use serde_json::{Value, json};use crate::{Args, Automation, Result, ToolError, failed, write_atomic};diff --git a/crates/automation/src/tools.rs b/crates/automation/src/tools.rsindex f27e993fd..21828c84e 100644--- a/crates/automation/src/tools.rs+++ b/crates/automation/src/tools.rs@@ -690,7 +690,7 @@ pub fn tools() -> Vec<ToolDef> {json!({ "doc": doc(), "pages": pages("to fill (default: all)"), "color": { "type": "string" }, "file": { "type": "string" }, "file_page": { "type": "integer", "minimum": 1 }, "scale": { "type": "number", "exclusiveMinimum": 0, "maximum": 1 }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "replace": { "type": "boolean" } }),&["doc"],)),- t("doc_remove_marks", "Remove header & footer, watermark or background", "Remove every header and footer, watermark or background PrintCraft (or a compatible tool) added. Undoable.")+ t("doc_remove_marks", "Remove header & footer, watermark or background", "Remove every header and footer, watermark or background PdfCraft (or a compatible tool) added. Undoable.").destructive().with(schema(json!({ "doc": doc(), "kind": { "type": "string", "enum": ["header_footer", "watermark", "background"] } }), &["doc", "kind"])),t("doc_export_images", "Export pages as images", "Write pages as PNG, JPEG or TIFF files (`<name>_page_<n>.png|jpg|tif`) into a folder, at a resolution (default 150 dpi). JPEG and TIFF are flattened onto white paper. Includes unsaved edits.")@@ -841,7 +841,7 @@ pub fn tools() -> Vec<ToolDef> {}),&["paths", "folder"],)),- t("ocr_status", "OCR status", "Whether text recognition is available (its models are installed: run `cargo xtask models` or set PRINTCRAFT_MODELS), where it looks for them, and the languages it reads.")+ t("ocr_status", "OCR status", "Whether text recognition is available (its models are installed: run `cargo xtask models` or set PDFCRAFT_MODELS), where it looks for them, and the languages it reads.").ro().cmd("ocr.recognize").with(schema(json!({}), &[])),@@ -999,7 +999,7 @@ pub fn tools() -> Vec<ToolDef> {.with(schema(json!({ "doc": doc(), "comments": { "type": "boolean", "description": "Default true." }, "fields": { "type": "boolean", "description": "Default true." } }), &["doc"])),t("edit_undo", "Undo", "Undo the last edit of a document.").cmd("edit.undo").with(schema(json!({ "doc": doc() }), &["doc"])),t("edit_redo", "Redo", "Redo the last undone edit of a document.").cmd("edit.redo").with(schema(json!({ "doc": doc() }), &["doc"])),- t("command_list", "List commands", "Every registered PrintCraft command with its menu, shortcut, whether it is enabled now, and the tool that automates it.")+ t("command_list", "List commands", "Every registered PdfCraft command with its menu, shortcut, whether it is enabled now, and the tool that automates it.").ro().with(schema(json!({ "doc": doc() }), &[])),]diff --git a/crates/automation/tests/automation.rs b/crates/automation/tests/automation.rsindex 578a1b235..13e35ea18 100644--- a/crates/automation/tests/automation.rs+++ b/crates/automation/tests/automation.rs@@ -3,8 +3,8 @@use std::path::{Path, PathBuf};#[cfg(feature = "mcp")]-use printcraft_automation::mcp::McpServer;-use printcraft_automation::{Automation, Content, ToolError, tools};+use pdfcraft_automation::mcp::McpServer;+use pdfcraft_automation::{Automation, Content, ToolError, tools};use serde_json::{Value, json};/// A PDF with `n` 200×300 pt pages reading "Page 1", "Page 2", …@@ -37,7 +37,7 @@ fn fixture(n: usize) -> Vec<u8> {/// A fresh directory with `a.pdf` (3 pages) and `b.pdf` (2 pages).fn workdir(test: &str) -> PathBuf {- let dir = std::env::temp_dir().join(format!("printcraft-automation-{test}-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-automation-{test}-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);std::fs::create_dir_all(&dir).unwrap();std::fs::write(dir.join("a.pdf"), fixture(3)).unwrap();@@ -77,7 +77,7 @@ fn tool_table_is_well_formed() {}assert!(!(t.read_only && t.destructive), "{} is both read-only and destructive", t.name);if let Some(c) = t.command {- assert!(printcraft_engine::commands::command(c).is_some(), "{} names unregistered command {c}", t.name);+ assert!(pdfcraft_engine::commands::command(c).is_some(), "{} names unregistered command {c}", t.name);}}}@@ -206,11 +206,11 @@ fn errors_are_specific_and_safe() {assert_eq!(ok(&mut a, "doc_list", json!({}))["documents"], json!([]));// The root confines reads and writes.- let outside = std::env::temp_dir().join("printcraft-automation-outside.pdf");+ let outside = std::env::temp_dir().join("pdfcraft-automation-outside.pdf");std::fs::write(&outside, fixture(1)).unwrap();assert!(matches!(err(&mut a, "doc_open", json!({ "path": outside.to_str().unwrap() })), ToolError::Failed(m) if m.contains("outside")));assert!(- matches!(err(&mut a, "doc_open", json!({ "path": "../printcraft-automation-outside.pdf" })), ToolError::Failed(m) if m.contains("outside"))+ matches!(err(&mut a, "doc_open", json!({ "path": "../pdfcraft-automation-outside.pdf" })), ToolError::Failed(m) if m.contains("outside")));let doc = ok(&mut a, "doc_open", json!({ "path": "a.pdf" }))["doc"].as_u64().unwrap();assert!(a.call("doc_save", &json!({ "doc": doc, "path": "new/../../escape.pdf" })).is_err());@@ -265,7 +265,7 @@ fn mcp_session_over_stdio() {assert_eq!(replies.len(), 4, "the notification gets no reply");assert_eq!(replies[0]["result"]["protocolVersion"], "2025-03-26");- assert_eq!(replies[0]["result"]["serverInfo"]["name"], "printcraft");+ assert_eq!(replies[0]["result"]["serverInfo"]["name"], "pdfcraft");assert_eq!(replies[1]["result"]["tools"].as_array().unwrap().len(), tools().len());assert_eq!(replies[2]["result"]["structuredContent"]["pages"], 3);assert_eq!(replies[2]["result"]["isError"], false);@@ -283,7 +283,7 @@ fn mcp_errors() {assert_eq!(rpc(&mut s, 1, "initialize", json!({ "protocolVersion": "1999-01-01" }))["result"]["protocolVersion"], "2025-06-18");assert_eq!(rpc(&mut s, 2, "ping", json!({}))["result"], json!({}));assert_eq!(rpc(&mut s, 3, "prompts/list", json!({}))["error"]["code"], -32601);- assert_eq!(rpc(&mut s, 6, "resources/read", json!({ "uri": "printcraft://doc/9/info" }))["error"]["code"], -32602);+ assert_eq!(rpc(&mut s, 6, "resources/read", json!({ "uri": "pdfcraft://doc/9/info" }))["error"]["code"], -32602);assert_eq!(rpc(&mut s, 4, "tools/call", json!({ "name": "nope" }))["error"]["code"], -32602);let failed = rpc(&mut s, 5, "tools/call", json!({ "name": "doc_open", "arguments": { "path": "/definitely/not/here.pdf" } }));assert_eq!(failed["result"]["isError"], true);@@ -303,19 +303,19 @@ fn mcp_resources_expose_open_documents() {rpc(&mut s, 4, "tools/call", json!({ "name": "doc_open", "arguments": { "path": "a.pdf" } }));let list = rpc(&mut s, 5, "resources/list", json!({}))["result"]["resources"].as_array().cloned().unwrap();assert_eq!(list.len(), 2 + 3, "info, text and three page images");- assert_eq!(list[0]["uri"], "printcraft://doc/1/info");+ assert_eq!(list[0]["uri"], "pdfcraft://doc/1/info");let read = |s: &mut McpServer, uri: &str| rpc(s, 6, "resources/read", json!({ "uri": uri }))["result"]["contents"][0].clone();- let text = read(&mut s, "printcraft://doc/1/text");+ let text = read(&mut s, "pdfcraft://doc/1/text");assert_eq!(text["mimeType"], "text/plain");assert!(text["text"].as_str().unwrap().contains("Page 2\nPage 2"), "{text}");- assert_eq!(read(&mut s, "printcraft://doc/1/page/3/text")["text"], "Page 3");- let info: Value = serde_json::from_str(read(&mut s, "printcraft://doc/1/info")["text"].as_str().unwrap()).unwrap();+ assert_eq!(read(&mut s, "pdfcraft://doc/1/page/3/text")["text"], "Page 3");+ let info: Value = serde_json::from_str(read(&mut s, "pdfcraft://doc/1/info")["text"].as_str().unwrap()).unwrap();assert_eq!(info["pages"].as_array().unwrap().len(), 3);- let img = read(&mut s, "printcraft://doc/1/page/1/image?dpi=36");+ let img = read(&mut s, "pdfcraft://doc/1/page/1/image?dpi=36");use base64::Engine as _;let png = base64::engine::general_purpose::STANDARD.decode(img["blob"].as_str().unwrap()).unwrap();assert_eq!(&png[1..4], b"PNG");- assert_eq!(rpc(&mut s, 7, "resources/read", json!({ "uri": "printcraft://doc/1/page/9/image" }))["error"]["code"], -32602);+ assert_eq!(rpc(&mut s, 7, "resources/read", json!({ "uri": "pdfcraft://doc/1/page/9/image" }))["error"]["code"], -32602);}#[test]@@ -487,7 +487,7 @@ fn protecting_through_tools() {#[test]fn forms_through_tools() {let dir = workdir("forms");- let src = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../dist/demo/printcraft-showcase.pdf");+ let src = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../dist/demo/pdfcraft-showcase.pdf");if !src.exists() {eprintln!("skipped: run `cargo xtask demo-pdf` for the showcase form");return;@@ -1121,9 +1121,9 @@ fn links_through_tools() {assert_eq!(list["count"], 3);let added = list["links"].as_array().unwrap().iter().find(|l| l["to_page"] == 1).unwrap().clone();assert_eq!(added["rect"], json!([72.0, 300.0, 200.0, 320.0]));- ok(&mut a, "link_edit", json!({ "doc": doc, "page": 1, "index": added["index"], "url": "https://printcraft.dev" }));+ ok(&mut a, "link_edit", json!({ "doc": doc, "page": 1, "index": added["index"], "url": "https://pdfcraft.dev" }));let list = ok(&mut a, "link_list", json!({ "doc": doc }));- assert!(list["links"].as_array().unwrap().iter().any(|l| l["url"] == "https://printcraft.dev"));+ assert!(list["links"].as_array().unwrap().iter().any(|l| l["url"] == "https://pdfcraft.dev"));ok(&mut a, "link_delete", json!({ "doc": doc, "page": 1, "index": added["index"] }));let r = ok(&mut a, "links_remove", json!({ "doc": doc }));assert_eq!(r["removed"], 2);diff --git a/crates/compare/Cargo.toml b/crates/compare/Cargo.tomlindex 2182822a0..42c92ee94 100644--- a/crates/compare/Cargo.toml+++ b/crates/compare/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-compare"+name = "pdfcraft-compare"description = "Compare files: word-level text differences between two documents, grouped into changes with their places on the pages"version.workspace = trueedition.workspace = truediff --git a/crates/compare/src/lib.rs b/crates/compare/src/lib.rsindex 31e661c51..91245cbc2 100644--- a/crates/compare/src/lib.rs+++ b/crates/compare/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-compare — Compare files: text differences (L4).+//! pdfcraft-compare — Compare files: text differences (L4).//!//! Both documents' words (in reading order, with page and box) are diffed with Myers'//! O((N+M)·D) algorithm after the common prefix and suffix are set aside; the edit script isdiff --git a/crates/content/Cargo.toml b/crates/content/Cargo.tomlindex d16a7fee5..c553df0b8 100644--- a/crates/content/Cargo.toml+++ b/crates/content/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-content"+name = "pdfcraft-content"description = "Content streams (ISO 32000-2 §7.8, §8–9): operators with source spans, inline images, serializer, matrices"version.workspace = trueedition.workspace = true@@ -9,4 +9,4 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }+pdfcraft-cos = { workspace = true }diff --git a/crates/content/README.md b/crates/content/README.mdindex 9286f04a7..d9d8af10c 100644--- a/crates/content/README.md+++ b/crates/content/README.md@@ -1,4 +1,4 @@-# printcraft-content+# pdfcraft-contentLayer L2: content streams (ISO 32000-2 §7.8.2, §8, §9).diff --git a/crates/content/src/lib.rs b/crates/content/src/lib.rsindex c541d7019..70e173d3a 100644--- a/crates/content/src/lib.rs+++ b/crates/content/src/lib.rs@@ -7,7 +7,7 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Lexer, Object, PdfString, serialize};+use pdfcraft_cos::{Dict, Lexer, Object, PdfString, serialize};#[cfg(test)]mod tests;diff --git a/crates/cos/Cargo.toml b/crates/cos/Cargo.tomlindex 7a82e40f6..f02f63c52 100644--- a/crates/cos/Cargo.toml+++ b/crates/cos/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-cos"+name = "pdfcraft-cos"description = "PDF object layer: lazy tolerant parsing, copy-on-write edits, incremental and full saving"version.workspace = trueedition.workspace = true@@ -9,8 +9,8 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-crypt = { workspace = true }-printcraft-filters = { workspace = true }+pdfcraft-crypt = { workspace = true }+pdfcraft-filters = { workspace = true }thiserror = { workspace = true }[dev-dependencies]diff --git a/crates/cos/examples/cosinfo.rs b/crates/cos/examples/cosinfo.rsindex 7cabf2d25..011bb52b1 100644--- a/crates/cos/examples/cosinfo.rs+++ b/crates/cos/examples/cosinfo.rs@@ -1,8 +1,8 @@//! Print how a file was opened: revisions, repair notes, trailer, security and the catalog.-//! `cargo run -p printcraft-cos --example cosinfo f.pdf [password] [object-number…]`-fn show(o: &printcraft_cos::Object) -> String {+//! `cargo run -p pdfcraft-cos --example cosinfo f.pdf [password] [object-number…]`+fn show(o: &pdfcraft_cos::Object) -> String {let mut t = Vec::new();- printcraft_cos::serialize(o, &mut t);+ pdfcraft_cos::serialize(o, &mut t);let s = String::from_utf8_lossy(&t).into_owned();s.chars().take(400).collect()}@@ -13,13 +13,13 @@ fn main() {let password = args.next().filter(|p| !p.is_empty());let objs: Vec<u32> = args.filter_map(|a| a.parse().ok()).collect();let bytes = std::sync::Arc::new(std::fs::read(&path).expect("readable"));- match printcraft_cos::Document::open_with_password(bytes, password.as_deref()) {+ match pdfcraft_cos::Document::open_with_password(bytes, password.as_deref()) {Ok(doc) => {println!("version {} revisions {:?}", doc.version(), doc.revisions());for r in doc.repair_log() {println!("repair: {r}");}- println!("trailer {}", show(&printcraft_cos::Object::Dict(doc.trailer().clone())));+ println!("trailer {}", show(&pdfcraft_cos::Object::Dict(doc.trailer().clone())));if let Some(s) = doc.security() {println!("security: auth {:?}, key {} bytes, {:?}", s.auth(), s.file_key().len(), s.permissions());}diff --git a/crates/cos/examples/protect.rs b/crates/cos/examples/protect.rsindex f2bb8dd9b..6f27a6096 100644--- a/crates/cos/examples/protect.rs+++ b/crates/cos/examples/protect.rs@@ -1,15 +1,15 @@-//! Encrypt a PDF: `cargo run -p printcraft-cos --example protect in.pdf out.pdf rc4-40|rc4-128|aes-128|aes-256 USER OWNER`+//! Encrypt a PDF: `cargo run -p pdfcraft-cos --example protect in.pdf out.pdf rc4-40|rc4-128|aes-128|aes-256 USER OWNER`fn main() {let a: Vec<String> = std::env::args().skip(1).collect();let [input, output, alg, user, owner] = &a[..] else { panic!("usage: protect in out alg user owner") };let algorithm = match alg.as_str() {- "rc4-40" => printcraft_cos::Algorithm::Rc4_40,- "rc4-128" => printcraft_cos::Algorithm::Rc4_128,- "aes-128" => printcraft_cos::Algorithm::Aes128,- _ => printcraft_cos::Algorithm::Aes256,+ "rc4-40" => pdfcraft_cos::Algorithm::Rc4_40,+ "rc4-128" => pdfcraft_cos::Algorithm::Rc4_128,+ "aes-128" => pdfcraft_cos::Algorithm::Aes128,+ _ => pdfcraft_cos::Algorithm::Aes256,};- let mut doc = printcraft_cos::Document::open(std::sync::Arc::new(std::fs::read(input).unwrap())).unwrap();- doc.set_encryption(&printcraft_cos::NewEncryption {+ let mut doc = pdfcraft_cos::Document::open(std::sync::Arc::new(std::fs::read(input).unwrap())).unwrap();+ doc.set_encryption(&pdfcraft_cos::NewEncryption {algorithm,user_password: user,owner_password: owner,@@ -18,5 +18,5 @@ fn main() {seed: [1; 32],}).unwrap();- std::fs::write(output, printcraft_cos::write_full(&doc, &Default::default()).unwrap()).unwrap();+ std::fs::write(output, pdfcraft_cos::write_full(&doc, &Default::default()).unwrap()).unwrap();}diff --git a/crates/cos/src/document.rs b/crates/cos/src/document.rsindex 0629ba609..910be06b9 100644--- a/crates/cos/src/document.rs+++ b/crates/cos/src/document.rs@@ -99,7 +99,7 @@ pub struct Document {header_offset: usize,version: String,/// The authenticated security handler of an encrypted document.- security: Option<Arc<printcraft_crypt::SecurityHandler>>,+ security: Option<Arc<pdfcraft_crypt::SecurityHandler>>,/// Object number of the `/Encrypt` dictionary (never encrypted itself).encrypt_num: Option<u32>,/// Encryption was added, changed or removed since opening: only a full save can apply it.@@ -107,7 +107,7 @@ pub struct Document {/// Set by edits that must not leave earlier revisions in the file (redaction).full_save: bool,/// The handler and `/Encrypt` object number that saves use, when encryption changed.- out_security: Option<Arc<printcraft_crypt::SecurityHandler>>,+ out_security: Option<Arc<pdfcraft_crypt::SecurityHandler>>,out_encrypt_num: Option<u32>,}@@ -255,9 +255,9 @@ impl Document {Some(Object::Array(a)) => a.first().and_then(|s| s.as_string()).map(|s| s.bytes.clone()).unwrap_or_default(),_ => Vec::new(),};- let handler = printcraft_crypt::SecurityHandler::open(params, &id0, password).map_err(|e| match e {- printcraft_crypt::CryptError::WrongPassword if password.is_none() => CosError::NeedsPassword,- printcraft_crypt::CryptError::WrongPassword => CosError::WrongPassword,+ let handler = pdfcraft_crypt::SecurityHandler::open(params, &id0, password).map_err(|e| match e {+ pdfcraft_crypt::CryptError::WrongPassword if password.is_none() => CosError::NeedsPassword,+ pdfcraft_crypt::CryptError::WrongPassword => CosError::WrongPassword,other => CosError::Security(other.to_string()),})?;self.security = Some(Arc::new(handler));@@ -269,12 +269,12 @@ impl Document {}/// The security handler, when the document is encrypted.- pub fn security(&self) -> Option<&printcraft_crypt::SecurityHandler> {+ pub fn security(&self) -> Option<&pdfcraft_crypt::SecurityHandler> {self.security.as_deref()}/// What the opening password allows (`None` for unencrypted documents: everything).- pub fn permissions(&self) -> Option<printcraft_crypt::Permissions> {+ pub fn permissions(&self) -> Option<pdfcraft_crypt::Permissions> {self.security().map(|s| s.permissions())}@@ -296,19 +296,19 @@ impl Document {/// The handler used to write: the new one after `set_encryption` / `remove_encryption`,/// otherwise the one the document was opened with.- pub(crate) fn output_security(&self) -> (Option<&printcraft_crypt::SecurityHandler>, Option<u32>) {+ pub(crate) fn output_security(&self) -> (Option<&pdfcraft_crypt::SecurityHandler>, Option<u32>) {if self.encryption_changed { (self.out_security.as_deref(), self.out_encrypt_num) } else { (self.security.as_deref(), self.encrypt_num) }}/// The security the next save writes: protection applied with `set_encryption`, none after/// `remove_encryption`, otherwise the security the document was opened with.- pub fn output_handler(&self) -> Option<&printcraft_crypt::SecurityHandler> {+ pub fn output_handler(&self) -> Option<&pdfcraft_crypt::SecurityHandler> {self.output_security().0}/// Protect the document with a password (§7.6.4). Takes effect on the next save, which is/// always a full rewrite. Returns the handler (authenticated as owner).- pub fn set_encryption(&mut self, params: &printcraft_crypt::NewEncryption) -> Result<(), CosError> {+ pub fn set_encryption(&mut self, params: &pdfcraft_crypt::NewEncryption) -> Result<(), CosError> {// The file identifier is part of the key; make sure it exists and keep it.let id0 = match self.trailer.get(b"ID") {Some(Object::Array(a)) if a.len() == 2 => a[0].as_string().map(|s| s.bytes.clone()).unwrap_or_default(),@@ -320,7 +320,7 @@ impl Document {id}};- let h = printcraft_crypt::create(params, &id0).map_err(|e| CosError::Security(e.to_string()))?;+ let h = pdfcraft_crypt::create(params, &id0).map_err(|e| CosError::Security(e.to_string()))?;let d = h.dict();let s = |b: &[u8]| Object::String(crate::PdfString { bytes: b.to_vec(), hex: true });let mut e = Dict::new();@@ -928,7 +928,7 @@ fn generated_id(seed: &[u8; 32]) -> Vec<u8> {let mut out = Vec::new();for i in 0..2u8 {let mut h = std::collections::hash_map::DefaultHasher::new();- (seed, i, b"printcraft id").hash(&mut h);+ (seed, i, b"pdfcraft id").hash(&mut h);out.extend_from_slice(&h.finish().to_be_bytes());}out@@ -1087,7 +1087,7 @@ mod tests {// /W [1 1 1]: at 3 bytes a row that is more than 8,388,607 objects' worth, so it is not// decoded (in full: the limit applies while inflating) and the objects are found by// reconstruction instead.- let bomb = printcraft_filters::encode_flate(&printcraft_filters::encode_flate(&vec![0u8; 32 << 20]));+ let bomb = pdfcraft_filters::encode_flate(&pdfcraft_filters::encode_flate(&vec![0u8; 32 << 20]));let mut bytes = b"%PDF-1.7\n".to_vec();let o1 = bytes.len();bytes.extend_from_slice(b"1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n");diff --git a/crates/cos/src/lib.rs b/crates/cos/src/lib.rsindex ad85c4f83..4cab44d79 100644--- a/crates/cos/src/lib.rs+++ b/crates/cos/src/lib.rs@@ -1,8 +1,8 @@-//! printcraft-cos — the PDF object layer (L1, standalone with `printcraft-filters`).+//! pdfcraft-cos — the PDF object layer (L1, standalone with `pdfcraft-filters`).//!//! Parses the COS object graph lazily and tolerantly, keeps edits in a copy-on-write overlay//! (cheap snapshots for undo), and writes documents back either incrementally (original bytes-//! untouched) or as a full, garbage-collected rewrite. The PDF object graph *is* PrintCraft's+//! untouched) or as a full, garbage-collected rewrite. The PDF object graph *is* PdfCraft's//! document model (plan/architecture.md §5, ADR-0010).//!//! Status (M1 in progress): parsing of all xref forms, object streams, repair by scanning,@@ -20,7 +20,7 @@ mod writer;pub use document::{Document, Revision, XrefEntry};pub use object::{Dict, MAX_DECODED, Name, ObjRef, Object, PdfString, Stream};pub use parser::{Lexer, parse_indirect};-pub use printcraft_crypt::{Algorithm, Auth, Method as CryptMethod, NewEncryption, Permissions, SecurityHandler};+pub use pdfcraft_crypt::{Algorithm, Auth, Method as CryptMethod, NewEncryption, Permissions, SecurityHandler};pub use writer::{SaveOptions, pdf_date, serialize, write_full, write_incremental};#[derive(Debug, thiserror::Error, Clone, PartialEq)]diff --git a/crates/cos/src/object.rs b/crates/cos/src/object.rsindex 96eac347c..983b53736 100644--- a/crates/cos/src/object.rs+++ b/crates/cos/src/object.rs@@ -5,7 +5,7 @@use std::sync::Arc;-use printcraft_filters::{Filter, Params};+use pdfcraft_filters::{Filter, Params};use crate::CosError;@@ -176,7 +176,7 @@ impl Stream {pub fn flate(mut dict: Dict, data: &[u8]) -> Self {dict.set(b"Filter".to_vec(), Object::Name(b"FlateDecode".to_vec()));dict.remove(b"DecodeParms");- Self { dict, raw: Arc::new(printcraft_filters::encode_flate(data)) }+ Self { dict, raw: Arc::new(pdfcraft_filters::encode_flate(data)) }}/// The filter chain declared in the dictionary.@@ -225,7 +225,7 @@ impl Stream {if chain.is_empty() {return Ok(self.raw.as_ref().clone());}- printcraft_filters::decode_tolerant(&chain, &self.raw, max.min(MAX_DECODED)).map(|(v, _)| v).map_err(|e| CosError::Filter(e.to_string()))+ pdfcraft_filters::decode_tolerant(&chain, &self.raw, max.min(MAX_DECODED)).map(|(v, _)| v).map_err(|e| CosError::Filter(e.to_string()))}/// Decoded data; any corruption is an error.@@ -234,7 +234,7 @@ impl Stream {if chain.is_empty() {return Ok(self.raw.as_ref().clone());}- printcraft_filters::decode(&chain, &self.raw, MAX_DECODED).map_err(|e| CosError::Filter(e.to_string()))+ pdfcraft_filters::decode(&chain, &self.raw, MAX_DECODED).map_err(|e| CosError::Filter(e.to_string()))}}diff --git a/crates/cos/src/security.rs b/crates/cos/src/security.rsindex 4db862f66..709176b3e 100644--- a/crates/cos/src/security.rs+++ b/crates/cos/src/security.rs@@ -1,4 +1,4 @@-//! Bridging the COS object model and `printcraft-crypt`: reading `/Encrypt` dictionaries and+//! Bridging the COS object model and `pdfcraft-crypt`: reading `/Encrypt` dictionaries and//! decrypting / encrypting the strings and streams of an object (§7.6.2).//!//! Not encrypted, per the spec: the `/Encrypt` dictionary itself, cross-reference streams, the@@ -6,7 +6,7 @@//! metadata streams when `/EncryptMetadata` is false. Streams naming a crypt filter (`/Crypt` in//! `/Filter`) use that filter; embedded files use `/EFF`.-use printcraft_crypt::{EncryptDict, Method, SecurityHandler, StreamKind};+use pdfcraft_crypt::{EncryptDict, Method, SecurityHandler, StreamKind};use crate::{Dict, Document, Object, PdfString, Stream};diff --git a/crates/cos/tests/corpus.rs b/crates/cos/tests/corpus.rsindex a160e21aa..71a72b372 100644--- a/crates/cos/tests/corpus.rs+++ b/crates/cos/tests/corpus.rs@@ -7,7 +7,7 @@use std::sync::Arc;-use printcraft_cos::{Document, Object, SaveOptions, write_full, write_incremental};+use pdfcraft_cos::{Document, Object, SaveOptions, write_full, write_incremental};/// Leaf pages reachable from the catalog (cycle-safe), like viewers count them.fn page_count(doc: &Document) -> Option<usize> {@@ -56,7 +56,7 @@ fn corpus_parity() {let result = std::panic::catch_unwind(|| -> Result<(), String> {let mut doc = match Document::open(bytes.clone()) {Ok(d) => d,- Err(printcraft_cos::CosError::NeedsPassword) => return Err("encrypted".into()),+ Err(pdfcraft_cos::CosError::NeedsPassword) => return Err("encrypted".into()),Err(e) => return Err(format!("open: {e}")),};// hayro may repair a broken /Count; compare against the leaf walk count loosely.@@ -64,14 +64,14 @@ fn corpus_parity() {return Err(format!("page count {:?} vs hayro {expected}", page_count(&doc)));}let root = doc.root().ok_or("no root")?;- doc.update_dict(root, |d| d.set(b"PrintCraftTest".to_vec(), Object::Bool(true))).map_err(|e| e.to_string())?;+ doc.update_dict(root, |d| d.set(b"PdfCraftTest".to_vec(), Object::Bool(true))).map_err(|e| e.to_string())?;let saved = write_incremental(&doc, &SaveOptions::default()).map_err(|e| format!("save: {e}"))?;// Reconstructed files are rewritten in full; everything else must keep its bytes.if !doc.revisions().is_empty() && saved.get(..bytes.len()) != Some(&bytes[..]) {return Err("prefix modified".into());}let again = Document::open(Arc::new(saved.clone())).map_err(|e| format!("reopen: {e}"))?;- let flag = again.get(again.root().ok_or("no root after save")?).as_dict().and_then(|d| d.get(b"PrintCraftTest").cloned());+ let flag = again.get(again.root().ok_or("no root after save")?).as_dict().and_then(|d| d.get(b"PdfCraftTest").cloned());if flag != Some(Object::Bool(true)) {return Err("edit lost after reopen".into());}@@ -118,10 +118,10 @@ fn corpus_passwords() {for (file, pw) in &cases {let Ok(bytes) = std::fs::read(dir.join(file)) else { continue };let bytes = Arc::new(bytes);- if !matches!(Document::open(bytes.clone()), Err(printcraft_cos::CosError::NeedsPassword)) {+ if !matches!(Document::open(bytes.clone()), Err(pdfcraft_cos::CosError::NeedsPassword)) {failures.push(format!("{file}: opened without a password"));}- if !matches!(Document::open_with_password(bytes.clone(), Some("definitely wrong")), Err(printcraft_cos::CosError::WrongPassword)) {+ if !matches!(Document::open_with_password(bytes.clone(), Some("definitely wrong")), Err(pdfcraft_cos::CosError::WrongPassword)) {failures.push(format!("{file}: wrong password not rejected"));}match Document::open_with_password(bytes.clone(), Some(pw)) {@@ -132,7 +132,7 @@ fn corpus_passwords() {continue;}let root = doc.root().unwrap();- doc.update_dict(root, |d| d.set(b"PrintCraftTest".to_vec(), Object::Bool(true))).unwrap();+ doc.update_dict(root, |d| d.set(b"PdfCraftTest".to_vec(), Object::Bool(true))).unwrap();let saved = write_incremental(&doc, &SaveOptions::default()).unwrap();match Document::open_with_password(Arc::new(saved.clone()), Some(pw)) {Ok(again) if page_count(&again) == pages => {}diff --git a/crates/cos/tests/encryption.rs b/crates/cos/tests/encryption.rsindex 071712d64..83bbaca0c 100644--- a/crates/cos/tests/encryption.rs+++ b/crates/cos/tests/encryption.rs@@ -4,7 +4,7 @@use std::sync::Arc;-use printcraft_cos::{Algorithm, Auth, CosError, Document, NewEncryption, ObjRef, Object, PdfString, SaveOptions, write_full, write_incremental};+use pdfcraft_cos::{Algorithm, Auth, CosError, Document, NewEncryption, ObjRef, Object, PdfString, SaveOptions, write_full, write_incremental};const SECRET: &str = "BT /F1 18 Tf 20 100 Td (Secret page) Tj ET";@@ -180,7 +180,7 @@ fn qpdf_agrees() {eprintln!("qpdf not installed; skipping");return;}- let dir = std::env::temp_dir().join(format!("printcraft-enc-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-enc-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();for alg in ALL {let path = dir.join(format!("{alg:?}.pdf"));diff --git a/crates/cos/tests/writer.rs b/crates/cos/tests/writer.rsindex 3c05e5afe..bfe85882f 100644--- a/crates/cos/tests/writer.rs+++ b/crates/cos/tests/writer.rs@@ -3,7 +3,7 @@use std::sync::Arc;-use printcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, write_full, write_incremental};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, write_full, write_incremental};/// Four pages, a shared font, document info with a non-ASCII title.fn fixture() -> Vec<u8> {@@ -71,10 +71,8 @@ fn incremental_saves_stack_on_an_xref_stream_file() {let mut doc = Document::open(packed.clone()).unwrap();// Edit an object that lives in an object stream.let info = doc.trailer().reference(b"Info").unwrap();- doc.update_dict(info, |d: &mut Dict| {- d.set(b"Title".to_vec(), Object::String(printcraft_cos::PdfString { bytes: b"Second".to_vec(), hex: false }))- })- .unwrap();+ doc.update_dict(info, |d: &mut Dict| d.set(b"Title".to_vec(), Object::String(pdfcraft_cos::PdfString { bytes: b"Second".to_vec(), hex: false })))+ .unwrap();let added = doc.add(Object::Int(42));let updated = write_incremental(&doc, &SaveOptions::default()).unwrap();assert!(updated.starts_with(&packed), "an incremental save only appends");@@ -98,7 +96,7 @@ fn qpdf_accepts_object_stream_output() {assert!(out.status.success());let doc = Document::open(Arc::new(fixture())).unwrap();let packed = write_full(&doc, &SaveOptions::default()).unwrap();- let path = std::env::temp_dir().join(format!("printcraft-objstm-{}.pdf", std::process::id()));+ let path = std::env::temp_dir().join(format!("pdfcraft-objstm-{}.pdf", std::process::id()));std::fs::write(&path, &packed).unwrap();let check = std::process::Command::new("qpdf").arg("--check").arg(&path).output().unwrap();let _ = std::fs::remove_file(&path);@@ -112,8 +110,8 @@ fn objects_referenced_by_the_encrypt_dictionary_stay_outside_object_streams() {// do (pdf.js issue7665). A full save must keep them readable before decryption.let doc = Document::open(Arc::new(fixture())).unwrap();let mut enc = doc.clone();- enc.set_encryption(&printcraft_cos::NewEncryption {- algorithm: printcraft_cos::Algorithm::Aes256,+ enc.set_encryption(&pdfcraft_cos::NewEncryption {+ algorithm: pdfcraft_cos::Algorithm::Aes256,user_password: "",owner_password: "owner",permissions: -4,diff --git a/crates/create/Cargo.toml b/crates/create/Cargo.tomlindex 2f5e8bf39..9ee7d8498 100644--- a/crates/create/Cargo.toml+++ b/crates/create/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-create"+name = "pdfcraft-create"description = "Create PDFs: blank documents, from images (PNG, JPEG) and from plain text"version.workspace = trueedition.workspace = true@@ -9,9 +9,9 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-model = { workspace = true }-printcraft-fonts = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-model = { workspace = true }+pdfcraft-fonts = { workspace = true }png = "0.18"tiff = "0.11"image = { version = "0.25", default-features = false, features = ["bmp", "gif"] }diff --git a/crates/create/README.md b/crates/create/README.mdindex eba6b357e..01f0be61f 100644--- a/crates/create/README.md+++ b/crates/create/README.md@@ -1,4 +1,4 @@-# printcraft-create+# pdfcraft-createLayer L4. Create a PDF (Acrobat's Create a PDF tool), execution plan M10.2:@@ -9,4 +9,4 @@ Layer L4. Create a PDF (Acrobat's Create a PDF tool), execution plan M10.2:with transparency as a soft mask;- `from_text(text, …)`: plain text set in Helvetica, wrapped and paginated.-Every function returns a `printcraft_cos::Document`; the caller writes it.+Every function returns a `pdfcraft_cos::Document`; the caller writes it.diff --git a/crates/create/src/extract.rs b/crates/create/src/extract.rsindex dc4b8486d..6503216f0 100644--- a/crates/create/src/extract.rs+++ b/crates/create/src/extract.rs@@ -1,11 +1,11 @@//! Export a PDF ▸ Image ▸ Export all images, and Edit ▸ Save image as: the images that pages//! use, as files. JPEG images are written unchanged; other images are decoded and written as-//! PNG (with their soft mask as alpha). Images PrintCraft can't decode yet (JPEG 2000, JBIG2,+//! PNG (with their soft mask as alpha). Images PdfCraft can't decode yet (JPEG 2000, JBIG2,//! CCITT, separations) are reported, never silently left out.use std::collections::HashSet;-use printcraft_cos::{Dict, Document, ObjRef, Object, Stream};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, Stream};/// One image, ready to write.#[derive(Clone, Debug, PartialEq)]@@ -33,7 +33,7 @@ const MAX_PIXELS: u64 = 100_000_000;/// The images of `pages` (0-based; each image once, on the first page using it), skipping/// those with fewer than `min_side` pixels on their shorter side.pub fn extract_images(doc: &Document, pages: &[usize], min_side: u32) -> ImageExport {- let all = printcraft_model::pages(doc);+ let all = pdfcraft_model::pages(doc);let mut out = ImageExport::default();let mut seen = HashSet::new();for &p in pages {diff --git a/crates/create/src/lib.rs b/crates/create/src/lib.rsindex cbe21a8ab..3c499ea5c 100644--- a/crates/create/src/lib.rs+++ b/crates/create/src/lib.rs@@ -1,12 +1,12 @@-//! printcraft-create — create PDFs from nothing, images or text (L4). See the README.+//! pdfcraft-create — create PDFs from nothing, images or text (L4). See the README.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};mod extract;pub use extract::{ExtractedImage, ImageExport, extract_images, image_file};-use printcraft_fonts::{literal, win_ansi, wrap};+use pdfcraft_fonts::{literal, win_ansi, wrap};#[derive(Debug, thiserror::Error, PartialEq)]pub enum CreateError {@@ -50,7 +50,7 @@ fn add_page(doc: &mut Document, w: f64, h: f64, resources: Dict, content: Optionfn set_title(doc: &mut Document, title: &str) {let mut info = Dict::new();info.set(b"Title".to_vec(), PdfString::text(title));- info.set(b"Producer".to_vec(), PdfString::text("PrintCraft"));+ info.set(b"Producer".to_vec(), PdfString::text("PdfCraft"));let r = doc.add(info);doc.trailer_mut().set(b"Info".to_vec(), Object::Ref(r));}diff --git a/crates/create/src/tests.rs b/crates/create/src/tests.rsindex e64072663..8b2151681 100644--- a/crates/create/src/tests.rs+++ b/crates/create/src/tests.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use printcraft_cos::{SaveOptions, write_full};+use pdfcraft_cos::{SaveOptions, write_full};use super::*;@@ -168,7 +168,7 @@ fn images_export_as_jpeg_unchanged_and_others_as_png() {fn indexed_and_one_bit_images_decode() {let mut doc = from_images(&[("flat.png".into(), png_bytes(false))]).unwrap();// Replace the page's image with a 4×1 indexed image (two colours) and add a 1-bit mask.- let page = printcraft_model::pages(&doc)[0].clone();+ let page = pdfcraft_model::pages(&doc)[0].clone();let res = doc.resolve(page.dict.get(b"Resources").unwrap()).as_dict().cloned().unwrap();let xo = doc.resolve(res.get(b"XObject").unwrap()).as_dict().cloned().unwrap();let (_, r) = xo.iter().next().map(|(k, v)| (k.clone(), v.as_ref().unwrap())).unwrap();diff --git a/crates/crypt/Cargo.toml b/crates/crypt/Cargo.tomlindex eb07bf148..9edb008f2 100644--- a/crates/crypt/Cargo.toml+++ b/crates/crypt/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-crypt"+name = "pdfcraft-crypt"description = "PDF standard security handler (ISO 32000-2 §7.6): RC4 and AES, revisions 2–6"version.workspace = trueedition.workspace = truediff --git a/crates/crypt/src/lib.rs b/crates/crypt/src/lib.rsindex 5b03f1d60..267c8f1c4 100644--- a/crates/crypt/src/lib.rs+++ b/crates/crypt/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-crypt — the PDF standard security handler (ISO 32000-2 §7.6), standalone (L0).+//! pdfcraft-crypt — the PDF standard security handler (ISO 32000-2 §7.6), standalone (L0).//!//! Supports every revision of the standard handler://! - R2 (40-bit RC4), R3 (RC4 up to 128-bit), R4 (crypt filters: RC4 or AES-128);diff --git a/crates/edit/Cargo.toml b/crates/edit/Cargo.tomlindex ab676c877..1aadd6338 100644--- a/crates/edit/Cargo.toml+++ b/crates/edit/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-edit"+name = "pdfcraft-edit"description = "Page content editing: headers and footers, watermarks, backgrounds, Bates numbers (ISO 32000-2 §14.8)"version.workspace = trueedition.workspace = true@@ -9,12 +9,12 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-content = { workspace = true }-printcraft-fonts = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-content = { workspace = true }+pdfcraft-fonts = { workspace = true }+pdfcraft-model = { workspace = true }thiserror = { workspace = true }[dev-dependencies]hayro-syntax = { workspace = true }-printcraft-annot = { workspace = true }+pdfcraft-annot = { workspace = true }diff --git a/crates/edit/src/added.rs b/crates/edit/src/added.rsindex 111c49401..d189dedf8 100644--- a/crates/edit/src/added.rs+++ b/crates/edit/src/added.rs@@ -7,8 +7,8 @@//! content. Boxes are in display space (origin at the bottom-left of the page as shown, after//! `/Rotate`), so items stay upright on rotated pages.-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};-use printcraft_fonts::{helvetica_width, literal, win_ansi};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};+use pdfcraft_fonts::{helvetica_width, literal, win_ansi};use crate::{EditError, check, contents, n, page_list, place_tagged};@@ -133,8 +133,8 @@ impl AddedImage {/// The matrix from image space (the unit square) to display space: crop, flip, rotate,/// then fill the box.- fn matrix(&self) -> printcraft_content::Matrix {- use printcraft_content::Matrix as M;+ fn matrix(&self) -> pdfcraft_content::Matrix {+ use pdfcraft_content::Matrix as M;let [l, b, r, t] = self.crop.map(|v| v.clamp(0.0, 0.45));let (cw, ch) = ((1.0 - l - r).max(0.05), (1.0 - b - t).max(0.05));let mut m = M([1.0 / cw, 0.0, 0.0, 1.0 / ch, -l / cw, -b / ch]);diff --git a/crates/edit/src/flatten.rs b/crates/edit/src/flatten.rsindex d579d6761..704f12b50 100644--- a/crates/edit/src/flatten.rs+++ b/crates/edit/src/flatten.rs@@ -10,7 +10,7 @@use std::collections::HashSet;-use printcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_cos::{Dict, Document, ObjRef, Object};use crate::{EditError, check, n, page_list, place_tagged};diff --git a/crates/edit/src/images.rs b/crates/edit/src/images.rsindex b112c8405..ff6f5494d 100644--- a/crates/edit/src/images.rs+++ b/crates/edit/src/images.rs@@ -3,8 +3,8 @@//! `q … cm … Q` with the extra transform), replace (it draws another XObject in the same place),//! or delete. Only the stream that draws it is rewritten, as a new object.-use printcraft_content::{Matrix, Op, parse, serialize_ops};-use printcraft_cos::{Dict, Document, ObjRef, Object, Stream};+use pdfcraft_content::{Matrix, Op, parse, serialize_ops};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, Stream};use crate::EditError;@@ -44,8 +44,8 @@ fn streams(doc: &Document, page: &Dict) -> Vec<(Object, Vec<u8>)> {.collect()}-fn page_of(doc: &Document, page: usize) -> Result<printcraft_model::Page, EditError> {- printcraft_model::pages(doc).into_iter().nth(page).ok_or(EditError::NoSuchPage(page))+fn page_of(doc: &Document, page: usize) -> Result<pdfcraft_model::Page, EditError> {+ pdfcraft_model::pages(doc).into_iter().nth(page).ok_or(EditError::NoSuchPage(page))}fn xobjects(doc: &Document, page: &Dict) -> Dict {@@ -149,7 +149,7 @@ pub fn change_image(doc: &mut Document, page: usize, index: usize, change: &Imaglet m = pm.then(&Matrix(*t)).then(&inv);vec![Op::new("q", vec![]),- Op::new("cm", m.0.iter().map(|v| printcraft_content::num(*v)).collect()),+ Op::new("cm", m.0.iter().map(|v| pdfcraft_content::num(*v)).collect()),ops[img.op].clone(),Op::new("Q", vec![]),]diff --git a/crates/edit/src/lib.rs b/crates/edit/src/lib.rsindex d18bd692c..7950184eb 100644--- a/crates/edit/src/lib.rs+++ b/crates/edit/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-edit — page content editing (L4). Today: page marks, Acrobat's Header & footer,+//! pdfcraft-edit — page content editing (L4). Today: page marks, Acrobat's Header & footer,//! Watermark, Background and Bates numbering (execution plan M7.6).//!//! **How marks are stored.** Each mark is one content stream appended to (or, for content behind@@ -14,8 +14,8 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, Object, Stream};-use printcraft_fonts::{helvetica_width, literal, win_ansi};+use pdfcraft_cos::{Dict, Document, Object, Stream};+use pdfcraft_fonts::{helvetica_width, literal, win_ansi};#[derive(Debug, thiserror::Error, PartialEq)]pub enum EditError {@@ -24,7 +24,7 @@ pub enum EditError {#[error("{0}")]Invalid(String),#[error("{0}")]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}/// The kinds of page marks.@@ -76,7 +76,7 @@ impl Default for HeaderFooter {/// the document, an image (drawn into a unit square) or a form (a page of a PDF).#[derive(Clone, Copy, Debug, PartialEq)]pub struct MarkSource {- pub xobject: printcraft_cos::ObjRef,+ pub xobject: pdfcraft_cos::ObjRef,/// Its natural size in points.pub size: (f64, f64),/// An image XObject (unit square); otherwise a form whose `/Matrix` maps it to `size`.@@ -154,7 +154,7 @@ fn picture(src: &MarkSource, page: (f64, f64), scale: f64, rotation: f64, offset}/// Register a mark picture in the page's own resources (`/PCPic<num>`).-fn add_picture_resource(doc: &mut Document, page: &printcraft_model::Page, src: &MarkSource) -> Result<(), EditError> {+fn add_picture_resource(doc: &mut Document, page: &pdfcraft_model::Page, src: &MarkSource) -> Result<(), EditError> {let p = doc.get(page.obj).as_dict().cloned().unwrap_or_default();let mut res = p.get(b"Resources").map(|r| doc.resolve(r)).and_then(|r| r.as_dict().cloned()).unwrap_or_default();let mut xo = res.get(b"XObject").map(|x| doc.resolve(x)).and_then(|x| x.as_dict().cloned()).unwrap_or_default();@@ -238,8 +238,8 @@ fn bates_start(template: &str) -> Option<u64> {t.split('#').nth(2).and_then(|s| s.parse().ok()).or(Some(1))}-fn page_list(doc: &Document) -> Vec<printcraft_model::Page> {- printcraft_model::pages(doc)+fn page_list(doc: &Document) -> Vec<pdfcraft_model::Page> {+ pdfcraft_model::pages(doc)}fn check(pages: &[usize], count: usize) -> Result<(), EditError> {@@ -250,7 +250,7 @@ fn check(pages: &[usize], count: usize) -> Result<(), EditError> {}/// The page's `/Contents` as a list of stream references (inline content is promoted).-fn contents(doc: &mut Document, page: &printcraft_model::Page) -> Result<Vec<Object>, EditError> {+fn contents(doc: &mut Document, page: &pdfcraft_model::Page) -> Result<Vec<Object>, EditError> {let obj = doc.get(page.obj);let d = obj.as_dict().cloned().unwrap_or_default();Ok(match d.get(b"Contents").cloned() {@@ -265,7 +265,7 @@ fn contents(doc: &mut Document, page: &printcraft_model::Page) -> Result<Vec<Obj}/// Add the font (and an opacity state) to the page's own resources.-fn add_resources(doc: &mut Document, page: &printcraft_model::Page, opacity: Option<f64>, content: Option<&[u8]>) -> Result<(), EditError> {+fn add_resources(doc: &mut Document, page: &pdfcraft_model::Page, opacity: Option<f64>, content: Option<&[u8]>) -> Result<(), EditError> {let mut res = page.dict.get(b"Resources").map(|r| doc.resolve(r)).and_then(|r| r.as_dict().cloned()).unwrap_or_default();let mut fonts = res.get(b"Font").map(|f| doc.resolve(f)).and_then(|f| f.as_dict().cloned()).unwrap_or_default();for (name, base) in [(&b"PCHelv"[..], "Helvetica"), (b"PCTimes", "Times-Roman"), (b"PCCour", "Courier")] {@@ -296,8 +296,8 @@ fn add_resources(doc: &mut Document, page: &printcraft_model::Page, opacity: OptOk(())}-const WRAP_OPEN: &[u8] = b"q %PrintCraft\n";-const WRAP_CLOSE: &[u8] = b"Q %PrintCraft\n";+const WRAP_OPEN: &[u8] = b"q %PdfCraft\n";+const WRAP_CLOSE: &[u8] = b"Q %PdfCraft\n";#[cfg(test)]fn stream_bytes(doc: &Document, o: &Object) -> Option<Vec<u8>> {@@ -322,12 +322,12 @@ fn tagged(tag: &str) -> Dict {/// Put a mark's content on a page: behind (prepended) or on top (appended, after wrapping the/// original content in q/Q).-fn place(doc: &mut Document, page: &printcraft_model::Page, kind: MarkKind, content: Vec<u8>, behind: bool) -> Result<(), EditError> {+fn place(doc: &mut Document, page: &pdfcraft_model::Page, kind: MarkKind, content: Vec<u8>, behind: bool) -> Result<(), EditError> {place_tagged(doc, page, kind.tag(), content, behind)}/// Put content on a page, tagged `tag` (see [`place`]).-fn place_tagged(doc: &mut Document, page: &printcraft_model::Page, tag: &str, content: Vec<u8>, behind: bool) -> Result<(), EditError> {+fn place_tagged(doc: &mut Document, page: &pdfcraft_model::Page, tag: &str, content: Vec<u8>, behind: bool) -> Result<(), EditError> {let mut list = contents(doc, page)?;let mark = Object::Ref(doc.add(Object::Stream(Stream::flate(tagged(tag), &content))));if behind {diff --git a/crates/edit/src/tests.rs b/crates/edit/src/tests.rsindex fb0720148..f8a5d67e8 100644--- a/crates/edit/src/tests.rs+++ b/crates/edit/src/tests.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use printcraft_cos::{Document, SaveOptions, write_incremental};+use pdfcraft_cos::{Document, SaveOptions, write_incremental};use super::*;@@ -40,7 +40,7 @@ fn reopen(doc: &Document) -> Document {/// The decoded content streams of a page, in order.fn streams(doc: &Document, page: usize) -> Vec<String> {- let p = &printcraft_model::pages(doc)[page];+ let p = &pdfcraft_model::pages(doc)[page];let c = p.dict.get(b"Contents").cloned();let list = match c.map(|c| doc.resolve(&c)).as_deref() {Some(Object::Array(a)) => a.clone(),@@ -77,7 +77,7 @@ fn header_and_footer_are_drawn_in_display_space_and_wrap_the_original_content()let s0 = streams(&doc, 0);// q-wrapper, original, Q-wrapper, header/footer.assert_eq!(s0.len(), 4, "{s0:?}");- assert_eq!((s0[0].as_str(), s0[2].as_str()), ("q %PrintCraft\n", "Q %PrintCraft\n"));+ assert_eq!((s0[0].as_str(), s0[2].as_str()), ("q %PdfCraft\n", "Q %PdfCraft\n"));let mark = &s0[3];assert!(mark.contains("/PCMark /HeaderFooter") && mark.contains("(Page 1 of 3) Tj") && mark.contains("(Confidential \\(draft\\)) Tj"), "{mark}");assert!(mark.contains("1 0 0 1 0 0 cm"), "upright page: identity");@@ -86,11 +86,11 @@ fn header_and_footer_are_drawn_in_display_space_and_wrap_the_original_content()assert!(s1.last().unwrap().contains("0 1 -1 0 600 0 cm") && s1.last().unwrap().contains("(Page 2 of 3)"), "{s1:?}");// A page without content gets just the mark; its inherited resources are copied, not changed.assert_eq!(streams(&doc, 2).len(), 1);- let p2 = &printcraft_model::pages(&doc)[2];+ let p2 = &pdfcraft_model::pages(&doc)[2];let res = doc.resolve(p2.dict.get(b"Resources").unwrap());let fonts = doc.resolve(res.as_dict().unwrap().get(b"Font").unwrap());assert!(fonts.as_dict().unwrap().contains(b"PCHelv") && fonts.as_dict().unwrap().contains(b"F1"));- let shared = doc.get(printcraft_cos::ObjRef::new(6, 0));+ let shared = doc.get(pdfcraft_cos::ObjRef::new(6, 0));let shared_fonts = doc.resolve(shared.as_dict().unwrap().get(b"Font").unwrap());assert!(!shared_fonts.as_dict().unwrap().contains(b"PCHelv"), "the shared dictionary is untouched");assert_eq!(marks_present(&doc), [MarkKind::HeaderFooter]);@@ -145,7 +145,7 @@ fn invalid_requests_change_nothing() {#[test]fn flattening_draws_appearances_into_the_page_and_removes_the_comments() {- use printcraft_annot::{Meta, NewAnnotation, NoteIcon, Shape, Style, add_annotation, add_reply};+ use pdfcraft_annot::{Meta, NewAnnotation, NoteIcon, Shape, Style, add_annotation, add_reply};let mut doc = fixture();let meta = Meta { date: None, id: "x".into() };let add = |doc: &mut Document, shape: Shape| {@@ -159,7 +159,7 @@ fn flattening_draws_appearances_into_the_page_and_removes_the_comments() {let n = flatten(&mut doc, &[0], true, false).unwrap();assert_eq!(n, 2, "the rectangle and the note icon are drawn; the reply has nothing to draw");let doc = reopen(&doc);- let p = &printcraft_model::pages(&doc)[0];+ let p = &pdfcraft_model::pages(&doc)[0];assert!(!p.dict.contains(b"Annots"), "comments, pop-up and reply are gone");let s = streams(&doc, 0);assert_eq!(s.len(), before.len() + 3, "wrapped original + flattened content: {s:?}");@@ -281,7 +281,7 @@ fn descriptor_text_page() -> Document {/// The Japanese fallback face comes from craft-fonts, an optional build input.fn without_craft_fonts(test: &str) -> bool {- if printcraft_fonts::document_japanese_font().is_some() {+ if pdfcraft_fonts::document_japanese_font().is_some() {return false;}eprintln!("skipping {test}: built without craft-fonts (set CRAFT_FONTS_DIR to run it)");@@ -324,7 +324,7 @@ fn japanese_edit_without_craft_fonts_is_a_clear_error() {let before = page_content_bytes(&doc, 0);let line = text::replace_line(&mut doc, 0, 0, "日本語の文字");let block = text::replace_block(&mut doc, 0, 0, "日本語の文字");- if printcraft_fonts::document_japanese_font().is_some() {+ if pdfcraft_fonts::document_japanese_font().is_some() {eprintln!("built with craft-fonts: the Japanese edits succeed (checked by the tests above)");assert!(line.is_ok() && block.is_ok());return;@@ -411,7 +411,7 @@ fn paragraphs_are_found_and_rewrapped() {assert_eq!(blocks[0].lines, [0, 1, 2]);let width = blocks[0].rect[2] - blocks[0].rect[0];let next = blocks[1].rect;- let long = "PrintCraft rewraps a paragraph to its own width when its text changes, keeping the font, size, colour and line spacing.";+ let long = "PdfCraft rewraps a paragraph to its own width when its text changes, keeping the font, size, colour and line spacing.";assert_eq!(text::replace_block(&mut doc, 0, 0, long).unwrap().substituted, None);let doc = reopen(&doc);let lines = text::text_lines(&doc, 0).unwrap();@@ -438,14 +438,14 @@ fn paragraphs_are_found_and_rewrapped() {}fn page_content_bytes(doc: &Document, page: usize) -> Vec<u8> {- let p = printcraft_model::pages(doc).swap_remove(page);+ let p = pdfcraft_model::pages(doc).swap_remove(page);let c = p.dict.get(b"Contents").unwrap();match &*doc.resolve(c) {- printcraft_cos::Object::Stream(s) => s.decoded().unwrap(),- printcraft_cos::Object::Array(a) => a+ pdfcraft_cos::Object::Stream(s) => s.decoded().unwrap(),+ pdfcraft_cos::Object::Array(a) => a.iter().flat_map(|x| match &*doc.resolve(x) {- printcraft_cos::Object::Stream(s) => s.decoded().unwrap(),+ pdfcraft_cos::Object::Stream(s) => s.decoded().unwrap(),_ => Vec::new(),}).collect(),@@ -505,16 +505,16 @@ fn page_images_move_turn_replace_and_delete() {// The text after it is untouched.assert_eq!(text::text_lines(&doc, 0).unwrap()[0].text, "Caption");// Replace with another image object, in the same place.- let mut d = printcraft_cos::Dict::new();+ let mut d = pdfcraft_cos::Dict::new();for (k, v) in [- (&b"Type"[..], printcraft_cos::Object::name("XObject")),- (b"Subtype", printcraft_cos::Object::name("Image")),- (b"Width", printcraft_cos::Object::Int(1)),- (b"Height", printcraft_cos::Object::Int(1)),+ (&b"Type"[..], pdfcraft_cos::Object::name("XObject")),+ (b"Subtype", pdfcraft_cos::Object::name("Image")),+ (b"Width", pdfcraft_cos::Object::Int(1)),+ (b"Height", pdfcraft_cos::Object::Int(1)),] {d.set(k.to_vec(), v);}- let other = doc.add(printcraft_cos::Object::Stream(printcraft_cos::Stream::from_raw(d, vec![0])));+ let other = doc.add(pdfcraft_cos::Object::Stream(pdfcraft_cos::Stream::from_raw(d, vec![0])));images::change_image(&mut doc, 0, 0, &images::ImageChange::Replace(other)).unwrap();let imgs = images::page_images(&doc, 0).unwrap();assert_eq!((imgs[0].object, imgs[0].width), (Some(other), 1));@@ -566,13 +566,13 @@ fn a_new_paragraph_colour_does_not_spill_into_the_text_after_it() {text::rewrite_block(&mut doc, 0, 0, None, &style).unwrap();let doc = reopen(&doc);// The fill colour in force where the second paragraph is shown (q/Q nest it).- let ops = printcraft_content::parse(&page_content_bytes(&doc, 0)).ops;+ let ops = pdfcraft_content::parse(&page_content_bytes(&doc, 0)).ops;let (mut fill, mut stack) = (String::from("0 g"), Vec::new());for op in &ops {match op.op.as_slice() {b"q" => stack.push(fill.clone()),b"Q" => fill = stack.pop().unwrap_or_default(),- b"g" | b"rg" | b"k" => fill = String::from_utf8_lossy(&printcraft_content::serialize_ops(std::slice::from_ref(op))).trim().to_string(),+ b"g" | b"rg" | b"k" => fill = String::from_utf8_lossy(&pdfcraft_content::serialize_ops(std::slice::from_ref(op))).trim().to_string(),b"Tj" if op.operands.first().and_then(|o| o.as_string()).is_some_and(|s| s.to_text() == "Second paragraph") => break,_ => {}}@@ -609,7 +609,7 @@ fn recolouring_a_paragraph_in_a_shared_text_object_keeps_order_and_nesting() {let doc = reopen(&doc);let texts: Vec<String> = text::text_blocks(&doc, 0).unwrap().into_iter().map(|b| b.text).collect();assert_eq!(texts, ["First paragraph", "Second paragraph", "Third paragraph"]);- let ops = printcraft_content::parse(&page_content_bytes(&doc, 0)).ops;+ let ops = pdfcraft_content::parse(&page_content_bytes(&doc, 0)).ops;let (mut in_text, mut depth, mut red) = (false, 0usize, Vec::new());for op in &ops {match op.op.as_slice() {diff --git a/crates/edit/src/text.rs b/crates/edit/src/text.rsindex 987e59a2d..2454be81a 100644--- a/crates/edit/src/text.rs+++ b/crates/edit/src/text.rs@@ -13,10 +13,10 @@use std::collections::HashMap;use std::rc::Rc;-use printcraft_content::{Matrix, Op, parse, serialize_ops};-use printcraft_cos::{Dict, Document, Object, PdfString, Stream};-use printcraft_fonts::pdf::Metrics;-use printcraft_fonts::{GlyphError, japanese_glyph};+use pdfcraft_content::{Matrix, Op, parse, serialize_ops};+use pdfcraft_cos::{Dict, Document, Object, PdfString, Stream};+use pdfcraft_fonts::pdf::Metrics;+use pdfcraft_fonts::{GlyphError, japanese_glyph};use crate::EditError;@@ -71,7 +71,7 @@ impl TextState {/// Operators that set this state (inside a text object).fn ops(&self) -> Vec<Op> {- let n = printcraft_content::num;+ let n = pdfcraft_content::num;let mut v = Vec::new();if let Some((f, size)) = &self.font {v.push(Op::new("Tf", vec![Object::name(f), n(*size)]));@@ -167,8 +167,8 @@ fn content_streams(doc: &Document, page: &Dict) -> Vec<(Object, Vec<u8>)> {.collect()}-fn page_dict(doc: &Document, page: usize) -> Result<printcraft_model::Page, EditError> {- printcraft_model::pages(doc).into_iter().nth(page).ok_or(EditError::NoSuchPage(page))+fn page_dict(doc: &Document, page: usize) -> Result<pdfcraft_model::Page, EditError> {+ pdfcraft_model::pages(doc).into_iter().nth(page).ok_or(EditError::NoSuchPage(page))}fn fill_color(fill: &[Op]) -> [f64; 3] {@@ -516,14 +516,14 @@ fn unicode_hex(ch: char) -> String {/// This build has no Japanese face to draw replacement text with.fn no_japanese_font() -> EditError {EditError::Invalid(- "this text needs PrintCraft's Japanese fallback font, which this build doesn't include \+ "this text needs PdfCraft's Japanese fallback font, which this build doesn't include \(official releases do; to build it in, set CRAFT_FONTS_DIR to a craft-fonts checkout)".into(),)}fn type3_font(doc: &mut Document, fonts_res: &mut Dict, text: &str) -> Result<Type3Fallback, EditError> {- let family = printcraft_fonts::document_japanese_font().ok_or_else(no_japanese_font)?.family;+ let family = pdfcraft_fonts::document_japanese_font().ok_or_else(no_japanese_font)?.family;let mut chars = Vec::new();for ch in text.chars() {if !chars.contains(&ch) {@@ -628,12 +628,12 @@ pub fn replace_line(doc: &mut Document, page: usize, line: usize, text: &str) ->let bytes = type3_encode(&fallback, &text).ok_or_else(|| EditError::Invalid(format!("\"{text}\" can't be shown by the Japanese fallback")))?;let size = font_size_before(&ops, first).unwrap_or(target.size);- replacement.push(Op::new("Tf", vec![Object::name(&fallback.name), printcraft_content::num(size)]));+ replacement.push(Op::new("Tf", vec![Object::name(&fallback.name), pdfcraft_content::num(size)]));replacement.push(Op::new("Tj", vec![Object::String(PdfString::literal(bytes))]));- replacement.push(Op::new("Tf", vec![Object::name(&target.font), printcraft_content::num(size)]));+ replacement.push(Op::new("Tf", vec![Object::name(&target.font), pdfcraft_content::num(size)]));substituted = Some(format!("{} Type3", fallback.family));} else {- let win = printcraft_fonts::win_ansi(&text);+ let win = pdfcraft_fonts::win_ansi(&text);// WinAnsi turns what it can't show into '?'; refuse rather than print the wrong thing.let back: String = win.iter().map(|b| char::from_u32(u32::from(*b)).unwrap_or('?')).collect();if text.chars().zip(back.chars()).any(|(a, b)| b == '?' && a != '?') {@@ -644,9 +644,9 @@ pub fn replace_line(doc: &mut Document, page: usize, line: usize, text: &str) ->let family = source_family(&target.base_font);let base = family.base_font(target.bold, target.italic);let substitute_name = format!("PCEd{}", base.replace('-', ""));- replacement.push(Op::new("Tf", vec![Object::name(&substitute_name), printcraft_content::num(size)]));+ replacement.push(Op::new("Tf", vec![Object::name(&substitute_name), pdfcraft_content::num(size)]));replacement.push(Op::new("Tj", vec![Object::String(PdfString::literal(win))]));- replacement.push(Op::new("Tf", vec![Object::name(&target.font), printcraft_content::num(size)]));+ replacement.push(Op::new("Tf", vec![Object::name(&target.font), pdfcraft_content::num(size)]));substituted = Some(base.to_string());let mut f = Dict::new();f.set(b"Type".to_vec(), Object::name("Font"));@@ -864,8 +864,8 @@ pub fn rewrite_block(doc: &mut Document, page: usize, block: usize, text: Optionlet std_width = move |s: &str, size: f64| -> f64 {match family {crate::added::Family::Courier => s.chars().count() as f64 * 0.6 * size,- crate::added::Family::Times => printcraft_fonts::helvetica_width(s, size) * 0.92,- crate::added::Family::Helvetica => printcraft_fonts::helvetica_width(s, size) * if bold { 1.05 } else { 1.0 },+ crate::added::Family::Times => pdfcraft_fonts::helvetica_width(s, size) * 0.92,+ crate::added::Family::Helvetica => pdfcraft_fonts::helvetica_width(s, size) * if bold { 1.05 } else { 1.0 },}};let [dx, dy] = style.offset.unwrap_or([0.0, 0.0]);@@ -911,7 +911,7 @@ pub fn rewrite_block(doc: &mut Document, page: usize, block: usize, text: Optionsubstituted = Some(format!("{} Type3", fallback.family));(name, Box::new(move |s: &str| type3_encode(&encoder, s)))} else {- let win = printcraft_fonts::win_ansi(&text);+ let win = pdfcraft_fonts::win_ansi(&text);let back: String = win.iter().map(|c| char::from_u32(u32::from(*c)).unwrap_or('?')).collect();let base = family.base_font(bold, italic);if text.chars().zip(back.chars()).any(|(a, c)| c == '?' && a != '?') {@@ -927,7 +927,7 @@ pub fn rewrite_block(doc: &mut Document, page: usize, block: usize, text: Optionif style.family.is_none() {substituted = Some(base.to_string());}- (name, Box::new(|s: &str| Some(printcraft_fonts::win_ansi(s))))+ (name, Box::new(|s: &str| Some(pdfcraft_fonts::win_ansi(s))))};// Line spacing in text space: the paragraph's own (scaled with the size), or 1.2 × the size.let lead = match style.line_spacing {@@ -936,7 +936,7 @@ pub fn rewrite_block(doc: &mut Document, page: usize, block: usize, text: OptionNone if o_state.leading > 0.0 => o_state.leading,None => size * 1.2,};- let n = printcraft_content::num;+ let n = pdfcraft_content::num;// In its own graphics state, so a new colour (or anything else) stops at the paragraph.let mut block_ops = vec![Op::new("q", vec![])];// Moved: a translation inside that state. The move is in page space, so it is taken backdiff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.tomlindex e104aa777..7a60170f1 100644--- a/crates/engine/Cargo.toml+++ b/crates/engine/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft-engine"-description = "PrintCraft engine façade: session, documents, command/tool catalogue"+name = "pdfcraft-engine"+description = "PdfCraft engine façade: session, documents, command/tool catalogue"version.workspace = trueedition.workspace = truelicense.workspace = true@@ -10,26 +10,26 @@ workspace = true[dependencies]image = { version = "0.25", default-features = false, features = ["jpeg", "tiff"] }-printcraft-render = { workspace = true }-printcraft-cos = { workspace = true }-printcraft-organize = { workspace = true }-printcraft-annot = { workspace = true }-printcraft-forms = { workspace = true }-printcraft-edit = { workspace = true }-printcraft-redact = { workspace = true }-printcraft-print = { workspace = true }-printcraft-xfdf = { workspace = true }-printcraft-sign = { workspace = true }-printcraft-optimize = { workspace = true }-printcraft-a11y = { workspace = true }-printcraft-ocr = { workspace = true }-printcraft-js = { workspace = true }-printcraft-compare = { workspace = true }-printcraft-preflight = { workspace = true }-printcraft-export = { workspace = true }-printcraft-fonts = { workspace = true }-printcraft-create = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-render = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-organize = { workspace = true }+pdfcraft-annot = { workspace = true }+pdfcraft-forms = { workspace = true }+pdfcraft-edit = { workspace = true }+pdfcraft-redact = { workspace = true }+pdfcraft-print = { workspace = true }+pdfcraft-xfdf = { workspace = true }+pdfcraft-sign = { workspace = true }+pdfcraft-optimize = { workspace = true }+pdfcraft-a11y = { workspace = true }+pdfcraft-ocr = { workspace = true }+pdfcraft-js = { workspace = true }+pdfcraft-compare = { workspace = true }+pdfcraft-preflight = { workspace = true }+pdfcraft-export = { workspace = true }+pdfcraft-fonts = { workspace = true }+pdfcraft-create = { workspace = true }+pdfcraft-model = { workspace = true }thiserror = { workspace = true }png = "0.18"diff --git a/crates/engine/src/actions.rs b/crates/engine/src/actions.rsindex 938a8d4b5..f679cf87c 100644--- a/crates/engine/src/actions.rs+++ b/crates/engine/src/actions.rs@@ -117,7 +117,7 @@ pub struct Action {pub name: String,pub description: String,pub steps: Vec<Step>,- /// One of PrintCraft's own actions (can't be edited or deleted).+ /// One of PdfCraft's own actions (can't be edited or deleted).pub builtin: bool,}diff --git a/crates/engine/src/catalog.rs b/crates/engine/src/catalog.rsindex dc3d6b2c3..a941f85ed 100644--- a/crates/engine/src/catalog.rs+++ b/crates/engine/src/catalog.rs@@ -14,7 +14,7 @@ pub enum Availability {Ready,/// Planned; ships in the named milestone.Planned(&'static str),- /// Cloud-only in Acrobat; PrintCraft offers an optional pluggable provider instead.+ /// Cloud-only in Acrobat; PdfCraft offers an optional pluggable provider instead.Provider,}diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rsindex e22f2be5b..1812a91b0 100644--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@ -298,11 +298,11 @@ pub const COMMANDS: &[CommandSpec] = &[c("page.number", "Number pages…", PAGES, None, Assembly, "hash"),c("help.shortcuts", "Keyboard shortcuts", HELP, None, Nothing, "circle-help"),c("help.discord", "Join the ArtCraft Discord", HELP, None, Nothing, "messages-square"),- c("help.app_page", "PrintCraft web page", HELP, None, Nothing, "globe"),- c("help.github", "PrintCraft on GitHub", HELP, None, Nothing, "code-xml"),+ c("help.app_page", "PdfCraft web page", HELP, None, Nothing, "globe"),+ c("help.github", "PdfCraft on GitHub", HELP, None, Nothing, "code-xml"),c("help.website", "ArtCraft website", HELP, None, Nothing, "external-link"),c("help.check_updates", "Check for updates…", HELP, None, Nothing, "cloud"),- c("help.about", "About PrintCraft", HELP, None, Nothing, "info"),+ c("help.about", "About PdfCraft", HELP, None, Nothing, "info"),];pub fn command(id: &str) -> Option<&'static CommandSpec> {diff --git a/crates/engine/src/compare.rs b/crates/engine/src/compare.rsindex 88e565ee1..bfcf578b9 100644--- a/crates/engine/src/compare.rs+++ b/crates/engine/src/compare.rs@@ -3,7 +3,7 @@use std::sync::Arc;-pub use printcraft_compare::{Change, Comparison, Kind, Side};+pub use pdfcraft_compare::{Change, Comparison, Kind, Side};use crate::{DocId, Edit, EditError, Markup, NewAnnotation, NoteIcon, Session, Shape};@@ -18,25 +18,24 @@ pub fn colour(kind: Kind) -> crate::Rgb {impl crate::Document {/// Standards ▸ Verify PDF/A: the rules the document breaks for `level`.- pub fn pdfa_verify(&self, level: printcraft_preflight::Level) -> Vec<printcraft_preflight::Issue> {- self.editor.as_ref().map(|e| printcraft_preflight::verify(&e.cos, level)).unwrap_or_default()+ pub fn pdfa_verify(&self, level: pdfcraft_preflight::Level) -> Vec<pdfcraft_preflight::Issue> {+ self.editor.as_ref().map(|e| pdfcraft_preflight::verify(&e.cos, level)).unwrap_or_default()}/// The standards the document declares (Standards panel).- pub fn standards(&self) -> printcraft_preflight::Declared {- self.editor.as_ref().map(|e| printcraft_preflight::declared(&e.cos)).unwrap_or_default()+ pub fn standards(&self) -> pdfcraft_preflight::Declared {+ self.editor.as_ref().map(|e| pdfcraft_preflight::declared(&e.cos)).unwrap_or_default()}/// Every word of the document in reading order, with page and box.- pub fn words(&self) -> Vec<printcraft_compare::Word> {- let config = printcraft_render::RenderConfig { password: self.password.as_deref().map(Arc::from), ..Default::default() };- let mut r = printcraft_render::PageRenderer::new(self.bytes.clone(), config);+ pub fn words(&self) -> Vec<pdfcraft_compare::Word> {+ let config = pdfcraft_render::RenderConfig { password: self.password.as_deref().map(Arc::from), ..Default::default() };+ let mut r = pdfcraft_render::PageRenderer::new(self.bytes.clone(), config);let mut out = Vec::new();for (page, info) in self.info.pages.iter().enumerate() {- let res =- r.render(printcraft_render::RenderRequest { page, kind: printcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });+ let res = r.render(pdfcraft_render::RenderRequest { page, kind: pdfcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });if let Some(t) = res.text {- out.extend(crate::js::page_words(&t, info).into_iter().map(|(text, rect)| printcraft_compare::Word { text, page, rect }));+ out.extend(crate::js::page_words(&t, info).into_iter().map(|(text, rect)| pdfcraft_compare::Word { text, page, rect }));}}out@@ -48,7 +47,7 @@ impl Session {pub fn compare(&self, old: DocId, new: DocId) -> Result<Comparison, EditError> {let a = self.get(old).ok_or(EditError::NoDocument)?;let b = self.get(new).ok_or(EditError::NoDocument)?;- Ok(printcraft_compare::compare(&a.words(), &b.words()))+ Ok(pdfcraft_compare::compare(&a.words(), &b.words()))}/// Visual compare: regions where page n of `new` looks different from page n of `old`@@ -57,23 +56,23 @@ impl Session {let a = self.get(old).ok_or(EditError::NoDocument)?;let b = self.get(new).ok_or(EditError::NoDocument)?;let renderer = |d: &crate::Document| {- printcraft_render::PageRenderer::new(+ pdfcraft_render::PageRenderer::new(d.bytes.clone(),- printcraft_render::RenderConfig { password: d.password.as_deref().map(Arc::from), ..Default::default() },+ pdfcraft_render::RenderConfig { password: d.password.as_deref().map(Arc::from), ..Default::default() },)};let (mut ra, mut rb) = (renderer(a), renderer(b));let scale = dpi.clamp(18.0, 150.0) / 72.0;let mut out = Vec::new();for page in 0..a.info.pages.len().min(b.info.pages.len()) {- let req = printcraft_render::RenderRequest { page, scale, ..Default::default() };+ let req = pdfcraft_render::RenderRequest { page, scale, ..Default::default() };let (x, y) = (ra.render(req), rb.render(req));if x.error.is_some() || y.error.is_some() {continue;}let info = &b.info.pages[page];let s = y.width as f32 / info.width.max(1e-3);- for r in printcraft_compare::visual_regions((&y.rgba, y.width, y.height), (&x.rgba, x.width, x.height), 24) {+ for r in pdfcraft_compare::visual_regions((&y.rgba, y.width, y.height), (&x.rgba, x.width, x.height), 24) {let p = info.view_to_user(r[0] as f32 / s, r[1] as f32 / s);let q = info.view_to_user(r[2] as f32 / s, r[3] as f32 / s);out.push((page, [p[0].min(q[0]) as f64, p[1].min(q[1]) as f64, p[0].max(q[0]) as f64, p[1].max(q[1]) as f64]));@@ -86,7 +85,7 @@ impl Session {pub fn compare_report(&self, old: DocId, new: DocId) -> Result<Arc<Vec<u8>>, EditError> {let c = self.compare(old, new)?;let name = |id| self.get(id).map(|d| d.name.clone()).unwrap_or_default();- self.create_from_text("Compare Report", &printcraft_compare::report(&c, &name(old), &name(new)))+ self.create_from_text("Compare Report", &pdfcraft_compare::report(&c, &name(old), &name(new)))}/// Mark the differences in `new` as comments: highlights over replaced and inserted text@@ -152,20 +151,20 @@ impl OfficeFormat {impl crate::Document {/// The pages as paragraphs and images (for Word, HTML and RTF export).- pub fn export_pages(&self) -> Vec<printcraft_export::Page> {+ pub fn export_pages(&self) -> Vec<pdfcraft_export::Page> {let Some(cos) = self.editor.as_ref().map(|e| &e.cos) else { return Vec::new() };self.info.pages.iter().enumerate().map(|(i, info)| {- let blocks = printcraft_edit::text_blocks(cos, i)+ let blocks = pdfcraft_edit::text_blocks(cos, i).unwrap_or_default().into_iter().filter(|b| !b.text.trim().is_empty()).map(|b| {let f = b.base_font.to_ascii_lowercase();- printcraft_export::Block {+ pdfcraft_export::Block {text: b.text,rect: b.rect,size: b.size,@@ -180,10 +179,10 @@ impl crate::Document {.enumerate().filter_map(|(k, im)| {let (ext, bytes) = self.page_image_file(i, k).ok()?;- Some(printcraft_export::Image { ext: if ext == "jpg" { "jpg" } else { "png" }, bytes, rect: im.rect })+ Some(pdfcraft_export::Image { ext: if ext == "jpg" { "jpg" } else { "png" }, bytes, rect: im.rect })}).collect();- printcraft_export::Page { width: info.width as f64, height: info.height as f64, blocks, images }+ pdfcraft_export::Page { width: info.width as f64, height: info.height as f64, blocks, images }}).collect()}@@ -193,9 +192,9 @@ impl crate::Document {let pages = self.export_pages();let title = self.info.title.clone().unwrap_or_else(|| self.name.trim_end_matches(".pdf").to_string());match format {- OfficeFormat::Docx => printcraft_export::docx(&pages, &title),- OfficeFormat::Html => printcraft_export::html(&pages, &title).into_bytes(),- OfficeFormat::Rtf => printcraft_export::rtf(&pages).into_bytes(),+ OfficeFormat::Docx => pdfcraft_export::docx(&pages, &title),+ OfficeFormat::Html => pdfcraft_export::html(&pages, &title).into_bytes(),+ OfficeFormat::Rtf => pdfcraft_export::rtf(&pages).into_bytes(),}}}diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rsindex e36f0865b..aa4e062d3 100644--- a/crates/engine/src/export.rs+++ b/crates/engine/src/export.rs@@ -4,7 +4,7 @@//! text, from a//! document's working file (so unsaved edits and hidden layers are respected, as on screen).-use printcraft_render::{PageRenderer, RenderRequest, RequestKind};+use pdfcraft_render::{PageRenderer, RenderRequest, RequestKind};use crate::Document;@@ -18,7 +18,7 @@ pub struct Exporter {#[derive(Clone)]pub struct ExportSource {pub bytes: std::sync::Arc<Vec<u8>>,- pub config: printcraft_render::RenderConfig,+ pub config: pdfcraft_render::RenderConfig,pub pages: usize,}@@ -31,13 +31,13 @@ impl Document {/// Export all images: the images `pages` (0-based) use, each once, skipping those under/// `min_side` pixels on their shorter side. JPEGs come out unchanged, other images as PNG.-pub fn extract_images(src: &ExportSource, pages: &[usize], min_side: u32) -> Result<printcraft_create::ImageExport, String> {- let doc = printcraft_cos::Document::open_with_password(src.bytes.clone(), src.config.password.as_deref()).map_err(|e| e.to_string())?;- Ok(printcraft_create::extract_images(&doc, pages, min_side))+pub fn extract_images(src: &ExportSource, pages: &[usize], min_side: u32) -> Result<pdfcraft_create::ImageExport, String> {+ let doc = pdfcraft_cos::Document::open_with_password(src.bytes.clone(), src.config.password.as_deref()).map_err(|e| e.to_string())?;+ Ok(pdfcraft_create::extract_images(&doc, pages, min_side))}/// The file name for the `index`-th (1-based) exported image: `<stem>_Page_<n>_Image_<index>.<ext>`.-pub fn image_file_name(stem: &str, image: &printcraft_create::ExtractedImage, index: usize) -> String {+pub fn image_file_name(stem: &str, image: &pdfcraft_create::ExtractedImage, index: usize) -> String {format!("{stem}_Page_{}_Image_{index:04}.{}", image.page + 1, image.extension)}diff --git a/crates/engine/src/js.rs b/crates/engine/src/js.rsindex 7618d029e..809c44ccd 100644--- a/crates/engine/src/js.rs+++ b/crates/engine/src/js.rs@@ -1,13 +1,13 @@//! Acrobat JavaScript in documents: field scripts run during form edits ([`JsRunner`], wired-//! into `forms` through its [`printcraft_forms::Scripts`] hook), and button actions and console+//! into `forms` through its [`pdfcraft_forms::Scripts`] hook), and button actions and console//! input run on request ([`Session::run_javascript`]). What scripts ask of the viewer (alerts,//! printing, navigation, links) is kept for the front end in [`JsOutput`].//!//! Preferences ▸ JavaScript ▸ Enable Acrobat JavaScript is [`Session::set_javascript`]; with it//! off, scripts don't run and AF calls keep working natively.-use printcraft_forms::{Field, FieldChange, FieldEvent, FieldKind, ScriptResult, Scripts};-pub use printcraft_js::{Limits, Outcome, Request};+use pdfcraft_forms::{Field, FieldChange, FieldEvent, FieldKind, ScriptResult, Scripts};+pub use pdfcraft_js::{Limits, Outcome, Request};use crate::{DocId, Edit, EditError, Session};@@ -41,8 +41,8 @@ impl JsOutput {}}-fn kind(k: FieldKind) -> printcraft_js::FieldType {- use printcraft_js::FieldType as T;+fn kind(k: FieldKind) -> pdfcraft_js::FieldType {+ use pdfcraft_js::FieldType as T;match k {FieldKind::Text => T::Text,FieldKind::CheckBox => T::CheckBox,@@ -55,25 +55,25 @@ fn kind(k: FieldKind) -> printcraft_js::FieldType {}/// `field.display` from the first widget's annotation flags.-fn display(doc: &printcraft_cos::Document, f: &Field) -> i32 {+fn display(doc: &pdfcraft_cos::Document, f: &Field) -> i32 {let flags = f.widgets.first().and_then(|w| doc.get(w.obj).as_dict().and_then(|d| d.int(b"F"))).unwrap_or(4);if flags & 2 != 0 {- printcraft_js::DISPLAY_HIDDEN+ pdfcraft_js::DISPLAY_HIDDEN} else if flags & 32 != 0 {- printcraft_js::DISPLAY_NO_VIEW+ pdfcraft_js::DISPLAY_NO_VIEW} else if flags & 4 == 0 {- printcraft_js::DISPLAY_NO_PRINT+ pdfcraft_js::DISPLAY_NO_PRINT} else {- printcraft_js::DISPLAY_VISIBLE+ pdfcraft_js::DISPLAY_VISIBLE}}/// A form field as scripts see it.-pub fn field_state(doc: &printcraft_cos::Document, f: &Field) -> printcraft_js::FieldState {- let mut s = printcraft_js::FieldState::new(f.name.clone(), kind(f.kind), f.value.clone());+pub fn field_state(doc: &pdfcraft_cos::Document, f: &Field) -> pdfcraft_js::FieldState {+ let mut s = pdfcraft_js::FieldState::new(f.name.clone(), kind(f.kind), f.value.clone());s.default = f.default.clone();s.readonly = f.read_only();- s.required = f.has(printcraft_forms::flags::REQUIRED);+ s.required = f.has(pdfcraft_forms::flags::REQUIRED);s.display = display(doc, f);s.char_limit = f.max_len;s.options = match f.kind {@@ -84,7 +84,7 @@ pub fn field_state(doc: &printcraft_cos::Document, f: &Field) -> printcraft_js::}/// The changes a script made, against the fields as they were.-fn changes(before: &[printcraft_js::FieldState], after: &[printcraft_js::FieldState]) -> Vec<FieldChange> {+fn changes(before: &[pdfcraft_js::FieldState], after: &[pdfcraft_js::FieldState]) -> Vec<FieldChange> {after.iter().filter_map(|a| {@@ -103,27 +103,26 @@ fn changes(before: &[printcraft_js::FieldState], after: &[printcraft_js::FieldSt/// Runs field scripts with the document's object model and keeps what they print or ask for.pub struct JsRunner {- pub doc: printcraft_js::DocInfo,+ pub doc: pdfcraft_js::DocInfo,pub doc_scripts: Vec<String>,pub output: JsOutput,/// The fields in the document as the forms code last read them (for `display`).- cos: printcraft_cos::Document,+ cos: pdfcraft_cos::Document,}impl JsRunner {- pub fn new(cos: &printcraft_cos::Document, file_name: &str) -> JsRunner {- let doc =- printcraft_js::DocInfo { file_name: file_name.to_string(), num_pages: printcraft_model::pages(cos).len(), page: 0, info: info(cos) };- JsRunner { doc, doc_scripts: printcraft_forms::document_scripts(cos), output: JsOutput::default(), cos: cos.clone() }+ pub fn new(cos: &pdfcraft_cos::Document, file_name: &str) -> JsRunner {+ let doc = pdfcraft_js::DocInfo { file_name: file_name.to_string(), num_pages: pdfcraft_model::pages(cos).len(), page: 0, info: info(cos) };+ JsRunner { doc, doc_scripts: pdfcraft_forms::document_scripts(cos), output: JsOutput::default(), cos: cos.clone() }}}/// The Info dictionary as `this.info` keys (lower-case).-fn info(cos: &printcraft_cos::Document) -> Vec<(String, String)> {+fn info(cos: &pdfcraft_cos::Document) -> Vec<(String, String)> {let Some(d) = cos.trailer().get(b"Info").map(|i| cos.resolve(i)).and_then(|i| i.as_dict().cloned()) else { return Vec::new() };d.iter().filter_map(|(k, v)| match &*cos.resolve(v) {- printcraft_cos::Object::String(s) => Some((String::from_utf8_lossy(k).to_lowercase(), s.to_text())),+ pdfcraft_cos::Object::String(s) => Some((String::from_utf8_lossy(k).to_lowercase(), s.to_text())),_ => None,}).collect()@@ -132,8 +131,8 @@ fn info(cos: &printcraft_cos::Document) -> Vec<(String, String)> {impl Scripts for JsRunner {fn run(&mut self, event: FieldEvent, script: &str, target: &Field, value: &str, fields: &[Field]) -> ScriptResult {let states: Vec<_> = fields.iter().map(|f| field_state(&self.cos, f)).collect();- let ev = printcraft_js::Event::field(event.name(), &target.name, value);- let o = printcraft_js::run(script, &ev, &self.doc, &states, &self.doc_scripts, Limits::default());+ let ev = pdfcraft_js::Event::field(event.name(), &target.name, value);+ let o = pdfcraft_js::run(script, &ev, &self.doc, &states, &self.doc_scripts, Limits::default());self.output.absorb(&o);if o.error.is_some() {// As in Acrobat, a failing script leaves the value alone (the error goes to the console).@@ -150,14 +149,14 @@ impl Scripts for JsRunner {}/// A document-level JavaScript: its name and source.-pub fn document_scripts(cos: &printcraft_cos::Document) -> Vec<(String, String)> {- printcraft_forms::document_scripts_named(cos)+pub fn document_scripts(cos: &pdfcraft_cos::Document) -> Vec<(String, String)> {+ pdfcraft_forms::document_scripts_named(cos)}impl crate::Document {/// Field Properties ▸ Actions: field `name`'s action per trigger.- pub fn field_actions(&self, name: &str) -> Vec<(printcraft_forms::Trigger, printcraft_forms::FieldAction)> {- self.editor.as_ref().and_then(|e| printcraft_forms::field_actions(&e.cos, name).ok()).unwrap_or_default()+ pub fn field_actions(&self, name: &str) -> Vec<(pdfcraft_forms::Trigger, pdfcraft_forms::FieldAction)> {+ self.editor.as_ref().and_then(|e| pdfcraft_forms::field_actions(&e.cos, name).ok()).unwrap_or_default()}/// Document JavaScripts (name, source), in name order.@@ -191,13 +190,13 @@ impl Session {let doc = self.get(id).ok_or(EditError::NoDocument)?;let cos = doc.editor.as_ref().map(|e| e.cos.clone()).ok_or_else(|| EditError::ReadOnly(doc.read_only_reason.clone().unwrap_or_default()))?;let runner = JsRunner::new(&cos, &doc.name);- let fields = printcraft_forms::fields(&cos);+ let fields = pdfcraft_forms::fields(&cos);let states: Vec<_> = fields.iter().map(|f| field_state(&cos, f)).collect();let event = match target {- Some(t) => printcraft_js::Event { will_commit: false, ..printcraft_js::Event::field("Mouse Up", t, "") },- None => printcraft_js::Event::doc("Console"),+ Some(t) => pdfcraft_js::Event { will_commit: false, ..pdfcraft_js::Event::field("Mouse Up", t, "") },+ None => pdfcraft_js::Event::doc("Console"),};- let mut o = printcraft_js::run(script, &event, &runner.doc, &states, &runner.doc_scripts, Limits::default());+ let mut o = pdfcraft_js::run(script, &event, &runner.doc, &states, &runner.doc_scripts, Limits::default());let after: Vec<_> = states.iter().map(|s| o.changed.iter().find(|c| c.name == s.name).unwrap_or(s).clone()).collect();let changes = changes(&states, &after);let resets: Vec<Vec<String>> = o@@ -228,13 +227,13 @@ impl Session {/// A page's words for form-field detection, in user space (underscore runs split from the/// text around them).-fn detection_words(text: &printcraft_render::PageText, info: &printcraft_render::PageInfo) -> Vec<printcraft_forms::detect::Word> {- page_words(text, info).into_iter().map(|(text, rect)| printcraft_forms::detect::Word { text, rect }).collect()+fn detection_words(text: &pdfcraft_render::PageText, info: &pdfcraft_render::PageInfo) -> Vec<pdfcraft_forms::detect::Word> {+ page_words(text, info).into_iter().map(|(text, rect)| pdfcraft_forms::detect::Word { text, rect }).collect()}/// A page's words in reading order, in user space ([x0, y0, x1, y1]); runs of underscores are/// words of their own.-pub(crate) fn page_words(text: &printcraft_render::PageText, info: &printcraft_render::PageInfo) -> Vec<(String, [f64; 4])> {+pub(crate) fn page_words(text: &pdfcraft_render::PageText, info: &pdfcraft_render::PageInfo) -> Vec<(String, [f64; 4])> {let mut words: Vec<(String, [f32; 4])> = Vec::new();let mut last_line = u32::MAX;// A space glyph ends the word before it.@@ -277,22 +276,21 @@ pub(crate) fn page_words(text: &printcraft_render::PageText, info: &printcraft_rimpl Session {/// Prepare a form ▸ automatic field detection: the fields `pages` (0-based; empty = all)/// seem to ask for, named from their labels, as (page, candidate).- pub fn detect_fields(&self, id: DocId, pages: &[usize]) -> Vec<(usize, printcraft_forms::detect::Candidate)> {+ pub fn detect_fields(&self, id: DocId, pages: &[usize]) -> Vec<(usize, pdfcraft_forms::detect::Candidate)> {let Some(doc) = self.get(id) else { return Vec::new() };let Some(cos) = doc.editor.as_ref().map(|e| &e.cos) else { return Vec::new() };- let config = printcraft_render::RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..Default::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let config = pdfcraft_render::RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..Default::default() };+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);let mut taken: Vec<String> = doc.form.iter().map(|f| f.name.clone()).collect();let all = doc.info.pages.len();let list: Vec<usize> = if pages.is_empty() { (0..all).collect() } else { pages.iter().copied().filter(|p| *p < all).collect() };let mut out = Vec::new();for page in list {- let res =- r.render(printcraft_render::RenderRequest { page, kind: printcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });+ let res = r.render(pdfcraft_render::RenderRequest { page, kind: pdfcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });let words = res.text.map(|t| detection_words(&t, &doc.info.pages[page])).unwrap_or_default();- let shapes = printcraft_forms::detect::page_shapes(cos, page);+ let shapes = pdfcraft_forms::detect::page_shapes(cos, page);let existing: Vec<[f64; 4]> = doc.form.iter().flat_map(|f| f.widgets.iter()).filter(|w| w.page == Some(page)).map(|w| w.rect).collect();- for c in printcraft_forms::detect::detect(&words, &shapes, &existing, &taken) {+ for c in pdfcraft_forms::detect::detect(&words, &shapes, &existing, &taken) {taken.push(c.name.clone());out.push((page, c));}@@ -313,8 +311,8 @@ impl Session {page,rect: c.rect,kind: match c.kind {- printcraft_forms::detect::Kind::Text => printcraft_forms::NewField::Text { multiline: c.rect[3] - c.rect[1] > 30.0 },- printcraft_forms::detect::Kind::CheckBox => printcraft_forms::NewField::CheckBox,+ pdfcraft_forms::detect::Kind::Text => pdfcraft_forms::NewField::Text { multiline: c.rect[3] - c.rect[1] > 30.0 },+ pdfcraft_forms::detect::Kind::CheckBox => pdfcraft_forms::NewField::CheckBox,},name: Some(c.name),})diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rsindex 5767330b6..108388ede 100644--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@ -1,9 +1,9 @@-//! printcraft-engine — the façade every frontend talks to (architecture §4).+//! pdfcraft-engine — the façade every frontend talks to (architecture §4).//!//! Holds open documents, their edit history and the tool catalogue. Frontends never touch the//! parsing, rendering or editing crates directly.//!-//! **Editing model.** Each document keeps a `printcraft_cos::Document` (the object graph with a+//! **Editing model.** Each document keeps a `pdfcraft_cos::Document` (the object graph with a//! copy-on-write overlay of edits). An edit runs on a clone, and on success the previous state is//! pushed onto the undo stack (clones share all unchanged data, so this is cheap). After every//! edit the *working file* is produced by an incremental write — original bytes plus one@@ -21,23 +21,23 @@ pub mod js;pub mod links;pub mod ocr;-pub use printcraft_organize::{BoxSpec, PageBox, SplitBy, split_ranges};+pub use pdfcraft_organize::{BoxSpec, PageBox, SplitBy, split_ranges};/// One file produced by a split: (1-based first page, last page, PDF bytes).-pub use printcraft_organize::LabelStyle;-pub use printcraft_organize::view::{InitialView, Layout as InitialLayout, Magnification, Navigation};+pub use pdfcraft_organize::LabelStyle;+pub use pdfcraft_organize::view::{InitialView, Layout as InitialLayout, Magnification, Navigation};-pub use printcraft_cos::Algorithm;-pub use printcraft_edit::{+pub use pdfcraft_cos::Algorithm;+pub use pdfcraft_edit::{Added, AddedImage, AddedText, Align as TextAlign, Background, Content as AddedContent, Family as FontFamily, HeaderFooter, MarkKind, Watermark,};-pub use printcraft_forms::{+pub use pdfcraft_forms::{BorderStyle, CheckStyle, Field as FormField, FieldAction, FieldFont, FieldKind as FormFieldKind, FieldProps, FieldValue, Look as FieldLook,NewField, TabOrder, Trigger as FieldTrigger, Widget as FormWidget, af as form_scripts, flags as field_flags,};-pub use printcraft_a11y as a11y;-pub use printcraft_edit::{BlockStyle, PageImage, TextBlock, TextLine};+pub use pdfcraft_a11y as a11y;+pub use pdfcraft_edit::{BlockStyle, PageImage, TextBlock, TextLine};/// A change to an existing page image.#[derive(Clone, Debug, PartialEq)]@@ -56,7 +56,7 @@ pub enum ImageEdit {},Delete,}-pub use printcraft_fonts::{ScriptOutline, script_outline};+pub use pdfcraft_fonts::{ScriptOutline, script_outline};/// Fill & Sign: `text` in the script font as a typed signature, its left edge at `at` (user/// space, vertically centred) and `height` points tall. `None` for text with no outlines.@@ -72,36 +72,36 @@ pub fn typed_signature_shape(at: [f64; 2], text: &str, height: f64) -> Option<ShSome(Shape::TypedSignature { rect, contours })}/// Comment geometry helpers (text-box line breaking) for frontends.-pub use printcraft_annot::appearance as annot_text;-pub use printcraft_annot::links::{Highlight as LinkHighlight, LinkAction, LinkItem, LinkStyle};-pub use printcraft_annot::{+pub use pdfcraft_annot::appearance as annot_text;+pub use pdfcraft_annot::links::{Highlight as LinkHighlight, LinkAction, LinkItem, LinkStyle};+pub use pdfcraft_annot::{AttachIcon, FillMark, Markup, NewAnnotation, NoteIcon, OverlayFont, OverlayLook, Props as CommentProps, ReviewState, Rgb, Shape, StampGroup,StampKind, Style, rect_quad,};-pub use printcraft_forms::detect;-pub use printcraft_optimize as optimize;-pub use printcraft_preflight as pdfa;-pub use printcraft_print as print;-pub use printcraft_redact::patterns::{PATTERNS as REDACT_PATTERNS, Pattern as RedactPattern, find as find_pattern};-pub use printcraft_redact::sanitize::{HIDDEN, Hidden};-pub use printcraft_sign as sign;-pub use printcraft_sign::{SignOptions, SignatureInfo, Status as SignatureStatus, TrustStore};-pub use printcraft_xfdf::Format as DataFormat;+pub use pdfcraft_forms::detect;+pub use pdfcraft_optimize as optimize;+pub use pdfcraft_preflight as pdfa;+pub use pdfcraft_print as print;+pub use pdfcraft_redact::patterns::{PATTERNS as REDACT_PATTERNS, Pattern as RedactPattern, find as find_pattern};+pub use pdfcraft_redact::sanitize::{HIDDEN, Hidden};+pub use pdfcraft_sign as sign;+pub use pdfcraft_sign::{SignOptions, SignatureInfo, Status as SignatureStatus, TrustStore};+pub use pdfcraft_xfdf::Format as DataFormat;/// Forms ▸ Merge data files into spreadsheet: the field values of each file (FDF, XFDF or a/// filled-in PDF form), as CSV with one row per file.pub fn merge_data_files(files: &[(String, Vec<u8>)]) -> Result<String, String> {let rows =- files.iter().map(|(name, bytes)| printcraft_xfdf::data_values(bytes).map_err(|e| format!("{name}: {e}"))).collect::<Result<Vec<_>, _>>()?;- Ok(printcraft_xfdf::merge_csv(&rows))+ files.iter().map(|(name, bytes)| pdfcraft_xfdf::data_values(bytes).map_err(|e| format!("{name}: {e}"))).collect::<Result<Vec<_>, _>>()?;+ Ok(pdfcraft_xfdf::merge_csv(&rows))}pub type SplitPart = (usize, usize, Arc<Vec<u8>>);use std::sync::Arc;-use printcraft_cos::{SaveOptions, write_full, write_incremental};-use printcraft_render::{DocInfo, OpenError, RenderConfig, RenderPool, inspect};+use pdfcraft_cos::{SaveOptions, write_full, write_incremental};+use pdfcraft_render::{DocInfo, OpenError, RenderConfig, RenderPool, inspect};/// Stable identifier of an open document within a session.#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]@@ -168,12 +168,12 @@ fn scope_of(edit: &Edit) -> Scope {}/// One undo/redo step: its label, the document state, its passwords, and what it changed.-type Snapshot = (String, printcraft_cos::Document, Keys, Scope);+type Snapshot = (String, pdfcraft_cos::Document, Keys, Scope);/// Editing state of a document (absent when the document cannot be edited yet, e.g. encrypted).#[derive(Clone)]struct Editor {- cos: printcraft_cos::Document,+ cos: pdfcraft_cos::Document,undo: Vec<Snapshot>,redo: Vec<Snapshot>,keys: Keys,@@ -198,17 +198,17 @@ pub struct Document {/// Why the document cannot be edited (e.g. encryption), if so.pub read_only_reason: Option<String>,/// Interactive form fields of the current state (empty without a form).- pub form: Arc<Vec<printcraft_forms::Field>>,+ pub form: Arc<Vec<pdfcraft_forms::Field>>,/// Page marks present (headers and footers, watermarks, backgrounds), for Update/Remove.pub marks: Vec<MarkKind>,/// Text and images added with Edit a PDF ▸ Add content (still editable).- pub added: Vec<printcraft_edit::Added>,+ pub added: Vec<pdfcraft_edit::Added>,/// Link annotations, for Edit a PDF ▸ Link.- pub links: Vec<printcraft_annot::links::LinkItem>,+ pub links: Vec<pdfcraft_annot::links::LinkItem>,/// Signature fields, validated against the session's trust store (Signatures panel).pub signatures: Arc<Vec<SignatureInfo>>,trust: Arc<TrustStore>,- sig_cache: Arc<printcraft_sign::DigestCache>,+ sig_cache: Arc<pdfcraft_sign::DigestCache>,editor: Option<Editor>,config: RenderConfig,/// What field scripts printed or asked for (see [`Session::take_js_output`]).@@ -229,20 +229,20 @@ impl Document {}/// Edit a PDF: the images `page` draws (0-based).- pub fn page_images(&self, page: usize) -> Vec<printcraft_edit::PageImage> {- self.editor.as_ref().and_then(|e| printcraft_edit::page_images(&e.cos, page).ok()).unwrap_or_default()+ pub fn page_images(&self, page: usize) -> Vec<pdfcraft_edit::PageImage> {+ self.editor.as_ref().and_then(|e| pdfcraft_edit::page_images(&e.cos, page).ok()).unwrap_or_default()}/// Save image as: image `index` on `page` as a file (extension, bytes).pub fn page_image_file(&self, page: usize, index: usize) -> Result<(&'static str, Vec<u8>), String> {let editor = self.editor.as_ref().ok_or("the document can't be read")?;let img = self.page_images(page).into_iter().nth(index).ok_or_else(|| format!("page {} has no image {}", page + 1, index + 1))?;- printcraft_create::image_file(&editor.cos, img.object.ok_or("the image has no object")?)+ pdfcraft_create::image_file(&editor.cos, img.object.ok_or("the image has no object")?)}/// Edit a PDF ▸ Edit text: the paragraphs on `page` (0-based).- pub fn text_blocks(&self, page: usize) -> Vec<printcraft_edit::TextBlock> {- self.editor.as_ref().and_then(|e| printcraft_edit::text_blocks(&e.cos, page).ok()).unwrap_or_default()+ pub fn text_blocks(&self, page: usize) -> Vec<pdfcraft_edit::TextBlock> {+ self.editor.as_ref().and_then(|e| pdfcraft_edit::text_blocks(&e.cos, page).ok()).unwrap_or_default()}/// A counter that changes with every edit (for caches of derived data).@@ -251,8 +251,8 @@ impl Document {}/// Edit a PDF ▸ Edit text: the lines of existing text on `page` (0-based).- pub fn text_lines(&self, page: usize) -> Vec<printcraft_edit::TextLine> {- self.editor.as_ref().and_then(|e| printcraft_edit::text_lines(&e.cos, page).ok()).unwrap_or_default()+ pub fn text_lines(&self, page: usize) -> Vec<pdfcraft_edit::TextLine> {+ self.editor.as_ref().and_then(|e| pdfcraft_edit::text_lines(&e.cos, page).ok()).unwrap_or_default()}/// Add alternate text: the figures, in document order.@@ -289,7 +289,7 @@ impl Document {}pub fn initial_view(&self) -> InitialView {- self.editor.as_ref().map(|e| printcraft_organize::initial_view(&e.cos)).unwrap_or_default()+ self.editor.as_ref().map(|e| pdfcraft_organize::initial_view(&e.cos)).unwrap_or_default()}/// Signed: at least one signature field holds a signature.@@ -315,7 +315,7 @@ impl Document {}/// What the opening password allows; `None` when the document is not encrypted.- pub fn permissions(&self) -> Option<printcraft_cos::Permissions> {+ pub fn permissions(&self) -> Option<pdfcraft_cos::Permissions> {self.editor.as_ref().and_then(|e| e.cos.permissions())}@@ -364,48 +364,48 @@ impl Document {let stream = d.crypt_filters.iter().find(|(name, _)| *name == d.stm_f).map(|(_, m)| *m);let method = match (d.v, stream) {(1..=3, _) if d.length_bits <= 40 => "RC4, 40-bit",- (1..=3, _) | (_, Some(printcraft_cos::CryptMethod::Rc4)) => "RC4, 128-bit",- (_, Some(printcraft_cos::CryptMethod::Aes128)) => "AES, 128-bit",- (_, Some(printcraft_cos::CryptMethod::Aes256)) => "AES, 256-bit",+ (1..=3, _) | (_, Some(pdfcraft_cos::CryptMethod::Rc4)) => "RC4, 128-bit",+ (_, Some(pdfcraft_cos::CryptMethod::Aes128)) => "AES, 128-bit",+ (_, Some(pdfcraft_cos::CryptMethod::Aes256)) => "AES, 256-bit",_ => "Attachments only",};let pending = editor.cos.encryption_changed();- let permissions = if pending { printcraft_cos::Permissions { bits: h.permissions().bits, owner: false } } else { h.permissions() };- Some(SecuritySummary { method: method.into(), owner: h.auth() == printcraft_cos::Auth::Owner && !pending, permissions, pending })+ let permissions = if pending { pdfcraft_cos::Permissions { bits: h.permissions().bits, owner: false } } else { h.permissions() };+ Some(SecuritySummary { method: method.into(), owner: h.auth() == pdfcraft_cos::Auth::Owner && !pending, permissions, pending })}/// Comment properties of the comment at `(page, index)` (Comment Properties dialog).- pub fn comment_props(&self, page: usize, index: usize) -> Option<printcraft_annot::Props> {- self.editor.as_ref().and_then(|e| printcraft_annot::props(&e.cos, page, index))+ pub fn comment_props(&self, page: usize, index: usize) -> Option<pdfcraft_annot::Props> {+ self.editor.as_ref().and_then(|e| pdfcraft_annot::props(&e.cos, page, index))}/// A form field's Appearance-tab look (borders, colours, font).- pub fn field_look(&self, name: &str) -> Option<printcraft_forms::Look> {+ pub fn field_look(&self, name: &str) -> Option<pdfcraft_forms::Look> {let e = self.editor.as_ref()?;let f = self.form.iter().find(|f| f.name == name)?;- Some(printcraft_forms::look(&e.cos, f))+ Some(pdfcraft_forms::look(&e.cos, f))}/// A check box's or radio button's mark (Field Properties ▸ Options), `None` for other fields.pub fn field_check_style(&self, name: &str) -> Option<CheckStyle> {let e = self.editor.as_ref()?;let f = self.form.iter().find(|f| f.name == name)?;- matches!(f.kind, FormFieldKind::CheckBox | FormFieldKind::Radio).then(|| printcraft_forms::check_style(&e.cos, f))+ matches!(f.kind, FormFieldKind::CheckBox | FormFieldKind::Radio).then(|| pdfcraft_forms::check_style(&e.cos, f))}/// Remove Hidden Information: what each category would remove.pub fn hidden_info(&self) -> Vec<(Hidden, usize)> {- self.editor.as_ref().map(|e| printcraft_redact::sanitize::scan(&e.cos)).unwrap_or_default()+ self.editor.as_ref().map(|e| pdfcraft_redact::sanitize::scan(&e.cos)).unwrap_or_default()}/// Every page's media, crop, bleed, trim and art boxes (user space), for Set Page Boxes.pub fn page_boxes(&self) -> Vec<[[f64; 4]; 5]> {- self.editor.as_ref().and_then(|e| printcraft_organize::page_boxes(&e.cos).ok()).unwrap_or_default()+ self.editor.as_ref().and_then(|e| pdfcraft_organize::page_boxes(&e.cos).ok()).unwrap_or_default()}/// Current value of a document-information entry (Title, Author, …).pub fn info_value(&self, key: &str) -> Option<String> {- self.editor.as_ref().and_then(|e| printcraft_organize::info(&e.cos, key))+ self.editor.as_ref().and_then(|e| pdfcraft_organize::info(&e.cos, key))}/// The name shown on the tab and window: the document title when the document asks for it@@ -413,8 +413,8 @@ impl Document {pub fn display_name(&self) -> String {self.editor.as_ref()- .filter(|e| printcraft_organize::displays_doc_title(&e.cos))- .and_then(|e| printcraft_organize::info(&e.cos, "Title"))+ .filter(|e| pdfcraft_organize::displays_doc_title(&e.cos))+ .and_then(|e| pdfcraft_organize::info(&e.cos, "Title")).map(|t| t.trim().to_owned()).filter(|t| !t.is_empty()).unwrap_or_else(|| self.name.clone())@@ -458,7 +458,7 @@ pub struct SecuritySummary {/// Opened with the owner password (no restrictions apply).pub owner: bool,/// For pending protection: the restrictions as they will apply to others.- pub permissions: printcraft_cos::Permissions,+ pub permissions: pdfcraft_cos::Permissions,/// Set in this session; written by the next save.pub pending: bool,}@@ -500,7 +500,7 @@ pub struct Protection {/// "Enable text access for screen reader devices".pub accessibility: bool,/// Compatibility level; AES-256 (Acrobat X and later) by default.- pub algorithm: printcraft_cos::Algorithm,+ pub algorithm: pdfcraft_cos::Algorithm,/// `false`: "Encrypt all document contents except metadata".pub encrypt_metadata: bool,}@@ -531,7 +531,7 @@ impl Default for Protection {changes: Changes::None,copy: false,accessibility: true,- algorithm: printcraft_cos::Algorithm::Aes256,+ algorithm: pdfcraft_cos::Algorithm::Aes256,encrypt_metadata: true,}}@@ -576,7 +576,7 @@ impl Protection {if [&self.open_password, &self.permissions_password].into_iter().flatten().any(|p| p.is_empty()) {return bad("passwords can't be empty");}- if self.algorithm != printcraft_cos::Algorithm::Aes256+ if self.algorithm != pdfcraft_cos::Algorithm::Aes256&& [&self.open_password, &self.permissions_password].into_iter().flatten().any(|p| p.chars().any(|c| !(' '..='~').contains(&c))){return bad("this compatibility level supports only plain ASCII passwords; use AES-256 (Acrobat X and later)");@@ -663,7 +663,7 @@ pub enum Edit {NumberPages {from: usize,to: usize,- style: printcraft_organize::LabelStyle,+ style: pdfcraft_organize::LabelStyle,prefix: String,first: u32,},@@ -825,18 +825,18 @@ pub enum Edit {/// Standards ▸ Save as PDF/A: fix what can be fixed for `level` (metadata, output intent,/// forbidden actions, annotation flags, …).ConvertPdfA {- level: printcraft_preflight::Level,+ level: pdfcraft_preflight::Level,},/// What a script (button or console) changed in form fields: values, read-only, required/// and visibility.ApplyScriptChanges {- changes: Vec<printcraft_forms::FieldChange>,+ changes: Vec<pdfcraft_forms::FieldChange>,},/// Scan & OCR ▸ Recognize text: put recognised words on `page` as invisible text over the/// image (from [`ocr::OcrJob::run`]).AddOcrText {page: usize,- words: Vec<printcraft_ocr::PlacedWord>,+ words: Vec<pdfcraft_ocr::PlacedWord>,},/// Edit a PDF ▸ Edit text: replace the text of line `line` (from `Document::text_lines`) on/// `page`, in its own font when it can show it, else in Helvetica.@@ -858,7 +858,7 @@ pub enum Edit {block: usize,text: String,/// Formatting changes (font, size, colour, alignment); default keeps the paragraph's.- style: printcraft_edit::BlockStyle,+ style: pdfcraft_edit::BlockStyle,},/// Order tabs manually: move a field one place earlier or later on its page.MoveInTabOrder {@@ -1107,13 +1107,13 @@ fn annotation_noun(s: &Shape) -> &'static str {/// Opened as owner, or nothing is restricted (no permissions password was set): security may/// be changed, as in Acrobat.-fn unrestricted(p: &printcraft_cos::Permissions) -> bool {+fn unrestricted(p: &pdfcraft_cos::Permissions) -> bool {const ALL: i32 = 0b1111_0011_1100; // bits 3–6 and 9–12p.owner || p.bits & ALL == ALL}/// Whether the opening password allows an edit (§7.6.4.2, Table 22).-fn check_permission(edit: &Edit, p: &printcraft_cos::Permissions) -> Result<(), EditError> {+fn check_permission(edit: &Edit, p: &pdfcraft_cos::Permissions) -> Result<(), EditError> {match edit {Edit::RotatePages { .. }| Edit::DeletePages { .. }@@ -1239,7 +1239,7 @@ impl EditCtx {// Real clock: mix in sub-second time so ids from two sessions don't collide.seed ^= std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.subsec_nanos() as u64).unwrap_or(0) << 32;}- Self { js: None, date: now.map(printcraft_cos::pdf_date), today: (1970, 1, 1), seed, count: 0 }+ Self { js: None, date: now.map(pdfcraft_cos::pdf_date), today: (1970, 1, 1), seed, count: 0 }}/// 32 bytes of entropy for new encryption keys and salts. `RandomState` is seeded by the@@ -1258,7 +1258,7 @@ impl EditCtx {}/// A fresh `/NM`: a random-looking UUID (version 4 layout) from a splitmix64 stream.- fn meta(&mut self) -> printcraft_annot::Meta {+ fn meta(&mut self) -> pdfcraft_annot::Meta {let mut next = || {self.count += 1;let mut z = self.seed.wrapping_add(self.count.wrapping_mul(0x9E37_79B9_7F4A_7C15));@@ -1275,46 +1275,46 @@ impl EditCtx {0x8000 | (b >> 48) & 0x3fff,b & 0xffff_ffff_ffff);- printcraft_annot::Meta { date: self.date.clone(), id }+ pdfcraft_annot::Meta { date: self.date.clone(), id }}}/// Perform an edit on a working copy (the caller discards it on error).-fn run_edit(doc: &mut printcraft_cos::Document, edit: &Edit, cx: &mut EditCtx) -> Result<(), EditError> {+fn run_edit(doc: &mut pdfcraft_cos::Document, edit: &Edit, cx: &mut EditCtx) -> Result<(), EditError> {match edit {- Edit::RotatePages { pages, degrees } => printcraft_organize::rotate_pages(doc, pages, *degrees)?,- Edit::DeletePages { pages } => printcraft_organize::delete_pages(doc, pages)?,- Edit::MovePages { pages, to } => printcraft_organize::move_pages(doc, pages, *to)?,+ Edit::RotatePages { pages, degrees } => pdfcraft_organize::rotate_pages(doc, pages, *degrees)?,+ Edit::DeletePages { pages } => pdfcraft_organize::delete_pages(doc, pages)?,+ Edit::MovePages { pages, to } => pdfcraft_organize::move_pages(doc, pages, *to)?,Edit::InsertBlankPage { at, width, height } => {- printcraft_organize::insert_blank_page(doc, *at, *width, *height)?;+ pdfcraft_organize::insert_blank_page(doc, *at, *width, *height)?;}- Edit::SetInfo { key, value } => printcraft_organize::set_info(doc, key, value)?,- Edit::DuplicatePages { pages } => printcraft_organize::duplicate_pages(doc, pages)?,+ Edit::SetInfo { key, value } => pdfcraft_organize::set_info(doc, key, value)?,+ Edit::DuplicatePages { pages } => pdfcraft_organize::duplicate_pages(doc, pages)?,Edit::ReplacePages { pages, name, bytes, src_pages } => {let src = open_source(name, bytes)?;- printcraft_organize::replace_pages(doc, pages, &src, src_pages)?;+ pdfcraft_organize::replace_pages(doc, pages, &src, src_pages)?;}- Edit::SetPageBox { pages, which, spec } => printcraft_organize::set_page_box(doc, pages, *which, *spec)?,+ Edit::SetPageBox { pages, which, spec } => pdfcraft_organize::set_page_box(doc, pages, *which, *spec)?,Edit::InsertPagesFrom { name, bytes, pages, at } => {let src = open_source(name, bytes)?;let pages = match pages {Some(p) => p.clone(),- None => (0..printcraft_organize::page_count(&src)?).collect(),+ None => (0..pdfcraft_organize::page_count(&src)?).collect(),};- printcraft_organize::import_pages(doc, &src, &pages, *at)?;+ pdfcraft_organize::import_pages(doc, &src, &pages, *at)?;}Edit::AddBookmark { parent, index, title, page } => {- printcraft_organize::add_bookmark(doc, parent, *index, title, *page)?;+ pdfcraft_organize::add_bookmark(doc, parent, *index, title, *page)?;}- Edit::RenameBookmark { path, title } => printcraft_organize::rename_bookmark(doc, path, title)?,- Edit::DeleteBookmark { path } => printcraft_organize::delete_bookmark(doc, path)?,+ Edit::RenameBookmark { path, title } => pdfcraft_organize::rename_bookmark(doc, path, title)?,+ Edit::DeleteBookmark { path } => pdfcraft_organize::delete_bookmark(doc, path)?,Edit::MoveBookmark { from, to_parent, index } => {- printcraft_organize::move_bookmark(doc, from, to_parent, *index)?;+ pdfcraft_organize::move_bookmark(doc, from, to_parent, *index)?;}- Edit::SetBookmarkPage { path, page } => printcraft_organize::set_bookmark_page(doc, path, *page)?,- Edit::NumberPages { from, to, style, prefix, first } => printcraft_organize::number_pages(doc, *from, *to, *style, prefix, *first)?,+ Edit::SetBookmarkPage { path, page } => pdfcraft_organize::set_bookmark_page(doc, path, *page)?,+ Edit::NumberPages { from, to, style, prefix, first } => pdfcraft_organize::number_pages(doc, *from, *to, *style, prefix, *first)?,Edit::AddAnnotation(a) => {- printcraft_annot::add_annotation(doc, a, &cx.meta())?;+ pdfcraft_annot::add_annotation(doc, a, &cx.meta())?;}Edit::AddCustomStamp { page, rect, name, file, author } => {let src = mark_source(doc, file)?;@@ -1327,200 +1327,198 @@ fn run_edit(doc: &mut printcraft_cos::Document, edit: &Edit, cx: &mut EditCtx) -*rect};let shape = Shape::CustomStamp { rect, name: name.clone(), picture: src.xobject, image: src.image, size: (sw, sh) };- let style = printcraft_annot::Style::default_for(&shape);+ let style = pdfcraft_annot::Style::default_for(&shape);let new = NewAnnotation { page: *page, shape, style, contents: name.clone(), author: author.clone() };- printcraft_annot::add_annotation(doc, &new, &cx.meta())?;+ pdfcraft_annot::add_annotation(doc, &new, &cx.meta())?;}- Edit::DeleteAnnotation { page, index } => printcraft_annot::delete_annotation(doc, *page, *index)?,- Edit::SetAnnotationContents { page, index, text } => printcraft_annot::set_contents(doc, *page, *index, text, &cx.meta())?,+ Edit::DeleteAnnotation { page, index } => pdfcraft_annot::delete_annotation(doc, *page, *index)?,+ Edit::SetAnnotationContents { page, index, text } => pdfcraft_annot::set_contents(doc, *page, *index, text, &cx.meta())?,Edit::ReplyToAnnotation { page, index, text, author } => {- printcraft_annot::add_reply(doc, *page, *index, text, author, &cx.meta())?;+ pdfcraft_annot::add_reply(doc, *page, *index, text, author, &cx.meta())?;}Edit::SetAnnotationStatus { page, index, state, author } => {- printcraft_annot::set_review_state(doc, *page, *index, *state, author, &cx.meta())?;+ pdfcraft_annot::set_review_state(doc, *page, *index, *state, author, &cx.meta())?;}Edit::EraseInk { page, index, path, radius } => {- printcraft_annot::erase_ink(doc, *page, *index, path, *radius, &cx.meta())?;+ pdfcraft_annot::erase_ink(doc, *page, *index, path, *radius, &cx.meta())?;}Edit::ReplaceText { page, quads, text, author, strike, caret } => {- printcraft_annot::add_text_replacement(doc, *page, quads, text, author, strike, caret, &cx.meta())?;+ pdfcraft_annot::add_text_replacement(doc, *page, quads, text, author, strike, caret, &cx.meta())?;}Edit::MarkAnnotation { page, index, marked, author } => {- printcraft_annot::set_marked(doc, *page, *index, *marked, author, &cx.meta())?;+ pdfcraft_annot::set_marked(doc, *page, *index, *marked, author, &cx.meta())?;}- Edit::LockAnnotation { page, index, locked } => printcraft_annot::set_locked(doc, *page, *index, *locked)?,- Edit::MoveAnnotation { page, index, dx, dy } => printcraft_annot::move_annotation(doc, *page, *index, *dx, *dy, &cx.meta())?,- Edit::ResizeAnnotation { page, index, rect } => printcraft_annot::set_rect(doc, *page, *index, *rect, &cx.meta())?,+ Edit::LockAnnotation { page, index, locked } => pdfcraft_annot::set_locked(doc, *page, *index, *locked)?,+ Edit::MoveAnnotation { page, index, dx, dy } => pdfcraft_annot::move_annotation(doc, *page, *index, *dx, *dy, &cx.meta())?,+ Edit::ResizeAnnotation { page, index, rect } => pdfcraft_annot::set_rect(doc, *page, *index, *rect, &cx.meta())?,Edit::StyleAnnotation { page, index, color, opacity, width } => {- printcraft_annot::set_style(doc, *page, *index, *color, *opacity, *width, &cx.meta())?;+ pdfcraft_annot::set_style(doc, *page, *index, *color, *opacity, *width, &cx.meta())?;}Edit::SetAnnotationInfo { page, index, author, subject, icon } => {- printcraft_annot::set_info(doc, *page, *index, author.as_deref(), subject.as_deref(), *icon, &cx.meta())?;+ pdfcraft_annot::set_info(doc, *page, *index, author.as_deref(), subject.as_deref(), *icon, &cx.meta())?;}Edit::SetFieldValue { name, value } => match cx.js.as_mut() {- Some(js) => printcraft_forms::set_value_with(doc, name, value, js)?,- None => printcraft_forms::set_value(doc, name, value)?,+ Some(js) => pdfcraft_forms::set_value_with(doc, name, value, js)?,+ None => pdfcraft_forms::set_value(doc, name, value)?,},Edit::ApplyScriptChanges { changes } => match cx.js.as_mut() {- Some(js) => printcraft_forms::apply_script_changes(doc, changes, js)?,- None => printcraft_forms::apply_script_changes(doc, changes, &mut printcraft_forms::NoScripts)?,+ Some(js) => pdfcraft_forms::apply_script_changes(doc, changes, js)?,+ None => pdfcraft_forms::apply_script_changes(doc, changes, &mut pdfcraft_forms::NoScripts)?,},Edit::SetFieldImage { name, image } => {- let (img, _) = printcraft_create::image_xobject(doc, name, image)?;+ let (img, _) = pdfcraft_create::image_xobject(doc, name, image)?;let px = match &*doc.get(img) {- printcraft_cos::Object::Stream(s) => (s.dict.int(b"Width").unwrap_or(1) as u32, s.dict.int(b"Height").unwrap_or(1) as u32),+ pdfcraft_cos::Object::Stream(s) => (s.dict.int(b"Width").unwrap_or(1) as u32, s.dict.int(b"Height").unwrap_or(1) as u32),_ => (1, 1),};- printcraft_forms::set_button_icon(doc, name, img, px)?;+ pdfcraft_forms::set_button_icon(doc, name, img, px)?;}Edit::ResetForm { names } => {- printcraft_forms::reset(doc, names.as_deref())?;+ pdfcraft_forms::reset(doc, names.as_deref())?;}Edit::AddField { page, rect, kind, name } => {- printcraft_forms::add_field(doc, *page, *rect, kind, name.as_deref())?;+ pdfcraft_forms::add_field(doc, *page, *rect, kind, name.as_deref())?;}Edit::SetFieldProps { name, props } => {- printcraft_forms::set_props(doc, name, props)?;+ pdfcraft_forms::set_props(doc, name, props)?;}Edit::DuplicateField { name, pages } => {- if printcraft_forms::duplicate_field(doc, name, pages)? == 0 {- return Err(EditError::Form(printcraft_forms::FormError::Invalid(format!("{name} is already on those pages"))));+ if pdfcraft_forms::duplicate_field(doc, name, pages)? == 0 {+ return Err(EditError::Form(pdfcraft_forms::FormError::Invalid(format!("{name} is already on those pages"))));}}- Edit::DeleteField { name } => printcraft_forms::delete_field(doc, name)?,- Edit::SetTabOrder { pages, order } => printcraft_forms::set_tab_order(doc, pages, *order)?,- Edit::MoveInTabOrder { name, earlier } => printcraft_forms::move_in_tab_order(doc, name, *earlier)?,- Edit::SetInitialView(v) => printcraft_organize::set_initial_view(doc, v)?,+ Edit::DeleteField { name } => pdfcraft_forms::delete_field(doc, name)?,+ Edit::SetTabOrder { pages, order } => pdfcraft_forms::set_tab_order(doc, pages, *order)?,+ Edit::MoveInTabOrder { name, earlier } => pdfcraft_forms::move_in_tab_order(doc, name, *earlier)?,+ Edit::SetInitialView(v) => pdfcraft_organize::set_initial_view(doc, v)?,Edit::SetAltText { figure, alt } => {- let r = printcraft_cos::ObjRef::new(*figure, doc.generation(*figure));+ let r = pdfcraft_cos::ObjRef::new(*figure, doc.generation(*figure));a11y::set_alt(doc, r, alt.as_deref()).map_err(|e| EditError::Accessibility(e.to_string()))?;}Edit::EditTextLine { page, line, text } => {- printcraft_edit::replace_line(doc, *page, *line, text)?;+ pdfcraft_edit::replace_line(doc, *page, *line, text)?;}Edit::SetFieldScript { name, event, script } => {- printcraft_forms::set_field_script(doc, name, event, script.as_deref())?;+ pdfcraft_forms::set_field_script(doc, name, event, script.as_deref())?;match cx.js.as_mut() {- Some(js) => printcraft_forms::recalculate_with(doc, js)?,- None => printcraft_forms::recalculate(doc)?,+ Some(js) => pdfcraft_forms::recalculate_with(doc, js)?,+ None => pdfcraft_forms::recalculate(doc)?,};}Edit::ConvertPdfA { level } => {- printcraft_preflight::convert(doc, *level).map_err(|e| EditError::Invalid(e.to_string()))?;+ pdfcraft_preflight::convert(doc, *level).map_err(|e| EditError::Invalid(e.to_string()))?;}- Edit::SetDocumentScript { name, script } => printcraft_forms::set_document_script(doc, name, script.as_deref())?,+ Edit::SetDocumentScript { name, script } => pdfcraft_forms::set_document_script(doc, name, script.as_deref())?,Edit::AddOcrText { page, words } => {- printcraft_edit::stamp(doc, *page, "OCR", printcraft_ocr::text_layer(words))?;+ pdfcraft_edit::stamp(doc, *page, "OCR", pdfcraft_ocr::text_layer(words))?;}Edit::EditPageImage { page, index, change } => {- let img = printcraft_edit::page_images(doc, *page)?+ let img = pdfcraft_edit::page_images(doc, *page)?.into_iter().nth(*index)- .ok_or_else(|| EditError::Edit(printcraft_edit::EditError::Invalid(format!("page {} has no image {}", page + 1, index + 1))))?;+ .ok_or_else(|| EditError::Edit(pdfcraft_edit::EditError::Invalid(format!("page {} has no image {}", page + 1, index + 1))))?;let c = match change {- ImageEdit::Move(to) => printcraft_edit::ImageChange::Transform(printcraft_edit::rect_to_rect(img.rect, *to)),- ImageEdit::Rotate(q) => printcraft_edit::ImageChange::Transform(printcraft_edit::turn_about_centre(img.rect, *q, false, false)),+ ImageEdit::Move(to) => pdfcraft_edit::ImageChange::Transform(pdfcraft_edit::rect_to_rect(img.rect, *to)),+ ImageEdit::Rotate(q) => pdfcraft_edit::ImageChange::Transform(pdfcraft_edit::turn_about_centre(img.rect, *q, false, false)),ImageEdit::Flip { horizontal } => {- printcraft_edit::ImageChange::Transform(printcraft_edit::turn_about_centre(img.rect, 0, *horizontal, !*horizontal))+ pdfcraft_edit::ImageChange::Transform(pdfcraft_edit::turn_about_centre(img.rect, 0, *horizontal, !*horizontal))}- ImageEdit::Replace { name, bytes } => printcraft_edit::ImageChange::Replace(printcraft_create::image_xobject(doc, name, bytes)?.0),- ImageEdit::Delete => printcraft_edit::ImageChange::Delete,+ ImageEdit::Replace { name, bytes } => pdfcraft_edit::ImageChange::Replace(pdfcraft_create::image_xobject(doc, name, bytes)?.0),+ ImageEdit::Delete => pdfcraft_edit::ImageChange::Delete,};- printcraft_edit::change_image(doc, *page, *index, &c)?;+ pdfcraft_edit::change_image(doc, *page, *index, &c)?;}Edit::EditTextBlock { page, block, text, style } => {- printcraft_edit::rewrite_block(doc, *page, *block, Some(text), style)?;+ pdfcraft_edit::rewrite_block(doc, *page, *block, Some(text), style)?;}Edit::MarkDecorative { figure } => {- let r = printcraft_cos::ObjRef::new(*figure, doc.generation(*figure));+ let r = pdfcraft_cos::ObjRef::new(*figure, doc.generation(*figure));a11y::mark_decorative(doc, r).map_err(|e| EditError::Accessibility(e.to_string()))?;}Edit::AddHeaderFooter { pages, settings, replace } => {let date = cx.today;- printcraft_edit::add_header_footer(doc, pages, settings, *replace, &printcraft_edit::Context { date })?;+ pdfcraft_edit::add_header_footer(doc, pages, settings, *replace, &pdfcraft_edit::Context { date })?;}Edit::AddWatermark { pages, settings, replace, file } => {let mut s = settings.clone();if let Some(f) = file {s.source = Some(mark_source(doc, f)?);}- printcraft_edit::add_watermark(doc, pages, &s, *replace)?+ pdfcraft_edit::add_watermark(doc, pages, &s, *replace)?}Edit::AddBackground { pages, settings, replace, file } => {let mut s = settings.clone();if let Some(f) = file {s.source = Some(mark_source(doc, f)?);}- printcraft_edit::add_background(doc, pages, &s, *replace)?+ pdfcraft_edit::add_background(doc, pages, &s, *replace)?}Edit::RemoveMarks { kind } => {- let n = printcraft_model::pages(doc).len();- if printcraft_edit::remove_marks(doc, &(0..n).collect::<Vec<_>>(), *kind)? == 0 {- return Err(EditError::Edit(printcraft_edit::EditError::Invalid("there is nothing to remove".into())));+ let n = pdfcraft_model::pages(doc).len();+ if pdfcraft_edit::remove_marks(doc, &(0..n).collect::<Vec<_>>(), *kind)? == 0 {+ return Err(EditError::Edit(pdfcraft_edit::EditError::Invalid("there is nothing to remove".into())));}}Edit::AddText { page, text } => {- printcraft_edit::add_content(doc, *page, &AddedContent::Text(text.clone()))?;+ pdfcraft_edit::add_content(doc, *page, &AddedContent::Text(text.clone()))?;}Edit::AddImage { page, rect, name, bytes } => {- let (image, natural) = printcraft_create::image_xobject(doc, name, bytes)?;+ let (image, natural) = pdfcraft_create::image_xobject(doc, name, bytes)?;let rect = match rect {Some(r) => *r,None => {- let p = printcraft_model::pages(doc).swap_remove(*page);+ let p = pdfcraft_model::pages(doc).swap_remove(*page);let (pw, ph) = p.display_size(doc);let k = ((pw * 0.8) / natural.0).min((ph * 0.8) / natural.1).min(1.0);let (w, h) = (natural.0 * k, natural.1 * k);[(pw - w) / 2.0, (ph - h) / 2.0, (pw + w) / 2.0, (ph + h) / 2.0]}};- printcraft_edit::add_content(doc, *page, &AddedContent::Image(printcraft_edit::AddedImage::new(rect, image)))?;+ pdfcraft_edit::add_content(doc, *page, &AddedContent::Image(pdfcraft_edit::AddedImage::new(rect, image)))?;}- Edit::UpdateContent { page, index, content } => printcraft_edit::update_content(doc, *page, *index, content)?,- Edit::DeleteContent { page, index } => printcraft_edit::delete_content(doc, *page, *index)?,+ Edit::UpdateContent { page, index, content } => pdfcraft_edit::update_content(doc, *page, *index, content)?,+ Edit::DeleteContent { page, index } => pdfcraft_edit::delete_content(doc, *page, *index)?,Edit::ReplaceImage { page, index, name, bytes } => {- let item = printcraft_edit::list_added(doc).into_iter().filter(|a| a.page == *page).nth(*index);+ let item = pdfcraft_edit::list_added(doc).into_iter().filter(|a| a.page == *page).nth(*index);let Some(AddedContent::Image(old)) = item.map(|a| a.content) else {- return Err(EditError::Edit(printcraft_edit::EditError::Invalid("that item is not an image".into())));+ return Err(EditError::Edit(pdfcraft_edit::EditError::Invalid("that item is not an image".into())));};- let (image, _) = printcraft_create::image_xobject(doc, name, bytes)?;- printcraft_edit::update_content(doc, *page, *index, &AddedContent::Image(printcraft_edit::AddedImage { image, ..old }))?;+ let (image, _) = pdfcraft_create::image_xobject(doc, name, bytes)?;+ pdfcraft_edit::update_content(doc, *page, *index, &AddedContent::Image(pdfcraft_edit::AddedImage { image, ..old }))?;}Edit::ApplyRedactions { pages } => {- printcraft_redact::apply(doc, pages.as_deref())?;+ pdfcraft_redact::apply(doc, pages.as_deref())?;}Edit::ClearRedactions => {- printcraft_redact::clear_marks(doc, None)?;+ pdfcraft_redact::clear_marks(doc, None)?;}Edit::AddLink { page, rect, action, style } => {- printcraft_annot::links::add(doc, *page, *rect, action, style)?;+ pdfcraft_annot::links::add(doc, *page, *rect, action, style)?;}- Edit::SetLink { page, index, rect, action, style } => {- printcraft_annot::links::set(doc, *page, *index, *rect, action.as_ref(), style.as_ref())?- }- Edit::DeleteLink { page, index } => printcraft_annot::links::delete(doc, *page, *index)?,+ Edit::SetLink { page, index, rect, action, style } => pdfcraft_annot::links::set(doc, *page, *index, *rect, action.as_ref(), style.as_ref())?,+ Edit::DeleteLink { page, index } => pdfcraft_annot::links::delete(doc, *page, *index)?,Edit::RemoveLinks { pages } => {- if printcraft_annot::links::remove_all(doc, pages.as_deref())? == 0 {- return Err(EditError::Edit(printcraft_edit::EditError::Invalid("there are no links to remove".into())));+ if pdfcraft_annot::links::remove_all(doc, pages.as_deref())? == 0 {+ return Err(EditError::Edit(pdfcraft_edit::EditError::Invalid("there are no links to remove".into())));}}Edit::AddLinks { links, style } => {- if printcraft_annot::links::add_many(doc, links, style)? == 0 {- return Err(EditError::Edit(printcraft_edit::EditError::Invalid("no web addresses were found".into())));+ if pdfcraft_annot::links::add_many(doc, links, style)? == 0 {+ return Err(EditError::Edit(pdfcraft_edit::EditError::Invalid("no web addresses were found".into())));}}Edit::ImportData { bytes, .. } => {- printcraft_xfdf::import(doc, bytes)?;+ pdfcraft_xfdf::import(doc, bytes)?;}Edit::RemoveHidden { which } => {- printcraft_redact::sanitize::remove_hidden(doc, which)?;+ pdfcraft_redact::sanitize::remove_hidden(doc, which)?;}Edit::Sanitize => {- printcraft_redact::sanitize::sanitize(doc)?;+ pdfcraft_redact::sanitize::sanitize(doc)?;}Edit::Flatten { comments, fields } => {- let n = printcraft_model::pages(doc).len();- printcraft_edit::flatten(doc, &(0..n).collect::<Vec<_>>(), *comments, *fields)?;+ let n = pdfcraft_model::pages(doc).len();+ pdfcraft_edit::flatten(doc, &(0..n).collect::<Vec<_>>(), *comments, *fields)?;}Edit::Protect(p) => {p.validate()?;@@ -1528,7 +1526,7 @@ fn run_edit(doc: &mut printcraft_cos::Document, edit: &Edit, cx: &mut EditCtx) -// Without a permissions password nothing is restricted, so the owner password is a// random one nobody needs.let random_owner: String = cx.entropy().iter().map(|b| format!("{b:02x}")).collect();- let params = printcraft_cos::NewEncryption {+ let params = pdfcraft_cos::NewEncryption {algorithm: p.algorithm,user_password: p.open_password.as_deref().unwrap_or(""),owner_password: p.permissions_password.as_deref().unwrap_or(&random_owner),@@ -1554,15 +1552,15 @@ fn run_edit(doc: &mut printcraft_cos::Document, edit: &Edit, cx: &mut EditCtx) -}/// The comment list, read from the object graph (as `inspect` lists comments).-fn comment_list(doc: &printcraft_cos::Document) -> Vec<printcraft_render::Annotation> {- printcraft_annot::summaries(doc)+fn comment_list(doc: &pdfcraft_cos::Document) -> Vec<pdfcraft_render::Annotation> {+ pdfcraft_annot::summaries(doc).into_iter()- .map(|s| printcraft_render::Annotation {+ .map(|s| pdfcraft_render::Annotation {page: s.page,subtype: s.subtype,author: s.author,contents: s.contents,- modified: s.modified.map(|m| printcraft_render::pretty_date(&m)),+ modified: s.modified.map(|m| pdfcraft_render::pretty_date(&m)),name: s.name,in_reply_to: s.in_reply_to,rect: s.rect,@@ -1612,13 +1610,13 @@ pub fn guard<T>(f: impl FnOnce() -> T) -> Result<T, String> {}/// Parse another PDF to copy pages from.-fn open_source(name: &str, bytes: &Arc<Vec<u8>>) -> Result<printcraft_cos::Document, EditError> {- match std::panic::catch_unwind(|| printcraft_cos::Document::open(bytes.clone())) {+fn open_source(name: &str, bytes: &Arc<Vec<u8>>) -> Result<pdfcraft_cos::Document, EditError> {+ match std::panic::catch_unwind(|| pdfcraft_cos::Document::open(bytes.clone())) {Ok(Ok(d)) if d.permissions().is_some_and(|p| !p.assemble()) => {Err(EditError::Source(format!("{name}: its security settings don't allow copying pages")))}Ok(Ok(d)) => Ok(d),- Ok(Err(printcraft_cos::CosError::NeedsPassword)) => Err(EditError::Source(format!("{name}: it is password-protected"))),+ Ok(Err(pdfcraft_cos::CosError::NeedsPassword)) => Err(EditError::Source(format!("{name}: it is password-protected"))),Ok(Err(e)) => Err(EditError::Source(format!("{name}: {e}"))),Err(_) => Err(EditError::Source(format!("{name}: the file could not be read"))),}@@ -1637,27 +1635,27 @@ pub enum EditError {#[error("the document's security settings don't allow {0}; open it with the owner password to make this change")]NotPermitted(&'static str),#[error("{0}")]- Organize(#[from] printcraft_organize::OrganizeError),+ Organize(#[from] pdfcraft_organize::OrganizeError),#[error("{0}")]- Bookmark(#[from] printcraft_organize::OutlineError),+ Bookmark(#[from] pdfcraft_organize::OutlineError),#[error("{0}")]- Comment(#[from] printcraft_annot::AnnotError),+ Comment(#[from] pdfcraft_annot::AnnotError),#[error("{0}")]Protection(String),#[error("{0}")]- Form(#[from] printcraft_forms::FormError),+ Form(#[from] pdfcraft_forms::FormError),#[error(transparent)]- Redact(#[from] printcraft_redact::RedactError),+ Redact(#[from] pdfcraft_redact::RedactError),#[error("{0}")]Print(String),#[error("{0}")]Accessibility(String),#[error(transparent)]- Data(#[from] printcraft_xfdf::DataError),+ Data(#[from] pdfcraft_xfdf::DataError),#[error("{0}")]- Edit(#[from] printcraft_edit::EditError),+ Edit(#[from] pdfcraft_edit::EditError),#[error("{0}")]- Create(#[from] printcraft_create::CreateError),+ Create(#[from] pdfcraft_create::CreateError),#[error("the edited document could not be written: {0}")]Write(String),#[error("the edited document could not be reopened: {0}")]@@ -1680,8 +1678,8 @@ pub enum EditError {Invalid(String),}-impl From<printcraft_sign::SignError> for EditError {- fn from(e: printcraft_sign::SignError) -> Self {+impl From<pdfcraft_sign::SignError> for EditError {+ fn from(e: pdfcraft_sign::SignError) -> Self {EditError::Sign(e.to_string())}}@@ -1699,8 +1697,8 @@ pub struct Session {}/// Validate the signature fields of `cos` (written as `bytes`).-fn signatures_of(cos: &printcraft_cos::Document, bytes: &[u8], trust: &TrustStore, cache: &printcraft_sign::DigestCache) -> Arc<Vec<SignatureInfo>> {- Arc::new(printcraft_sign::pdf::list_cached(cos, bytes, trust, cache))+fn signatures_of(cos: &pdfcraft_cos::Document, bytes: &[u8], trust: &TrustStore, cache: &pdfcraft_sign::DigestCache) -> Arc<Vec<SignatureInfo>> {+ Arc::new(pdfcraft_sign::pdf::list_cached(cos, bytes, trust, cache))}impl Session {@@ -1734,7 +1732,7 @@ impl Session {/// A dynamic stamp's second line: "By Ada at 2:14 pm, Oct 02, 2026" (local time).pub fn stamp_by_line(&self, author: &str) -> String {let offset = if self.clock.is_some() { 0 } else { local_utc_offset() };- let d = self.now().map(|t| printcraft_cos::pdf_date(t + offset)).unwrap_or_default();+ let d = self.now().map(|t| pdfcraft_cos::pdf_date(t + offset)).unwrap_or_default();let num = |a: usize, b: usize| d.get(a..b).and_then(|s| s.parse::<u32>().ok()).unwrap_or(0);let (y, mo, day, hh, mm) = (num(2, 6), num(6, 8), num(8, 10), num(10, 12), num(12, 14));const MONTHS: [&str; 12] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];@@ -1745,7 +1743,7 @@ impl Session {pub fn today(&self) -> (i64, u32, u32) {let offset = if self.clock.is_some() { 0 } else { local_utc_offset() };- self.now().map(|t| printcraft_cos::pdf_date(t + offset)).as_deref().and_then(parse_ymd).unwrap_or((1970, 1, 1))+ self.now().map(|t| pdfcraft_cos::pdf_date(t + offset)).as_deref().and_then(parse_ymd).unwrap_or((1970, 1, 1))}/// Open a document from bytes. Rendering starts lazily when pages are requested.@@ -1769,7 +1767,7 @@ impl Session {}fn open_unguarded(&mut self, name: String, path: Option<String>, bytes: Arc<Vec<u8>>, password: Option<&str>) -> Result<DocId, OpenError> {- let cos = std::panic::catch_unwind(|| printcraft_cos::Document::open_with_password(bytes.clone(), password));+ let cos = std::panic::catch_unwind(|| pdfcraft_cos::Document::open_with_password(bytes.clone(), password));// The renderer authenticates on its own. It cannot use the owner password of R2–R4// files, so give it the user password that owner authentication recovers.let (info, render_password) = match inspect(bytes.clone(), password) {@@ -1794,11 +1792,11 @@ impl Session {Ok(Err(e)) => (None, Some(e.to_string())),Err(_) => (None, Some("the document structure could not be read for editing".into())),};- let form = editor.as_ref().map(|e| printcraft_forms::fields(&e.cos)).unwrap_or_default();- let marks = editor.as_ref().map(|e| printcraft_edit::marks_present(&e.cos)).unwrap_or_default();- let added = editor.as_ref().map(|e| printcraft_edit::list_added(&e.cos)).unwrap_or_default();- let links = editor.as_ref().map(|e| printcraft_annot::links::list(&e.cos)).unwrap_or_default();- let sig_cache = Arc::new(printcraft_sign::DigestCache::default());+ let form = editor.as_ref().map(|e| pdfcraft_forms::fields(&e.cos)).unwrap_or_default();+ let marks = editor.as_ref().map(|e| pdfcraft_edit::marks_present(&e.cos)).unwrap_or_default();+ let added = editor.as_ref().map(|e| pdfcraft_edit::list_added(&e.cos)).unwrap_or_default();+ let links = editor.as_ref().map(|e| pdfcraft_annot::links::list(&e.cos)).unwrap_or_default();+ let sig_cache = Arc::new(pdfcraft_sign::DigestCache::default());let signatures = editor.as_ref().map(|e| signatures_of(&e.cos, &bytes, &self.trust, &sig_cache)).unwrap_or_default();self.next_id += 1;let id = DocId(self.next_id);@@ -1856,7 +1854,7 @@ impl Session {.unwrap_or_else(|m| Err(EditError::Invalid(format!("{} failed unexpectedly ({m}); the document was not changed", edit.label()))))?;// Signed documents are only ever saved incrementally: an edit that needs a full rewrite// (applying redactions, changing security, sanitizing) would invalidate the signatures.- let rewrites = |c: &printcraft_cos::Document| c.full_save_required() || c.encryption_changed();+ let rewrites = |c: &pdfcraft_cos::Document| c.full_save_required() || c.encryption_changed();if signed && rewrites(&next) && !rewrites(&editor.cos) {return Err(EditError::SignedRewrite(edit.label()));}@@ -1940,14 +1938,14 @@ impl Session {} else {editor.cos.bytes().clone()};- let form = Arc::new(printcraft_forms::fields(&editor.cos));+ let form = Arc::new(pdfcraft_forms::fields(&editor.cos));match scope {Scope::Comments => doc.info.annotations = comment_list(&editor.cos),Scope::Form => {for f in &mut doc.info.fields {if let Some(ff) = form.iter().find(|x| x.name == f.name) {f.value = match ff.kind {- printcraft_forms::FieldKind::CheckBox | printcraft_forms::FieldKind::Radio => {+ pdfcraft_forms::FieldKind::CheckBox | pdfcraft_forms::FieldKind::Radio => {Some(ff.value.first().cloned().unwrap_or_else(|| "Off".into()))}_ if ff.value.is_empty() => None,@@ -1986,10 +1984,10 @@ impl Session {}}doc.info = info;- doc.form = Arc::new(printcraft_forms::fields(&editor.cos));- doc.marks = printcraft_edit::marks_present(&editor.cos);- doc.added = printcraft_edit::list_added(&editor.cos);- doc.links = printcraft_annot::links::list(&editor.cos);+ doc.form = Arc::new(pdfcraft_forms::fields(&editor.cos));+ doc.marks = pdfcraft_edit::marks_present(&editor.cos);+ doc.added = pdfcraft_edit::list_added(&editor.cos);+ doc.links = pdfcraft_annot::links::list(&editor.cos);doc.signatures = signatures_of(&editor.cos, &bytes, &doc.trust, &doc.sig_cache);doc.bytes = bytes.clone();doc.renderer = RenderPool::new(bytes, render_threads(), doc.config.clone());@@ -2004,7 +2002,7 @@ impl Session {if !editor.cos.is_modified() {return Ok(editor.cos.bytes().clone());}- let opts = SaveOptions { mod_date: self.now().map(printcraft_cos::pdf_date), ..SaveOptions::default() };+ let opts = SaveOptions { mod_date: self.now().map(pdfcraft_cos::pdf_date), ..SaveOptions::default() };guard(|| write_incremental(&editor.cos, &opts)).map_err(EditError::Write)?.map(Arc::new).map_err(|e| EditError::Write(e.to_string()))}@@ -2015,7 +2013,7 @@ impl Session {return Err(EditError::Signed);}let editor = doc.editor.as_ref().ok_or_else(|| EditError::ReadOnly(doc.read_only_reason.clone().unwrap_or_default()))?;- let opts = SaveOptions { mod_date: self.now().map(printcraft_cos::pdf_date), ..SaveOptions::default() };+ let opts = SaveOptions { mod_date: self.now().map(pdfcraft_cos::pdf_date), ..SaveOptions::default() };guard(|| write_full(&editor.cos, &opts)).map_err(EditError::Write)?.map(Arc::new).map_err(|e| EditError::Write(e.to_string()))}@@ -2026,7 +2024,7 @@ impl Session {if let Some(editor) = doc.editor.as_mut() {// An encrypted file needs the password it is protected with now (the owner// password when known, so saving never downgrades this session's rights).- editor.cos = printcraft_cos::Document::open_with_password(bytes.clone(), editor.keys.reopen.as_deref())+ editor.cos = pdfcraft_cos::Document::open_with_password(bytes.clone(), editor.keys.reopen.as_deref()).map_err(|e| EditError::Reopen(e.to_string()))?;}if let Some(p) = path {@@ -2051,7 +2049,7 @@ impl Session {candidates.push(Keys::default());let (cos, keys) = candidates.into_iter()- .find_map(|k| printcraft_cos::Document::open_with_password(base.clone(), k.reopen.as_deref()).ok().map(|c| (c, k)))+ .find_map(|k| pdfcraft_cos::Document::open_with_password(base.clone(), k.reopen.as_deref()).ok().map(|c| (c, k))).ok_or_else(|| EditError::Reopen("the saved file can't be opened".into()))?;editor.cos = cos;editor.keys = keys;@@ -2065,22 +2063,22 @@ impl Session {/// The page count of another PDF (Replace Pages, Insert Pages dialogs).pub fn page_count_of(&self, name: &str, bytes: &Arc<Vec<u8>>) -> Result<usize, EditError> {- Ok(printcraft_organize::page_count(&open_source(name, bytes)?)?)+ Ok(pdfcraft_organize::page_count(&open_source(name, bytes)?)?)}/// A new blank document (Create ▸ Blank page).pub fn create_blank(&self, width: f64, height: f64, pages: usize) -> Result<Arc<Vec<u8>>, EditError> {- self.write_new(&printcraft_create::blank(width, height, pages)?)+ self.write_new(&pdfcraft_create::blank(width, height, pages)?)}/// A new document with one page per image (PNG, JPEG).pub fn create_from_images(&self, images: &[(String, Vec<u8>)]) -> Result<Arc<Vec<u8>>, EditError> {- self.write_new(&printcraft_create::from_images(images)?)+ self.write_new(&pdfcraft_create::from_images(images)?)}/// A new document from plain text (US Letter, 11 pt Helvetica).pub fn create_from_text(&self, title: &str, text: &str) -> Result<Arc<Vec<u8>>, EditError> {- self.write_new(&printcraft_create::from_text(title, text, printcraft_create::LETTER, 11.0)?)+ self.write_new(&pdfcraft_create::from_text(title, text, pdfcraft_create::LETTER, 11.0)?)}/// Reduce File Size: Acrobat's defaults (images above 225 ppi to 150 ppi, JPEG medium@@ -2102,11 +2100,11 @@ impl Session {}let editor = doc.editor.as_ref().ok_or_else(|| EditError::ReadOnly(doc.read_only_reason.clone().unwrap_or_default()))?;let mut cos = editor.cos.clone();- let discarded = if discard.is_empty() { Vec::new() } else { printcraft_redact::sanitize::remove_hidden(&mut cos, discard)? };+ let discarded = if discard.is_empty() { Vec::new() } else { pdfcraft_redact::sanitize::remove_hidden(&mut cos, discard)? };let report = optimize::optimize(&mut cos, settings).map_err(|e| EditError::Optimize(e.to_string()))?;- let all: Vec<printcraft_cos::ObjRef> = cos.object_numbers().into_iter().map(|n| printcraft_cos::ObjRef::new(n, cos.generation(n))).collect();- let merged = printcraft_organize::dedupe_resources(&mut cos, &all, false);- let opts = SaveOptions { mod_date: self.now().map(printcraft_cos::pdf_date), ..SaveOptions::default() };+ let all: Vec<pdfcraft_cos::ObjRef> = cos.object_numbers().into_iter().map(|n| pdfcraft_cos::ObjRef::new(n, cos.generation(n))).collect();+ let merged = pdfcraft_organize::dedupe_resources(&mut cos, &all, false);+ let opts = SaveOptions { mod_date: self.now().map(pdfcraft_cos::pdf_date), ..SaveOptions::default() };let bytes = write_full(&cos, &opts).map_err(|e| EditError::Write(e.to_string()))?;Ok((Arc::new(bytes), OptimizeReport { optimize: report, merged, discarded }))}@@ -2117,18 +2115,19 @@ impl Session {let doc = self.get(id).ok_or(EditError::NoDocument)?;let cos = match doc.editor.as_ref() {Some(e) => e.cos.clone(),- None => printcraft_cos::Document::open_with_password(doc.bytes.clone(), doc.password.as_deref())- .map_err(|e| EditError::Write(e.to_string()))?,+ None => {+ pdfcraft_cos::Document::open_with_password(doc.bytes.clone(), doc.password.as_deref()).map_err(|e| EditError::Write(e.to_string()))?+ }};guard(|| match format {- DataFormat::Xfdf => printcraft_xfdf::export_xfdf(&cos, comments, fields, &doc.name).into_bytes(),- DataFormat::Fdf => printcraft_xfdf::export_fdf(&cos, comments, fields, &doc.name),- other => printcraft_xfdf::export_data(&cos, other).into_bytes(),+ DataFormat::Xfdf => pdfcraft_xfdf::export_xfdf(&cos, comments, fields, &doc.name).into_bytes(),+ DataFormat::Fdf => pdfcraft_xfdf::export_fdf(&cos, comments, fields, &doc.name),+ other => pdfcraft_xfdf::export_data(&cos, other).into_bytes(),}).map_err(EditError::Write)}- /// The print-ready PDF for `settings` (sheets laid out for the paper; see `printcraft-print`).+ /// The print-ready PDF for `settings` (sheets laid out for the paper; see `pdfcraft-print`).pub fn print_pdf(&self, id: DocId, settings: &print::Settings) -> Result<Vec<u8>, EditError> {let doc = self.get(id).ok_or(EditError::NoDocument)?;if !doc.allows_printing() {@@ -2136,17 +2135,18 @@ impl Session {}let cos = match doc.editor.as_ref() {Some(e) => e.cos.clone(),- None => printcraft_cos::Document::open_with_password(doc.bytes.clone(), doc.password.as_deref())- .map_err(|e| EditError::Write(e.to_string()))?,+ None => {+ pdfcraft_cos::Document::open_with_password(doc.bytes.clone(), doc.password.as_deref()).map_err(|e| EditError::Write(e.to_string()))?+ }};- printcraft_print::impose(&cos, settings).map_err(|e| EditError::Print(e.to_string()))+ pdfcraft_print::impose(&cos, settings).map_err(|e| EditError::Print(e.to_string()))}/// Combine whole files, in order, into new PDF bytes (one bookmark per file).pub fn combine(&self, sources: &[(String, Arc<Vec<u8>>)]) -> Result<Arc<Vec<u8>>, EditError> {let docs = sources.iter().map(|(n, b)| open_source(n, b)).collect::<Result<Vec<_>, _>>()?;- let named: Vec<(&str, &printcraft_cos::Document)> = sources.iter().map(|(n, _)| n.as_str()).zip(docs.iter()).collect();- let out = printcraft_organize::combine(&named)?;+ let named: Vec<(&str, &pdfcraft_cos::Document)> = sources.iter().map(|(n, _)| n.as_str()).zip(docs.iter()).collect();+ let out = pdfcraft_organize::combine(&named)?;self.write_new(&out)}@@ -2158,17 +2158,17 @@ impl Session {let range = range.as_deref().map(str::trim).filter(|r| !r.is_empty());pages.push(match range {Some(r) => {- let n = printcraft_organize::page_count(d)?;- let p = printcraft_print::select_pages(n, Some(r), &[], printcraft_print::Subset::All, false)+ let n = pdfcraft_organize::page_count(d)?;+ let p = pdfcraft_print::select_pages(n, Some(r), &[], pdfcraft_print::Subset::All, false).map_err(|e| EditError::Print(format!("{name}: {e}")))?;Some(p)}None => None,});}- let named: Vec<(&str, &printcraft_cos::Document, Option<&[usize]>)> =+ let named: Vec<(&str, &pdfcraft_cos::Document, Option<&[usize]>)> =sources.iter().zip(docs.iter()).zip(&pages).map(|(((n, _, _), d), p)| (n.as_str(), d, p.as_deref())).collect();- let out = printcraft_organize::combine_selected(&named)?;+ let out = pdfcraft_organize::combine_selected(&named)?;self.write_new(&out)}@@ -2178,21 +2178,21 @@ impl Session {if src.permissions().is_some_and(|p| !p.assemble()) {return Err(EditError::NotPermitted("extracting pages"));}- let out = printcraft_organize::extract_pages(src, pages)?;+ let out = pdfcraft_organize::extract_pages(src, pages)?;self.write_new(&out)}/// Split the document into several new PDFs.- pub fn split(&self, id: DocId, by: &printcraft_organize::SplitBy) -> Result<Vec<SplitPart>, EditError> {+ pub fn split(&self, id: DocId, by: &pdfcraft_organize::SplitBy) -> Result<Vec<SplitPart>, EditError> {let src = self.cos(id)?;if src.permissions().is_some_and(|p| !p.assemble()) {return Err(EditError::NotPermitted("splitting the document"));}- let n = printcraft_organize::page_count(src)?;- printcraft_organize::split_ranges(n, by)+ let n = pdfcraft_organize::page_count(src)?;+ pdfcraft_organize::split_ranges(n, by).into_iter().map(|r| {- let doc = printcraft_organize::extract_pages(src, &r.clone().collect::<Vec<_>>())?;+ let doc = pdfcraft_organize::extract_pages(src, &r.clone().collect::<Vec<_>>())?;Ok((r.start + 1, r.end, self.write_new(&doc)?))}).collect()@@ -2206,18 +2206,18 @@ impl Session {if src.permissions().is_some_and(|p| !p.assemble()) {return Err(EditError::NotPermitted("splitting the document"));}- let n = printcraft_organize::page_count(src)?;+ let n = pdfcraft_organize::page_count(src)?;let mut cuts = Vec::new();let mut used = 0usize;for p in 0..n {- let size = self.write_new(&printcraft_organize::extract_pages(src, &[p])?)?.len();+ let size = self.write_new(&pdfcraft_organize::extract_pages(src, &[p])?)?.len();if used > 0 && used + size > max_bytes {cuts.push(p);used = 0;}used += size;}- self.split(id, &printcraft_organize::SplitBy::Before(cuts))+ self.split(id, &pdfcraft_organize::SplitBy::Before(cuts))}/// Web addresses in the text of every page (Create links from URLs): (page, one rectangle@@ -2225,15 +2225,14 @@ impl Session {pub fn find_urls(&self, id: DocId) -> Vec<(usize, Vec<[f64; 4]>, String)> {let Some(doc) = self.get(id) else { return Vec::new() };let config = RenderConfig { password: doc.password.as_deref().map(Arc::from), ..Default::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);let mut out = Vec::new();for page in 0..doc.info.pages.len() {- let res =- r.render(printcraft_render::RenderRequest { page, kind: printcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });+ let res = r.render(pdfcraft_render::RenderRequest { page, kind: pdfcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });let Some(text) = res.text else { continue };let found: std::cell::RefCell<Vec<(std::ops::Range<usize>, String)>> = Default::default();let hits = text.find_with(|chars| {- let urls = printcraft_annot::links::find_urls(chars);+ let urls = pdfcraft_annot::links::find_urls(chars);let ranges = urls.iter().map(|u| u.0.clone()).collect();*found.borrow_mut() = urls;ranges@@ -2283,13 +2282,13 @@ impl Session {Ok(id)}- fn cos(&self, id: DocId) -> Result<&printcraft_cos::Document, EditError> {+ fn cos(&self, id: DocId) -> Result<&pdfcraft_cos::Document, EditError> {let doc = self.get(id).ok_or(EditError::NoDocument)?;doc.editor.as_ref().map(|e| &e.cos).ok_or_else(|| EditError::ReadOnly(doc.read_only_reason.clone().unwrap_or_default()))}- fn write_new(&self, doc: &printcraft_cos::Document) -> Result<Arc<Vec<u8>>, EditError> {- let opts = SaveOptions { mod_date: self.now().map(printcraft_cos::pdf_date), ..SaveOptions::default() };+ fn write_new(&self, doc: &pdfcraft_cos::Document) -> Result<Arc<Vec<u8>>, EditError> {+ let opts = SaveOptions { mod_date: self.now().map(pdfcraft_cos::pdf_date), ..SaveOptions::default() };write_full(doc, &opts).map(Arc::new).map_err(|e| EditError::Write(e.to_string()))}@@ -2360,12 +2359,12 @@ impl Session {}/// The certificates trusted for signing.- pub fn trusted_certificates(&self) -> &[printcraft_sign::Certificate] {+ pub fn trusted_certificates(&self) -> &[pdfcraft_sign::Certificate] {&self.trust.certs}/// Replace the trusted certificates and revalidate every open document's signatures.- pub fn set_trusted_certificates(&mut self, certs: Vec<printcraft_sign::Certificate>) {+ pub fn set_trusted_certificates(&mut self, certs: Vec<pdfcraft_sign::Certificate>) {self.trust = Arc::new(TrustStore { certs });for doc in &mut self.docs {doc.trust = self.trust.clone();@@ -2378,7 +2377,7 @@ impl Session {/// The signing time as a PDF date in local time with its offset (`D:…+02'00'`).pub fn signing_date(&self) -> String {let offset = if self.clock.is_some() { 0 } else { local_utc_offset() };- let local = printcraft_cos::pdf_date(self.now().unwrap_or(0) + offset);+ let local = pdfcraft_cos::pdf_date(self.now().unwrap_or(0) + offset);let stamp = local.trim_end_matches('Z');if offset == 0 {return format!("{stamp}Z");@@ -2390,14 +2389,14 @@ impl Session {/// Sign the document's current state with `id` (Use a certificate ▸ Digitally sign). Returns/// the signed file; the caller saves it and then calls [`Session::mark_signed`]. An empty/// `opts.date` takes the session clock.- pub fn sign(&self, doc: DocId, id: &printcraft_sign::DigitalId, mut opts: SignOptions) -> Result<Arc<Vec<u8>>, EditError> {+ pub fn sign(&self, doc: DocId, id: &pdfcraft_sign::DigitalId, mut opts: SignOptions) -> Result<Arc<Vec<u8>>, EditError> {let d = self.get(doc).ok_or(EditError::NoDocument)?;// (Encrypted documents are refused by the signer for now.)let editor = d.editor.as_ref().ok_or_else(|| EditError::ReadOnly(d.read_only_reason.clone().unwrap_or_default()))?;if opts.date.is_empty() {opts.date = self.signing_date();}- Ok(Arc::new(printcraft_sign::sign(&editor.cos, id, &opts)?))+ Ok(Arc::new(pdfcraft_sign::sign(&editor.cos, id, &opts)?))}/// Record that the signed file `bytes` was saved (to `path`): like [`Session::mark_saved`],@@ -2435,15 +2434,15 @@ pub struct MarkFile {}/// Bring a mark's picture into `doc`: a PDF page as a form XObject, or an image.-fn mark_source(doc: &mut printcraft_cos::Document, f: &MarkFile) -> Result<printcraft_edit::MarkSource, EditError> {+fn mark_source(doc: &mut pdfcraft_cos::Document, f: &MarkFile) -> Result<pdfcraft_edit::MarkSource, EditError> {let head = &f.bytes[..f.bytes.len().min(1024)];if head.windows(5).any(|w| w == b"%PDF-") {- let src = printcraft_cos::Document::open(f.bytes.clone()).map_err(|e| EditError::Source(format!("{}: {e}", f.name)))?;- let (xobject, size) = printcraft_organize::page_as_form(doc, &src, f.page)?;- Ok(printcraft_edit::MarkSource { xobject, size, image: false })+ let src = pdfcraft_cos::Document::open(f.bytes.clone()).map_err(|e| EditError::Source(format!("{}: {e}", f.name)))?;+ let (xobject, size) = pdfcraft_organize::page_as_form(doc, &src, f.page)?;+ Ok(pdfcraft_edit::MarkSource { xobject, size, image: false })} else {- let (xobject, size) = printcraft_create::image_xobject(doc, &f.name, &f.bytes)?;- Ok(printcraft_edit::MarkSource { xobject, size, image: true })+ let (xobject, size) = pdfcraft_create::image_xobject(doc, &f.name, &f.bytes)?;+ Ok(pdfcraft_edit::MarkSource { xobject, size, image: true })}}@@ -2507,7 +2506,7 @@ pub fn comment_type_name(subtype: &str) -> &str {}/// [`comment_type_name`], telling callouts, clouds and typewriter text apart by `/IT`.-pub fn comment_kind(a: &printcraft_render::Annotation) -> &str {+pub fn comment_kind(a: &pdfcraft_render::Annotation) -> &str {match a.intent.as_deref() {Some("FreeTextCallout") => "Callout",Some("PolygonCloud") => "Cloud",@@ -2519,13 +2518,13 @@ pub fn comment_kind(a: &printcraft_render::Annotation) -> &str {/// The text of a comment summary: one block per comment (replies indented under it), with a/// "Page N" heading when sorted by page. Checkmarks and status replies are left out, as are/// pop-ups; the number is the comment's position on its page.-pub fn comment_summary(name: &str, all: &[printcraft_render::Annotation], sort: SummarySort) -> String {+pub fn comment_summary(name: &str, all: &[pdfcraft_render::Annotation], sort: SummarySort) -> String {use std::fmt::Write;- let top: Vec<&printcraft_render::Annotation> = all.iter().filter(|a| a.in_reply_to.is_none() && a.state.is_none()).collect();- let replies_of = |a: &printcraft_render::Annotation| -> Vec<&printcraft_render::Annotation> {+ let top: Vec<&pdfcraft_render::Annotation> = all.iter().filter(|a| a.in_reply_to.is_none() && a.state.is_none()).collect();+ let replies_of = |a: &pdfcraft_render::Annotation| -> Vec<&pdfcraft_render::Annotation> {all.iter().filter(|r| r.state.is_none() && r.in_reply_to.is_some() && r.in_reply_to == a.name && a.name.is_some()).collect()};- let mut numbered: Vec<(usize, &printcraft_render::Annotation)> = Vec::new();+ let mut numbered: Vec<(usize, &pdfcraft_render::Annotation)> = Vec::new();let mut last = usize::MAX;let mut n = 0;for a in &top {@@ -2594,7 +2593,7 @@ pub enum PageOrientation {}/// The pages of `pages` (0-based) that pass the filters.-pub fn filter_pages(info: &printcraft_render::DocInfo, pages: &[usize], parity: PageParity, orientation: PageOrientation) -> Vec<usize> {+pub fn filter_pages(info: &pdfcraft_render::DocInfo, pages: &[usize], parity: PageParity, orientation: PageOrientation) -> Vec<usize> {pages.iter().copied()diff --git a/crates/engine/src/links.rs b/crates/engine/src/links.rsindex fd474d057..3df31cd11 100644--- a/crates/engine/src/links.rs+++ b/crates/engine/src/links.rs@@ -1,13 +1,13 @@-//! Where PrintCraft and the ArtCraft community live on the web. One table, so the Help menu, the+//! Where PdfCraft and the ArtCraft community live on the web. One table, so the Help menu, the//! About dialog, the home screen, the CLI and the README agree./// The app's name in ArtCraft URLs (`getartcraft.com/apps/{APP}`, `github.com/storytold/{APP}`).-pub const APP: &str = "printcraft";+pub const APP: &str = "pdfcraft";pub const DISCORD: &str = "https://discord.gg/artcraft";pub const WEBSITE: &str = "https://getartcraft.com";-pub const APP_PAGE: &str = "https://getartcraft.com/apps/printcraft";-pub const GITHUB: &str = "https://github.com/storytold/printcraft";+pub const APP_PAGE: &str = "https://getartcraft.com/apps/pdfcraft";+pub const GITHUB: &str = "https://github.com/storytold/pdfcraft";/// A link and the registry command that opens it.#[derive(Clone, Copy, Debug)]@@ -22,8 +22,8 @@ pub struct Link {/// In the order they are shown. Discord comes first: it is where people get help fastest.pub const LINKS: &[Link] = &[Link { command: "help.discord", label: "Join the ArtCraft Discord", url: DISCORD, icon: "messages-square" },- Link { command: "help.app_page", label: "PrintCraft web page", url: APP_PAGE, icon: "globe" },- Link { command: "help.github", label: "PrintCraft on GitHub", url: GITHUB, icon: "code-xml" },+ Link { command: "help.app_page", label: "PdfCraft web page", url: APP_PAGE, icon: "globe" },+ Link { command: "help.github", label: "PdfCraft on GitHub", url: GITHUB, icon: "code-xml" },Link { command: "help.website", label: "ArtCraft website", url: WEBSITE, icon: "external-link" },];diff --git a/crates/engine/src/ocr.rs b/crates/engine/src/ocr.rsindex 4c803372a..cb245f14f 100644--- a/crates/engine/src/ocr.rs+++ b/crates/engine/src/ocr.rs@@ -7,9 +7,9 @@use std::sync::{Arc, Mutex};-use printcraft_render::{PageInfo, PageRenderer, RenderConfig, RenderRequest, RequestKind};+use pdfcraft_render::{PageInfo, PageRenderer, RenderConfig, RenderRequest, RequestKind};-pub use printcraft_ocr::{LANGUAGES, Models, Ocr, OcrError, PlacedWord};+pub use pdfcraft_ocr::{LANGUAGES, Models, Ocr, OcrError, PlacedWord};use crate::{DocId, Edit, EditError, Session};diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rsindex 545dcb0f1..a0f8a32d9 100644--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@ -38,8 +38,8 @@ fn session_with(n: usize) -> (Session, DocId) {fn page_texts(s: &Session, id: DocId) -> Vec<String> {let doc = s.get(id).unwrap();- let config = printcraft_render::RenderConfig { password: doc.password.as_deref().map(Arc::from), ..Default::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let config = pdfcraft_render::RenderConfig { password: doc.password.as_deref().map(Arc::from), ..Default::default() };+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);(0..doc.info.pages.len()).map(|p| {let r = r.render(RenderRequestFor::text(p));@@ -51,8 +51,8 @@ fn page_texts(s: &Session, id: DocId) -> Vec<String> {/// Shorthand for building text-extraction requests.struct RenderRequestFor;impl RenderRequestFor {- fn text(page: usize) -> printcraft_render::RenderRequest {- printcraft_render::RenderRequest { page, kind: printcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() }+ fn text(page: usize) -> pdfcraft_render::RenderRequest {+ pdfcraft_render::RenderRequest { page, kind: pdfcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() }}}@@ -94,7 +94,7 @@ fn failed_edit_changes_nothing() {let (mut s, id) = session_with(2);let before = s.get(id).unwrap().bytes.clone();let err = s.apply(id, Edit::DeletePages { pages: vec![0, 1] }).unwrap_err();- assert_eq!(err, EditError::Organize(printcraft_organize::OrganizeError::WouldRemoveAllPages));+ assert_eq!(err, EditError::Organize(pdfcraft_organize::OrganizeError::WouldRemoveAllPages));let doc = s.get(id).unwrap();assert!(!doc.dirty);assert_eq!(doc.can_undo(), None);@@ -121,7 +121,7 @@ fn save_is_incremental_stamps_mod_date_and_rebases() {s.apply(id, Edit::RotatePages { pages: vec![1], degrees: -90 }).unwrap();let second = s.save_bytes(id).unwrap();assert_eq!(&second[..saved.len()], &saved[..]);- let reopened = printcraft_cos::Document::open(second).unwrap();+ let reopened = pdfcraft_cos::Document::open(second).unwrap();assert_eq!(reopened.revisions().len(), 3);}@@ -206,7 +206,7 @@ fn combine_extract_split_and_insert_from_file() {let eid = s.open_new("Extract.pdf", ex).unwrap();assert_eq!(page_texts(&s, eid), ["Page 3", "Page 1"]);// Split every 2 pages.- let parts = s.split(id, &printcraft_organize::SplitBy::PageCount(2)).unwrap();+ let parts = s.split(id, &pdfcraft_organize::SplitBy::PageCount(2)).unwrap();assert_eq!(parts.iter().map(|(a, b, _)| (*a, *b)).collect::<Vec<_>>(), [(1, 2), (3, 3)]);// Insert pages from a file, undoably, into the open document.s.apply(id, Edit::InsertPagesFrom { name: "b.pdf".into(), bytes: other, pages: Some(vec![1]), at: 1 }).unwrap();@@ -219,9 +219,9 @@ fn combine_extract_split_and_insert_from_file() {}fn protected(user: &str, owner: &str, permissions: i32) -> Arc<Vec<u8>> {- let mut doc = printcraft_cos::Document::open(Arc::new(fixture(2))).unwrap();- doc.set_encryption(&printcraft_cos::NewEncryption {- algorithm: printcraft_cos::Algorithm::Aes256,+ let mut doc = pdfcraft_cos::Document::open(Arc::new(fixture(2))).unwrap();+ doc.set_encryption(&pdfcraft_cos::NewEncryption {+ algorithm: pdfcraft_cos::Algorithm::Aes256,user_password: user,owner_password: owner,permissions,@@ -229,7 +229,7 @@ fn protected(user: &str, owner: &str, permissions: i32) -> Arc<Vec<u8>> {seed: [7; 32],}).unwrap();- Arc::new(printcraft_cos::write_full(&doc, &Default::default()).unwrap())+ Arc::new(pdfcraft_cos::write_full(&doc, &Default::default()).unwrap())}#[test]@@ -244,7 +244,7 @@ fn encrypted_documents_open_edit_and_save_encrypted() {s.apply(id, Edit::RotatePages { pages: vec![0], degrees: 90 }).unwrap();let saved = s.save_bytes(id).unwrap();assert_eq!(&saved[..bytes.len()], &bytes[..], "incremental");- assert!(printcraft_cos::Document::open(saved.clone()).is_err(), "still protected after saving");+ assert!(pdfcraft_cos::Document::open(saved.clone()).is_err(), "still protected after saving");let mut s2 = Session::new();let id2 = s2.open("x.pdf", None, saved, Some("pw")).unwrap();assert_eq!(s2.get(id2).unwrap().info.pages[0].rotation, 90);@@ -280,9 +280,9 @@ fn combining_protected_files_is_refused_clearly() {#[test]fn owner_password_of_older_revisions_opens_the_viewer_too() {- for alg in [printcraft_cos::Algorithm::Rc4_128, printcraft_cos::Algorithm::Aes128] {- let mut doc = printcraft_cos::Document::open(Arc::new(fixture(1))).unwrap();- doc.set_encryption(&printcraft_cos::NewEncryption {+ for alg in [pdfcraft_cos::Algorithm::Rc4_128, pdfcraft_cos::Algorithm::Aes128] {+ let mut doc = pdfcraft_cos::Document::open(Arc::new(fixture(1))).unwrap();+ doc.set_encryption(&pdfcraft_cos::NewEncryption {algorithm: alg,user_password: "u",owner_password: "o",@@ -291,7 +291,7 @@ fn owner_password_of_older_revisions_opens_the_viewer_too() {seed: [1; 32],}).unwrap();- let bytes = Arc::new(printcraft_cos::write_full(&doc, &Default::default()).unwrap());+ let bytes = Arc::new(pdfcraft_cos::write_full(&doc, &Default::default()).unwrap());let mut s = Session::new();let id = s.open("x.pdf", None, bytes, Some("o")).unwrap_or_else(|e| panic!("{alg:?}: {e}"));let d = s.get(id).unwrap();@@ -332,7 +332,7 @@ fn recovered_documents_reopen_unsaved_at_their_original_path() {assert!(s2.autosave_snapshots().is_empty(), "already in the recovery store");}-fn outline_titles(items: &[printcraft_render::OutlineItem]) -> Vec<String> {+fn outline_titles(items: &[pdfcraft_render::OutlineItem]) -> Vec<String> {items.iter().map(|o| {@@ -374,7 +374,7 @@ fn bookmark_edits_show_in_the_viewer_undo_and_save() {fn number_pages_shows_in_the_viewer_and_undoes() {let (mut s, id) = session_with(5);let labels = |s: &Session| s.get(id).unwrap().info.pages.iter().map(|p| p.label.clone()).collect::<Vec<_>>();- use printcraft_organize::LabelStyle;+ use pdfcraft_organize::LabelStyle;s.apply(id, Edit::NumberPages { from: 0, to: 1, style: LabelStyle::LowerRoman, prefix: String::new(), first: 1 }).unwrap();s.apply(id, Edit::NumberPages { from: 2, to: 4, style: LabelStyle::Decimal, prefix: "§".into(), first: 10 }).unwrap();// The inspector (lopdf-based, independent) formats them the same way.@@ -387,8 +387,8 @@ fn number_pages_shows_in_the_viewer_and_undoes() {/// RGBA of the pixel at PDF point (x, y) on `page`, rendered at 1 px/pt (page height 300).fn pixel(s: &Session, id: DocId, page: usize, x: u32, y: u32) -> [u8; 4] {let doc = s.get(id).unwrap();- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), doc.config.clone());- let out = r.render(printcraft_render::RenderRequest { page, scale: 1.0, ..Default::default() });+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), doc.config.clone());+ let out = r.render(pdfcraft_render::RenderRequest { page, scale: 1.0, ..Default::default() });assert!(out.error.is_none(), "{:?}", out.error);let i = (((300 - y) * out.width + x) * 4) as usize;out.rgba[i..i + 4].try_into().unwrap()@@ -468,10 +468,10 @@ fn highlight_multiplies_over_text() {#[test]fn comment_permission_is_enforced() {- let mut cos = printcraft_cos::Document::open(Arc::new(fixture(1))).unwrap();+ let mut cos = pdfcraft_cos::Document::open(Arc::new(fixture(1))).unwrap();// Owner "own", empty user password, everything allowed except commenting (bit 6).- let params = printcraft_cos::NewEncryption {- algorithm: printcraft_cos::Algorithm::Aes256,+ let params = pdfcraft_cos::NewEncryption {+ algorithm: pdfcraft_cos::Algorithm::Aes256,user_password: "",owner_password: "own",permissions: !(1 << 5),@@ -479,7 +479,7 @@ fn comment_permission_is_enforced() {seed: [7; 32],};cos.set_encryption(¶ms).unwrap();- let bytes = printcraft_cos::write_full(&cos, &printcraft_cos::SaveOptions::default()).unwrap();+ let bytes = pdfcraft_cos::write_full(&cos, &pdfcraft_cos::SaveOptions::default()).unwrap();let mut s = Session::new();let id = s.open("locked.pdf", None, Arc::new(bytes), None).unwrap();let err = s.apply(id, rect_comment(0, [10.0, 10.0, 50.0, 50.0])).unwrap_err();@@ -513,7 +513,7 @@ fn protect_with_an_open_password_then_save_reopen_and_undo() {assert_eq!(d.security_summary().unwrap().method, "AES, 256-bit");assert_eq!(page_texts(&s, id), ["Page 1", "Page 2"], "still viewable in this session");let saved = s.save_bytes(id).unwrap();- assert!(printcraft_cos::Document::open(saved.clone()).is_err(), "needs the password");+ assert!(pdfcraft_cos::Document::open(saved.clone()).is_err(), "needs the password");s.mark_saved(id, saved.clone(), None).unwrap();// Further edits keep working and saving stays encrypted.s.apply(id, Edit::RotatePages { pages: vec![0], degrees: 90 }).unwrap();@@ -526,7 +526,7 @@ fn protect_with_an_open_password_then_save_reopen_and_undo() {assert!(s2.get(id2).unwrap().allows_security_change());s2.apply(id2, Edit::RemoveProtection).unwrap();let plain = s2.save_bytes(id2).unwrap();- assert!(printcraft_cos::Document::open(plain).is_ok());+ assert!(pdfcraft_cos::Document::open(plain).is_ok());}#[test]@@ -557,7 +557,7 @@ fn protection_is_validated_undoable_and_never_logged() {let (mut s, id) = session_with(1);assert!(matches!(s.apply(id, Edit::Protect(protection(None, None))), Err(EditError::Protection(_))));assert!(matches!(s.apply(id, Edit::Protect(protection(Some("same"), Some("same")))), Err(EditError::Protection(_))));- let rc4 = Protection { algorithm: printcraft_cos::Algorithm::Rc4_128, ..protection(Some("pässword"), None) };+ let rc4 = Protection { algorithm: pdfcraft_cos::Algorithm::Rc4_128, ..protection(Some("pässword"), None) };assert!(matches!(s.apply(id, Edit::Protect(rc4)), Err(EditError::Protection(_))));assert!(!format!("{:?}", Edit::Protect(protection(Some("hunter2"), Some("x")))).contains("hunter2"));s.apply(id, Edit::Protect(protection(Some("pw"), Some("owner")))).unwrap();@@ -645,7 +645,7 @@ fn comment_edits_refresh_the_list_exactly_as_a_full_inspection_would() {s.apply(id, Edit::DeleteAnnotation { page: 1, index: 0 }).unwrap();s.undo(id).unwrap();let d = s.get(id).unwrap();- let full = printcraft_render::inspect(d.bytes.clone(), None).unwrap();+ let full = pdfcraft_render::inspect(d.bytes.clone(), None).unwrap();assert_eq!(format!("{:?}", d.info.annotations), format!("{:?}", full.annotations));assert_eq!(d.info.file_size, full.file_size);assert_eq!(d.info.annotations.len(), 7);@@ -659,8 +659,8 @@ fn form_edits_refresh_field_values_without_a_full_inspection() {s.apply(id, Edit::SetFieldValue { name: "name".into(), value: FieldValue::Text("Ada".into()) }).unwrap();s.apply(id, Edit::SetFieldValue { name: "ok".into(), value: FieldValue::Check(true) }).unwrap();let d = s.get(id).unwrap();- let full = printcraft_render::inspect(d.bytes.clone(), None).unwrap();- let values = |fs: &[printcraft_render::Field]| fs.iter().map(|f| (f.name.clone(), f.value.clone())).collect::<Vec<_>>();+ let full = pdfcraft_render::inspect(d.bytes.clone(), None).unwrap();+ let values = |fs: &[pdfcraft_render::Field]| fs.iter().map(|f| (f.name.clone(), f.value.clone())).collect::<Vec<_>>();assert_eq!(values(&d.info.fields), values(&full.fields));assert_eq!(values(&d.info.fields), [("name".to_string(), Some("Ada".to_string())), ("ok".to_string(), Some("Yes".to_string()))]);}@@ -698,7 +698,7 @@ fn redaction_marks_apply_for_good_and_undo() {let (mut s, id) = session_with(2);// "Page 1" at 24 pt from x 20: the "1" starts near x 82.7 (Helvetica widths).let shape =- Shape::Redact { quads: vec![printcraft_annot::rect_quad([80.0, 140.0, 100.0, 180.0])], overlay: String::new(), look: Default::default() };+ Shape::Redact { quads: vec![pdfcraft_annot::rect_quad([80.0, 140.0, 100.0, 180.0])], overlay: String::new(), look: Default::default() };let mark =Edit::AddAnnotation(NewAnnotation { page: 0, style: Style::default_for(&shape), shape, contents: String::new(), author: "Ada".into() });s.apply(id, mark).unwrap();@@ -917,8 +917,8 @@ fn added_images_rotate_flip_and_crop_as_drawn() {s.apply(id, Edit::AddImage { page: 0, rect: Some([50.0, 100.0, 150.0, 200.0]), name: "rb.png".into(), bytes: Arc::new(png) }).unwrap();let colour_at = |s: &Session, x: u32, y_from_top: u32| -> [u8; 3] {let doc = s.get(id).unwrap();- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), Default::default());- let out = r.render(printcraft_render::RenderRequest { page: 0, scale: 1.0, ..Default::default() });+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), Default::default());+ let out = r.render(pdfcraft_render::RenderRequest { page: 0, scale: 1.0, ..Default::default() });let i = ((y_from_top * out.width + x) * 4) as usize;[out.rgba[i], out.rgba[i + 1], out.rgba[i + 2]]};@@ -961,7 +961,7 @@ fn revert_goes_back_to_the_saved_version() {fn split_by_size_and_bookmarks_and_page_filters() {let (mut s, id) = session_with(6);// Every page alone is a few hundred bytes: a limit of about two pages gives three parts.- let one = s.split(id, &printcraft_organize::SplitBy::PageCount(1)).unwrap()[0].2.len();+ let one = s.split(id, &pdfcraft_organize::SplitBy::PageCount(1)).unwrap()[0].2.len();let parts = s.split_by_size(id, one * 2 + one / 2).unwrap();assert!(parts.len() >= 2 && parts.len() <= 6, "{}", parts.len());assert_eq!(parts.last().unwrap().1, 6, "every page is in a part");@@ -1397,7 +1397,7 @@ fn exporting_office_files_keeps_images() {assert_eq!(d.export_pages()[0].images.len(), 1);let docx = d.export_office(compare::OfficeFormat::Docx);assert!(docx.windows(16).any(|w| w == b"word/media/image"));- if let Ok(dir) = std::env::var("PRINTCRAFT_EXPORT_DIR") {+ if let Ok(dir) = std::env::var("PDFCRAFT_EXPORT_DIR") {std::fs::write(format!("{dir}/pic.docx"), &docx).unwrap();}assert!(String::from_utf8(d.export_office(compare::OfficeFormat::Html)).unwrap().contains("data:image/png;base64,"));diff --git a/crates/export/Cargo.toml b/crates/export/Cargo.tomlindex 0d5d8bea5..f318d9530 100644--- a/crates/export/Cargo.toml+++ b/crates/export/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-export"+name = "pdfcraft-export"description = "Export a PDF to HTML, Word (.docx) and RTF from its paragraphs and images"version.workspace = trueedition.workspace = truediff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rsindex 5dd507669..e92d09ec1 100644--- a/crates/export/src/lib.rs+++ b/crates/export/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-export — Export a PDF ▸ Word, HTML, RTF (L4).+//! pdfcraft-export — Export a PDF ▸ Word, HTML, RTF (L4).//!//! The engine reduces each page to [`Page`]: paragraphs (text, box, size, bold/italic) and//! images (encoded bytes and box), in reading order. The writers turn that into a flowingdiff --git a/crates/filters/Cargo.toml b/crates/filters/Cargo.tomlindex f8ea7c198..9d2ae34b9 100644--- a/crates/filters/Cargo.toml+++ b/crates/filters/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-filters"+name = "pdfcraft-filters"description = "PDF stream filters (ISO 32000-2 §7.4): Flate, LZW, predictors, ASCII85, ASCIIHex, RunLength"version.workspace = trueedition.workspace = truediff --git a/crates/filters/README.md b/crates/filters/README.mdindex a35749d41..de7f8d223 100644--- a/crates/filters/README.md+++ b/crates/filters/README.md@@ -1,8 +1,8 @@-# printcraft-filters+# pdfcraft-filtersPDF stream filters: the decoders and encoders behind `/Filter` and `/DecodeParms`.-- **Layer:** L0, standalone. No dependency on any other PrintCraft crate. `cos` depends on it (architecture §3 rule 3).+- **Layer:** L0, standalone. No dependency on any other PdfCraft crate. `cos` depends on it (architecture §3 rule 3).- **Licence:** MIT OR Apache-2.0. Clean-room: written from ISO 32000-2 §7.4, RFC 1950/1951 (through `flate2` with the pure-Rust `miniz_oxide` backend), TIFF 6.0 §14 (predictor 2) and RFC 2083 §6 (PNG filters).- `#![forbid(unsafe_code)]`. Builds for `wasm32-unknown-unknown`.diff --git a/crates/filters/fuzz/Cargo.toml b/crates/filters/fuzz/Cargo.tomlindex efa0774d7..27be5f284 100644--- a/crates/filters/fuzz/Cargo.toml+++ b/crates/filters/fuzz/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-filters-fuzz"+name = "pdfcraft-filters-fuzz"version = "0.0.0"publish = falseedition = "2024"@@ -8,13 +8,13 @@ license = "MIT OR Apache-2.0"[package.metadata]cargo-fuzz = true-# Detached from the PrintCraft workspace: run with `cargo +nightly fuzz run decode`+# Detached from the PdfCraft workspace: run with `cargo +nightly fuzz run decode`# from crates/filters/.[workspace][dependencies]libfuzzer-sys = "0.4"-printcraft-filters = { path = ".." }+pdfcraft-filters = { path = ".." }[[bin]]name = "decode"diff --git a/crates/filters/fuzz/fuzz_targets/decode.rs b/crates/filters/fuzz/fuzz_targets/decode.rsindex c9923ed73..22415b95e 100644--- a/crates/filters/fuzz/fuzz_targets/decode.rs+++ b/crates/filters/fuzz/fuzz_targets/decode.rs@@ -2,7 +2,7 @@#![no_main]use libfuzzer_sys::fuzz_target;-use printcraft_filters::{Filter, Params, decode, decode_tolerant};+use pdfcraft_filters::{Filter, Params, decode, decode_tolerant};const FILTERS: [Filter; 5] = [Filter::Flate, Filter::Lzw, Filter::AsciiHex, Filter::Ascii85, Filter::RunLength];const PREDICTORS: [i64; 8] = [1, 2, 10, 11, 12, 13, 14, 15];diff --git a/crates/filters/src/lib.rs b/crates/filters/src/lib.rsindex 6ec4a5de0..ffaf08ca1 100644--- a/crates/filters/src/lib.rs+++ b/crates/filters/src/lib.rs@@ -1,6 +1,6 @@//! PDF stream filters (ISO 32000-2 §7.4).//!-//! Layer L0, standalone: this crate depends on no other PrintCraft crate.+//! Layer L0, standalone: this crate depends on no other PdfCraft crate.//!//! Decoding covers the general-purpose filters (`FlateDecode`, `LZWDecode` with//! TIFF/PNG predictors, `ASCIIHexDecode`, `ASCII85Decode`, `RunLengthDecode`).diff --git a/crates/filters/tests/proptests.rs b/crates/filters/tests/proptests.rsindex a4300e68a..cbf175b0c 100644--- a/crates/filters/tests/proptests.rs+++ b/crates/filters/tests/proptests.rs@@ -1,7 +1,7 @@//! Round-trip property tests (encode → decode) for every encodable filter and predictor,//! and fuzz-style tests feeding arbitrary bytes and parameters to every decoder.-use printcraft_filters::{Filter, FilterError, Params, decode, decode_tolerant, encode};+use pdfcraft_filters::{Filter, FilterError, Params, decode, decode_tolerant, encode};use proptest::prelude::*;const MAX: usize = 1 << 24;@@ -142,7 +142,7 @@ proptest! {#[test]fn flate_bomb_in_chain() {- let bomb = printcraft_filters::encode_flate(&vec![0u8; 32 << 20]);+ let bomb = pdfcraft_filters::encode_flate(&vec![0u8; 32 << 20]);let a85 = encode(&Filter::Ascii85, &Params::default(), &bomb).unwrap();let chain = [(Filter::Ascii85, Params::default()), (Filter::Flate, Params::default())];assert!(matches!(decode(&chain, &a85, 1 << 20), Err(FilterError::LimitExceeded(_))));diff --git a/crates/fonts/Cargo.toml b/crates/fonts/Cargo.tomlindex 8f3970d92..e2b388010 100644--- a/crates/fonts/Cargo.toml+++ b/crates/fonts/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-fonts"+name = "pdfcraft-fonts"description = "Font metrics and text encoding helpers for generated appearances (standard fonts, WinAnsi)"version.workspace = trueedition.workspace = true@@ -9,6 +9,6 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }+pdfcraft-cos = { workspace = true }# Glyph outlines of the bundled script font (typed signatures); already in the tree via egui.skrifa = "0.44"diff --git a/crates/fonts/README.md b/crates/fonts/README.mdindex 0e02c0e3d..a3be1fe1e 100644--- a/crates/fonts/README.md+++ b/crates/fonts/README.md@@ -1,11 +1,11 @@-# printcraft-fonts+# pdfcraft-fonts-Layer L2. Font helpers for the appearance streams PrintCraft generates (comments, form fields).+Layer L2. Font helpers for the appearance streams PdfCraft generates (comments, form fields).Today it holds what generated appearances need without a font program:- `helvetica_width`: an approximation of Helvetica's proportions by character class. No metrics- file or font program from any vendor is bundled; widths are PrintCraft's own estimates, good+ file or font program from any vendor is bundled; widths are PdfCraft's own estimates, goodenough for line breaking and alignment, not for typesetting.- `wrap`: greedy line breaking with that measure (paragraphs on newlines, long words split).- `win_ansi`: Unicode → WinAnsiEncoding bytes (`?` for characters it can't represent), anddiff --git a/crates/fonts/src/craft.rs b/crates/fonts/src/craft.rsindex 0898b1673..7bb82fa67 100644--- a/crates/fonts/src/craft.rs+++ b/crates/fonts/src/craft.rs@@ -1,6 +1,6 @@//! Fonts from the optional craft-fonts build input (<https://github.com/storytold/craft-fonts>).//!-//! `build.rs` embeds every font in craft-fonts' manifest when PrintCraft is built with+//! `build.rs` embeds every font in craft-fonts' manifest when PdfCraft is built with//! `CRAFT_FONTS_DIR=<checkout>`; otherwise [`CRAFT_FONTS`] is empty and everything here returns//! nothing. Callers must work either way.@@ -75,7 +75,7 @@ const fn find(family: &str, style: &str) -> Option<&'static [u8]> {}/// Shippori Mincho Regular from craft-fonts, the preferred face for Japanese document text.-/// `None` when PrintCraft was built without craft-fonts.+/// `None` when PdfCraft was built without craft-fonts.pub static SHIPPORI_MINCHO: Option<&[u8]> = find("Shippori Mincho", "Regular");#[cfg(test)]diff --git a/crates/fonts/src/lib.rs b/crates/fonts/src/lib.rsindex a0d80d96f..2d39c1a74 100644--- a/crates/fonts/src/lib.rs+++ b/crates/fonts/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-fonts — font metrics and encodings for generated appearances (L2).+//! pdfcraft-fonts — font metrics and encodings for generated appearances (L2).//!//! See the README: the metrics are approximations by character class (no vendor metrics files//! are bundled). The full font subsystem lands in M2.2/M7.diff --git a/crates/fonts/src/pdf.rs b/crates/fonts/src/pdf.rsindex 91c326c79..42c87d189 100644--- a/crates/fonts/src/pdf.rs+++ b/crates/fonts/src/pdf.rs@@ -7,7 +7,7 @@use std::collections::HashMap;-use printcraft_cos::{Dict, Document, Object};+use pdfcraft_cos::{Dict, Document, Object};/// How the bytes of a string map to codes.#[derive(Clone, Debug, PartialEq)]@@ -491,7 +491,7 @@ fn unicode_map(doc: &Document, font: &Dict, composite: bool) -> HashMap<u32, Str#[cfg(test)]mod tests {- use printcraft_cos::{Dict, Document, Object, Stream};+ use pdfcraft_cos::{Dict, Document, Object, Stream};use super::*;diff --git a/crates/forms/Cargo.toml b/crates/forms/Cargo.tomlindex 19e52b288..3f085ee6c 100644--- a/crates/forms/Cargo.toml+++ b/crates/forms/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-forms"+name = "pdfcraft-forms"description = "Interactive forms (AcroForm): field model, filling, appearances, reset (ISO 32000-2 §12.7)"version.workspace = trueedition.workspace = true@@ -9,10 +9,10 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-fonts = { workspace = true }-printcraft-content = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-fonts = { workspace = true }+pdfcraft-content = { workspace = true }+pdfcraft-model = { workspace = true }thiserror = { workspace = true }[dev-dependencies]diff --git a/crates/forms/README.md b/crates/forms/README.mdindex e59a945a2..27459bab8 100644--- a/crates/forms/README.md+++ b/crates/forms/README.md@@ -1,7 +1,7 @@-# printcraft-forms+# pdfcraft-forms-Interactive forms (AcroForm, ISO 32000-2 §12.7). Layer L3; depends on `printcraft-cos` and-`printcraft-fonts`.+Interactive forms (AcroForm, ISO 32000-2 §12.7). Layer L3; depends on `pdfcraft-cos` and+`pdfcraft-fonts`.## API@@ -27,7 +27,7 @@ delete_field(&mut doc, "email")?;multiline wrapping, password masking, quadding, `/MK` background and border, list-box selection.The `/DA` font is used when `/DR` has it as a simple font; otherwise Helvetica (WinAnsi).- Check boxes and radio buttons switch `/V` and each widget's `/AS`. Widgets with no appearances- get PrintCraft's own (a drawn check mark or dot; no symbol font needed).+ get PdfCraft's own (a drawn check mark or dot; no symbol font needed).- Values are validated (options, `MaxLen`, single vs multi-select, NoToggleToOff, read-only) and afailed call changes nothing.- `/RV` (rich text) is removed when a value is set so it can't contradict `/V`.diff --git a/crates/forms/src/actions.rs b/crates/forms/src/actions.rsindex d43102cb0..8128b6a71 100644--- a/crates/forms/src/actions.rs+++ b/crates/forms/src/actions.rs@@ -1,7 +1,7 @@//! Field Properties ▸ Actions: what a field does on each trigger (§12.6.3, Table 197: the//! widget's `/A` for Mouse Up and its `/AA` D, E, X, Fo, Bl for the others).-use printcraft_cos::{Dict, Document, Object, PdfString};+use pdfcraft_cos::{Dict, Document, Object, PdfString};use crate::{FormError, fields};@@ -105,7 +105,7 @@ fn texts(doc: &Document, o: &Object) -> Vec<String> {}}-fn read(doc: &Document, o: &Object, pages: &[printcraft_cos::ObjRef]) -> Option<FieldAction> {+fn read(doc: &Document, o: &Object, pages: &[pdfcraft_cos::ObjRef]) -> Option<FieldAction> {let a = doc.resolve(o);let d = a.as_dict()?;Some(match d.name(b"S")? {@@ -158,7 +158,7 @@ pub fn field_actions(doc: &Document, name: &str) -> Result<Vec<(Trigger, FieldAcOk(out)}-fn write(doc: &mut Document, a: &FieldAction, pages: &[printcraft_cos::ObjRef]) -> Result<Option<Object>, FormError> {+fn write(doc: &mut Document, a: &FieldAction, pages: &[pdfcraft_cos::ObjRef]) -> Result<Option<Object>, FormError> {let mut d = Dict::new();d.set(b"Type".to_vec(), Object::name("Action"));let list = |v: &[String]| Object::Array(v.iter().map(|s| Object::String(PdfString::text(s))).collect());diff --git a/crates/forms/src/af.rs b/crates/forms/src/af.rsindex e82783b20..7eddf7694 100644--- a/crates/forms/src/af.rs+++ b/crates/forms/src/af.rs@@ -1074,7 +1074,7 @@ mod tests {// ── push buttons ────────────────────────────────────────────────────────────────────────────-/// What clicking a push button does (its mouse-up action), as far as PrintCraft can run it+/// What clicking a push button does (its mouse-up action), as far as PdfCraft can run it/// without a JavaScript engine.#[derive(Clone, Debug, PartialEq)]pub enum ButtonAction {@@ -1090,18 +1090,18 @@ pub enum ButtonAction {GoTo(usize),/// `app.alert("…")`.Alert(String),- /// Submit the form to a URL (not sent: PrintCraft never posts form data on its own).+ /// Submit the form to a URL (not sent: PdfCraft never posts form data on its own).Submit(String),/// `event.target.buttonImportIcon()`: choose an image for the button (an image field).ImportIcon,- /// A script PrintCraft can't run yet.+ /// A script PdfCraft can't run yet.Script(String),}/// Recognise the common one-line button scripts.pub fn button_script(js: &str) -> ButtonAction {let t = js.trim();- // Print takes an options object whose contents don't change what PrintCraft does.+ // Print takes an options object whose contents don't change what PdfCraft does.if t.starts_with("this.print(") || t.starts_with("print(") || t.contains(";this.print(") || t.contains("; this.print(") {return ButtonAction::Named("Print".into());}diff --git a/crates/forms/src/appearance.rs b/crates/forms/src/appearance.rsindex 97b895d88..f13f53f8c 100644--- a/crates/forms/src/appearance.rs+++ b/crates/forms/src/appearance.rs@@ -7,10 +7,10 @@//!//! The `/DA` font is used when the form's `/DR` defines it as a simple font; text is encoded in//! WinAnsi. Otherwise (composite fonts, missing resources) Helvetica is used, so text is always-//! visible. Widths use the approximate Helvetica metrics of `printcraft-fonts`.+//! visible. Widths use the approximate Helvetica metrics of `pdfcraft-fonts`.-use printcraft_cos::{Dict, Document, Object, Stream};-use printcraft_fonts::{helvetica_width, literal, win_ansi, wrap};+use pdfcraft_cos::{Dict, Document, Object, Stream};+use pdfcraft_fonts::{helvetica_width, literal, win_ansi, wrap};use crate::{Field, FieldKind, Widget, acroform, flags};diff --git a/crates/forms/src/author.rs b/crates/forms/src/author.rsindex 7fd7ab7e2..e7f4e8a08 100644--- a/crates/forms/src/author.rs+++ b/crates/forms/src/author.rs@@ -5,8 +5,8 @@//! check boxes), a thin grey border and a white background, and appearance streams generated//! immediately so every viewer shows the empty field.-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};-use printcraft_fonts::{helvetica_width, literal, win_ansi};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};+use pdfcraft_fonts::{helvetica_width, literal, win_ansi};use crate::{Field, FieldKind, FormError, Widget, appearance, fields, flags, page_refs};@@ -218,7 +218,7 @@ impl FieldFont {}/// The mark a check box or radio button shows when on (Field Properties ▸ Options ▸ style).-/// Stored as `/MK /CA`, the ZapfDingbats character Acrobat uses for it; PrintCraft draws the+/// Stored as `/MK /CA`, the ZapfDingbats character Acrobat uses for it; PdfCraft draws the/// mark as paths, so no symbol font is needed.#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum CheckStyle {diff --git a/crates/forms/src/detect.rs b/crates/forms/src/detect.rsindex a116b0541..d7a57482c 100644--- a/crates/forms/src/detect.rs+++ b/crates/forms/src/detect.rs@@ -5,8 +5,8 @@//! [`detect`] is a pure function over the page's words and drawn shapes; [`page_shapes`] reads//! the shapes from a page's content.-use printcraft_content::{Matrix, parse};-use printcraft_cos::{Document, Object};+use pdfcraft_content::{Matrix, parse};+use pdfcraft_cos::{Document, Object};/// A piece of text on the page, in user space.#[derive(Clone, Debug, PartialEq)]@@ -42,7 +42,7 @@ pub struct Candidate {/// The rectangles and horizontal segments a page draws (stroked or filled), in user space.pub fn page_shapes(doc: &Document, page: usize) -> Shapes {let mut out = Shapes::default();- let Some(p) = printcraft_model::pages(doc).into_iter().nth(page) else { return out };+ let Some(p) = pdfcraft_model::pages(doc).into_iter().nth(page) else { return out };let list: Vec<Object> = match p.dict.get(b"Contents").map(|c| doc.resolve(c)) {Some(c) => match &*c {Object::Array(a) => a.clone(),diff --git a/crates/forms/src/lib.rs b/crates/forms/src/lib.rsindex 070ab8e6e..5c3d3df33 100644--- a/crates/forms/src/lib.rs+++ b/crates/forms/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-forms — interactive forms (AcroForm, ISO 32000-2 §12.7), execution plan M6.1–M6.2.+//! pdfcraft-forms — interactive forms (AcroForm, ISO 32000-2 §12.7), execution plan M6.1–M6.2.//!//! - [`fields`]: the field tree flattened to terminal fields, each with its widgets (page,//! rectangle, on-state), inherited attributes (`/FT`, `/Ff`, `/V`, `/DV`, `/DA`, `/Q`,@@ -13,7 +13,7 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};mod actions;pub mod af;@@ -45,7 +45,7 @@ pub enum FormError {#[error("{0}")]Invalid(String),#[error("{0}")]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -801,7 +801,7 @@ fn set_states(doc: &mut Document, f: &Field, on: Option<&str>) -> Result<(), For(Some(c), Some(s)) if c == s => s,_ => "Off",};- // A widget without appearances for its states gets PrintCraft's own.+ // A widget without appearances for its states gets PdfCraft's own.let has_ap = doc.get(w.obj).as_dict().and_then(|d| d.get(b"AP").cloned()).is_some();if !has_ap {let on_name = w.on_state.clone().unwrap_or_else(|| on.unwrap_or("Yes").to_string());diff --git a/crates/forms/src/scripting.rs b/crates/forms/src/scripting.rsindex e22540e9b..9e9a36f2b 100644--- a/crates/forms/src/scripting.rs+++ b/crates/forms/src/scripting.rs@@ -6,7 +6,7 @@//! calculation order, Format when the appearance is drawn — and applies what the script asks//! for: the event's value, `rc`, and changes to other fields.-use printcraft_cos::{Document, Object, PdfString};+use pdfcraft_cos::{Document, Object, PdfString};use crate::{Field, FieldKind, FieldValue, FormError, fields, flags};@@ -218,7 +218,7 @@ pub fn set_document_script(doc: &mut Document, name: &str, js: Option<&str>) ->}}if let Some(js) = js {- let mut action = printcraft_cos::Dict::new();+ let mut action = pdfcraft_cos::Dict::new();action.set(b"S".to_vec(), Object::name("JavaScript"));action.set(b"JS".to_vec(), PdfString::text(js));let a = doc.add(Object::Dict(action));@@ -229,7 +229,7 @@ pub fn set_document_script(doc: &mut Document, name: &str, js: Option<&str>) ->_ => String::new(),});pairs = kept.into_iter().flat_map(|(k, v)| [k, v]).collect();- let mut t = printcraft_cos::Dict::new();+ let mut t = pdfcraft_cos::Dict::new();t.set(b"Names".to_vec(), Object::Array(pairs));names.set(b"JavaScript".to_vec(), Object::Dict(t));doc.update_dict(root, |c| c.set(b"Names".to_vec(), Object::Dict(names)))?;@@ -244,7 +244,7 @@ pub fn set_field_script(doc: &mut Document, name: &str, event: &str, js: Option<let all = fields(doc);let f = all.iter().find(|f| f.name == name).ok_or_else(|| FormError::NoSuchField(name.into()))?.clone();let action = |doc: &mut Document, js: &str| {- let mut a = printcraft_cos::Dict::new();+ let mut a = pdfcraft_cos::Dict::new();a.set(b"S".to_vec(), Object::name("JavaScript"));a.set(b"JS".to_vec(), PdfString::text(js));Object::Ref(doc.add(Object::Dict(a)))diff --git a/crates/forms/src/tests.rs b/crates/forms/src/tests.rsindex 7273cb089..9a88905be 100644--- a/crates/forms/src/tests.rs+++ b/crates/forms/src/tests.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use printcraft_cos::{Document, Object, SaveOptions, write_incremental};+use pdfcraft_cos::{Document, Object, SaveOptions, write_incremental};use super::*;@@ -133,7 +133,7 @@ fn check_boxes_and_radios_switch_states() {let size = field(&all, "size");assert_eq!(size.value, ["L"]);assert_eq!(size.widgets.iter().map(|w| w.state.clone().unwrap()).collect::<Vec<_>>(), ["Off", "L"]);- // The bare check box got PrintCraft's own appearances and kept its other keys.+ // The bare check box got PdfCraft's own appearances and kept its other keys.let bare = field(&all, "bare");assert_eq!(bare.value, ["Yes"]);assert_eq!(bare.widgets[0].on_state.as_deref(), Some("Yes"));@@ -208,7 +208,7 @@ fn every_field_type_can_be_added_named_and_drawn() {{// One page.let pages = doc.get(doc.root().unwrap()).as_dict().unwrap().reference(b"Pages").unwrap();- let mut p = printcraft_cos::Dict::new();+ let mut p = pdfcraft_cos::Dict::new();p.set(b"Type".to_vec(), Object::name("Page"));p.set(b"Parent".to_vec(), Object::Ref(pages));p.set(b"MediaBox".to_vec(), Object::Array(vec![0.into(), 0.into(), 600.into(), 800.into()]));@@ -312,7 +312,7 @@ fn properties_rename_and_delete() {fn deleting_works_with_a_form_dictionary_inside_the_catalog() {let mut doc = fixture();let root = doc.root().unwrap();- let af = doc.get(printcraft_cos::ObjRef::new(4, 0)).as_dict().cloned().unwrap();+ let af = doc.get(pdfcraft_cos::ObjRef::new(4, 0)).as_dict().cloned().unwrap();doc.update_dict(root, |d| d.set(b"AcroForm".to_vec(), Object::Dict(af))).unwrap();let before = fields(&doc).len();delete_field(&mut doc, "name").unwrap();@@ -324,7 +324,7 @@ fn deleting_works_with_a_form_dictionary_inside_the_catalog() {fn one_page() -> Document {let mut doc = Document::new_empty();let pages = doc.get(doc.root().unwrap()).as_dict().unwrap().reference(b"Pages").unwrap();- let mut p = printcraft_cos::Dict::new();+ let mut p = pdfcraft_cos::Dict::new();p.set(b"Type".to_vec(), Object::name("Page"));p.set(b"Parent".to_vec(), Object::Ref(pages));p.set(b"MediaBox".to_vec(), Object::Array(vec![0.into(), 0.into(), 600.into(), 800.into()]));@@ -584,7 +584,7 @@ fn ordering_tabs_manually() {}// A comment between the widgets keeps its place.let page = page_refs(&doc)[0];- let mut note = printcraft_cos::Dict::new();+ let mut note = pdfcraft_cos::Dict::new();note.set(b"Type".to_vec(), Object::name("Annot"));note.set(b"Subtype".to_vec(), Object::name("Text"));note.set(b"Rect".to_vec(), Object::Array(vec![0.into(), 0.into(), 10.into(), 10.into()]));@@ -621,7 +621,7 @@ fn duplicating_a_field_across_pages_shares_its_value() {// A second and third page.let pages = doc.get(doc.root().unwrap()).as_dict().unwrap().reference(b"Pages").unwrap();for _ in 0..2 {- let mut p = printcraft_cos::Dict::new();+ let mut p = pdfcraft_cos::Dict::new();p.set(b"Type".to_vec(), Object::name("Page"));p.set(b"Parent".to_vec(), Object::Ref(pages));p.set(b"MediaBox".to_vec(), Object::Array(vec![0.into(), 0.into(), 600.into(), 800.into()]));@@ -675,7 +675,7 @@ fn image_fields_ask_for_a_picture_and_show_it() {{d.set(k.to_vec(), v);}- let img = doc.add(Object::Stream(printcraft_cos::Stream::from_raw(d, vec![0; 24])));+ let img = doc.add(Object::Stream(pdfcraft_cos::Stream::from_raw(d, vec![0; 24])));set_button_icon(&mut doc, &name, img, (4, 2)).unwrap();let w = doc.get(f.widgets[0].obj).as_dict().cloned().unwrap();let mk = w.get(b"MK").unwrap().as_dict().unwrap().clone();@@ -742,12 +742,12 @@ fn detection_finds_blanks_rules_boxes_and_names_them() {#[test]fn page_shapes_reads_boxes_and_rules() {let mut doc = fixture();- let page = printcraft_model::pages(&doc)[0].obj;- let s = doc.add(printcraft_cos::Object::Stream(printcraft_cos::Stream::flate(+ let page = pdfcraft_model::pages(&doc)[0].obj;+ let s = doc.add(pdfcraft_cos::Object::Stream(pdfcraft_cos::Stream::flate(Default::default(),b"q 2 0 0 2 0 0 cm 10 10 6 6 re S 20 50 m 120 50 l S 0 0 m 5 5 l S 30 300 100 0.5 re f Q",)));- doc.update_dict(page, |d| d.set(b"Contents".to_vec(), printcraft_cos::Object::Ref(s))).unwrap();+ doc.update_dict(page, |d| d.set(b"Contents".to_vec(), pdfcraft_cos::Object::Ref(s))).unwrap();let sh = crate::detect::page_shapes(&doc, 0);assert_eq!(sh.boxes, [[20.0, 20.0, 32.0, 32.0]]);assert_eq!(sh.rules, [[40.0, 100.0, 240.0, 100.0], [60.0, 600.5, 260.0, 600.5]]);diff --git a/crates/geom/Cargo.toml b/crates/geom/Cargo.tomlindex 25ca71dd6..cf79a46e9 100644--- a/crates/geom/Cargo.toml+++ b/crates/geom/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft-geom"-description = "Geometry primitives for PrintCraft (points, rects, page transforms)"+name = "pdfcraft-geom"+description = "Geometry primitives for PdfCraft (points, rects, page transforms)"version.workspace = trueedition.workspace = truelicense.workspace = truediff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rsindex eaa109c6b..b04e47cbf 100644--- a/crates/geom/src/lib.rs+++ b/crates/geom/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-geom — L0 geometry primitives shared by every PrintCraft crate.+//! pdfcraft-geom — L0 geometry primitives shared by every PdfCraft crate.//!//! PDF user space is y-up with the origin at the bottom-left of the page; view space is y-down.//! `PageRect` is always in PDF user space (points, 1/72 inch).diff --git a/crates/js/Cargo.toml b/crates/js/Cargo.tomlindex b62d66476..ee09b8a8e 100644--- a/crates/js/Cargo.toml+++ b/crates/js/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-js"+name = "pdfcraft-js"description = "Acrobat JavaScript: a sandboxed interpreter (boa) with the form object model subset (event, getField, app, util, console)"version.workspace = trueedition.workspace = truediff --git a/crates/js/src/lib.rs b/crates/js/src/lib.rsindex 647f80f1a..574b7888d 100644--- a/crates/js/src/lib.rs+++ b/crates/js/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-js — Acrobat JavaScript for forms (L3).+//! pdfcraft-js — Acrobat JavaScript for forms (L3).//!//! Field scripts (format, keystroke, validate, calculate), button actions and document-level//! scripts run in [boa](https://boajs.dev), a JavaScript engine written in Rust, with the subset@@ -152,7 +152,7 @@ pub enum Request {/// `this.pageNum = n` (0-based).GoToPage(usize),LaunchUrl(String),- /// `this.submitForm(url)`: never sent on PrintCraft's own.+ /// `this.submitForm(url)`: never sent on PdfCraft's own.Submit(String),/// `field.setFocus()`.Focus(String),@@ -1080,7 +1080,7 @@ pub fn run(script: &str, event: &Event, doc: &DocInfo, fields: &[FieldState], do{std::thread::scope(|scope| {let spawned = std::thread::Builder::new()- .name("printcraft-js".into())+ .name("pdfcraft-js".into()).stack_size(SCRIPT_STACK).spawn_scoped(scope, || run_here(script, event, doc, fields, doc_scripts, limits));match spawned {diff --git a/crates/model/Cargo.toml b/crates/model/Cargo.tomlindex 271ddeb84..32942cacc 100644--- a/crates/model/Cargo.toml+++ b/crates/model/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-model"+name = "pdfcraft-model"description = "Typed views over the PDF object graph (page tree with inherited attributes, page geometry)"version.workspace = trueedition.workspace = true@@ -9,4 +9,4 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }+pdfcraft-cos = { workspace = true }diff --git a/crates/model/README.md b/crates/model/README.mdindex c354a818b..90d6cebad 100644--- a/crates/model/README.md+++ b/crates/model/README.md@@ -1,6 +1,6 @@-# printcraft-model+# pdfcraft-model-Layer L2: typed views over the `printcraft-cos` object graph. It starts small, with what several+Layer L2: typed views over the `pdfcraft-cos` object graph. It starts small, with what severalL3/L4 crates need:- `pages(doc)`: leaf pages in order, each with its inherited attributes (`Resources`,diff --git a/crates/model/src/lib.rs b/crates/model/src/lib.rsindex 9d2c9febc..6e558dea5 100644--- a/crates/model/src/lib.rs+++ b/crates/model/src/lib.rs@@ -1,8 +1,8 @@-//! printcraft-model — typed views over the PDF object graph (L2). See the README.+//! pdfcraft-model — typed views over the PDF object graph (L2). See the README.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_cos::{Dict, Document, ObjRef, Object};/// Attributes a page inherits from its ancestors (ISO 32000-2 §7.7.3.4).pub const INHERITABLE: [&[u8]; 4] = [b"Resources", b"MediaBox", b"CropBox", b"Rotate"];diff --git a/crates/ocr/Cargo.toml b/crates/ocr/Cargo.tomlindex 436d3100b..46bb3a1e0 100644--- a/crates/ocr/Cargo.toml+++ b/crates/ocr/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-ocr"+name = "pdfcraft-ocr"description = "Scan & OCR: recognise text in page images (ocrs) and write it as an invisible, searchable text layer"version.workspace = trueedition.workspace = true@@ -11,7 +11,7 @@ repository.workspace = trueworkspace = true[dependencies]-printcraft-fonts = { workspace = true }+pdfcraft-fonts = { workspace = true }ocrs = { version = "0.13.1", default-features = false, features = ["rten"] }rten = { version = "0.26.0", default-features = false, features = ["rten_format"] }thiserror.workspace = truediff --git a/crates/ocr/src/lib.rs b/crates/ocr/src/lib.rsindex 026dda978..f026f5bde 100644--- a/crates/ocr/src/lib.rs+++ b/crates/ocr/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-ocr — Scan & OCR ▸ Recognize text (L4).+//! pdfcraft-ocr — Scan & OCR ▸ Recognize text (L4).//!//! Recognition runs the ocrs engine (MIT/Apache-2.0) with its pre-trained models (CC-BY-SA-4.0,//! fetched by `cargo xtask models`; see ATTRIBUTION.toml). The caller renders a page to pixels;@@ -12,7 +12,7 @@use std::path::{Path, PathBuf};-pub use printcraft_fonts::helvetica_width;+pub use pdfcraft_fonts::helvetica_width;/// The model files, as named in ATTRIBUTION.toml.pub const DETECTION_MODEL: &str = "text-detection.rten";@@ -23,7 +23,7 @@ pub const LANGUAGES: &[(&str, &str)] = &[("en", "English")];#[derive(Debug, thiserror::Error)]pub enum OcrError {- #[error("the text recognition models are not installed (run `cargo xtask models`, or set PRINTCRAFT_MODELS)")]+ #[error("the text recognition models are not installed (run `cargo xtask models`, or set PDFCRAFT_MODELS)")]NoModels,#[error("loading {0}: {1}")]Load(String, String),@@ -47,7 +47,7 @@ impl Models {(m.detection.is_file() && m.recognition.is_file()).then_some(m)}- /// Look for the models: `$PRINTCRAFT_MODELS`, then `models/` beside the executable (and+ /// Look for the models: `$PDFCRAFT_MODELS`, then `models/` beside the executable (and/// `Resources/models` in a macOS bundle), then the source tree's `assets/models/`.pub fn find() -> Option<Models> {Self::search_dirs().iter().find_map(|d| Self::in_dir(d))@@ -56,7 +56,7 @@ impl Models {/// The directories [`Models::find`] looks in, in order.pub fn search_dirs() -> Vec<PathBuf> {let mut dirs = Vec::new();- if let Some(d) = std::env::var_os("PRINTCRAFT_MODELS") {+ if let Some(d) = std::env::var_os("PDFCRAFT_MODELS") {dirs.push(PathBuf::from(d));}if let Some(exe) = std::env::current_exe().ok().and_then(|e| e.parent().map(Path::to_path_buf)) {@@ -196,7 +196,7 @@ pub fn text_layer(words: &[PlacedWord]) -> Vec<u8> {let nums: Vec<String> = m.iter().map(|v| num(*v)).collect();out.extend_from_slice(nums.join(" ").as_bytes());out.extend_from_slice(b" Tm ");- out.extend(printcraft_fonts::literal(&printcraft_fonts::win_ansi(&w.text)));+ out.extend(pdfcraft_fonts::literal(&pdfcraft_fonts::win_ansi(&w.text)));out.extend_from_slice(b" Tj\n");}out.extend_from_slice(b"ET\nEMC\n");diff --git a/crates/optimize/Cargo.toml b/crates/optimize/Cargo.tomlindex 82a12690f..184ee9697 100644--- a/crates/optimize/Cargo.toml+++ b/crates/optimize/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-optimize"+name = "pdfcraft-optimize"description = "The PDF Optimizer: image downsampling and recompression, discarding objects, clean-up"version.workspace = trueedition.workspace = true@@ -11,13 +11,13 @@ repository.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-content = { workspace = true }-printcraft-model = { workspace = true }-printcraft-annot = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-content = { workspace = true }+pdfcraft-model = { workspace = true }+pdfcraft-annot = { workspace = true }thiserror.workspace = true# JPEG decoding (zune-jpeg) and encoding, and bicubic resampling; already in the tree.image = { version = "0.25", default-features = false, features = ["jpeg"] }[dev-dependencies]-printcraft-render = { workspace = true }+pdfcraft-render = { workspace = true }diff --git a/crates/optimize/README.md b/crates/optimize/README.mdindex 5d984d901..6b1adb38d 100644--- a/crates/optimize/README.md+++ b/crates/optimize/README.md@@ -1,4 +1,4 @@-# printcraft-optimize+# pdfcraft-optimizeLayer L4: the PDF Optimizer (execution plan M11.1; Acrobat's Reduce File Size and Optimize PDF ▸Advanced optimization).@@ -16,6 +16,6 @@ let report = optimize(&mut doc, &Settings::default())?; // Reduce File Size's- **Discard objects:** thumbnails, alternate images, document tags, print settings.- **Clean up:** Flate for streams with no filter.-The engine runs Remove Hidden Information (`printcraft-redact`) for the user-data categories,+The engine runs Remove Hidden Information (`pdfcraft-redact`) for the user-data categories,then this, then merges identical objects and writes a full, compressed save. JPEG decoding andencoding and resampling come from the `image` crate.diff --git a/crates/optimize/src/audit.rs b/crates/optimize/src/audit.rsindex 077097737..351d883b4 100644--- a/crates/optimize/src/audit.rs+++ b/crates/optimize/src/audit.rs@@ -6,7 +6,7 @@use std::collections::{HashMap, HashSet};-use printcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_cos::{Dict, Document, ObjRef, Object};/// The categories, in Acrobat's order.#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]@@ -153,7 +153,7 @@ impl Audit<'_> {fn size(doc: &Document, num: u32) -> u64 {let obj = doc.get(ObjRef::new(num, doc.generation(num)));let mut out = Vec::new();- printcraft_cos::serialize(&obj, &mut out);+ pdfcraft_cos::serialize(&obj, &mut out);// "n g obj\n … \nendobj\n" and its cross-reference entry.out.len() as u64 + 20 + 20}@@ -163,7 +163,7 @@ fn size(doc: &Document, num: u32) -> u64 {pub fn audit_space(doc: &Document, file_len: u64) -> Vec<SpaceUse> {let mut a = Audit { doc, owner: HashMap::new() };let cat = doc.root().and_then(|r| doc.get(r).as_dict().cloned()).unwrap_or_default();- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);// Order matters: the most specific owners first.if let Some(s) = cat.get(b"StructTreeRoot") {// Structure elements point at pages and annotations; those stay out (claim skips pages,@@ -189,7 +189,7 @@ pub fn audit_space(doc: &Document, file_len: u64) -> Vec<SpaceUse> {}}// Resources before the content: a content stream's dictionary may point at what it- // draws (PrintCraft's /PCAdded records an added image), which stays an image or font.+ // draws (PdfCraft's /PCAdded records an added image), which stays an image or font.let res = a.resolve_dict(p.dict.get(b"Resources"));a.resources(&res);if let Some(c) = p.dict.get(b"Contents") {diff --git a/crates/optimize/src/images.rs b/crates/optimize/src/images.rsindex 1b2241246..f023a854d 100644--- a/crates/optimize/src/images.rs+++ b/crates/optimize/src/images.rs@@ -2,8 +2,8 @@use std::collections::{HashMap, HashSet};-use printcraft_content::Matrix;-use printcraft_cos::{Dict, Document, ObjRef, Object, Stream};+use pdfcraft_content::Matrix;+use pdfcraft_cos::{Dict, Document, ObjRef, Object, Stream};use crate::{Compression, ImageSettings, OptimizeError, Report, Settings};@@ -49,7 +49,7 @@ fn walk(doc: &Document, data: &[u8], resources: &Dict, ctm: Matrix, depth: usize}let xobjects = resources.get(b"XObject").map(|x| doc.resolve(x)).and_then(|x| x.as_dict().cloned()).unwrap_or_default();let mut stack = vec![ctm];- for op in printcraft_content::parse(data).ops {+ for op in pdfcraft_content::parse(data).ops {let top = stack.last().copied().unwrap_or(ctm);match op.op.as_slice() {b"q" => stack.push(top),@@ -112,7 +112,7 @@ pub fn effective_resolutions(doc: &Document, pages: &[ObjRef]) -> HashMap<ObjRefout}-/// Colour components of a colour space PrintCraft resamples: gray (1) or RGB (3).+/// Colour components of a colour space PdfCraft resamples: gray (1) or RGB (3).fn components(doc: &Document, cs: &Object) -> Option<usize> {let cs = doc.resolve(cs);match &*cs {diff --git a/crates/optimize/src/lib.rs b/crates/optimize/src/lib.rsindex 3b0607caa..89b90a0a1 100644--- a/crates/optimize/src/lib.rs+++ b/crates/optimize/src/lib.rs@@ -4,7 +4,7 @@//! - **Images:** each image's effective resolution is measured where pages draw it (the//! smallest over its uses, through form XObjects); colour and grayscale images above a//! threshold are resampled (bicubic) to a target resolution and recompressed as JPEG or Flate.-//! A new image replaces the old one only if it is smaller. Images PrintCraft can't decode+//! A new image replaces the old one only if it is smaller. Images PdfCraft can't decode//! faithfully (CMYK and other colour spaces, masks, decode arrays, JPEG 2000, JBIG2, CCITT,//! more than 8 bits) are left alone.//! - **Discard objects:** page thumbnails, alternate images, document tags (structure tree),@@ -12,7 +12,7 @@//! - **Clean up:** Flate-compress streams that have no filter.//!//! Metadata, attachments, comments, scripts, private data, hidden layers, bookmarks and form-//! fields are discarded by `printcraft-redact`'s Remove Hidden Information, which the engine+//! fields are discarded by `pdfcraft-redact`'s Remove Hidden Information, which the engine//! runs alongside.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]@@ -23,7 +23,7 @@ mod links;pub use audit::{SpaceCategory, SpaceUse, audit_space};-use printcraft_cos::{Document, ObjRef, Object, Stream};+use pdfcraft_cos::{Document, ObjRef, Object, Stream};pub use images::effective_resolutions;@@ -32,7 +32,7 @@ pub enum OptimizeError {#[error("the document has no page tree")]NoPages,#[error(transparent)]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}/// How resampled (or recompressed) images are stored.@@ -119,7 +119,7 @@ pub struct Report {/// Optimize `doc` in place.pub fn optimize(doc: &mut Document, settings: &Settings) -> Result<Report, OptimizeError> {let mut report = Report::default();- let pages = printcraft_annot::page_refs(doc).map_err(|_| OptimizeError::NoPages)?;+ let pages = pdfcraft_annot::page_refs(doc).map_err(|_| OptimizeError::NoPages)?;images::run(doc, &pages, settings, &mut report)?;if settings.discard_thumbnails {for p in &pages {@@ -168,7 +168,7 @@ pub fn optimize(doc: &mut Document, settings: &Settings) -> Result<Report, Optim{const PRINT: [&[u8]; 7] = [b"PrintScaling", b"Duplex", b"PickTrayByPDFSize", b"PrintPageRange", b"NumCopies", b"PrintArea", b"PrintClip"];let vp = doc.get(root).as_dict().and_then(|c| c.get(b"ViewerPreferences").cloned());- let edit = |d: &mut printcraft_cos::Dict| PRINT.iter().filter(|k| d.remove(k).is_some()).count();+ let edit = |d: &mut pdfcraft_cos::Dict| PRINT.iter().filter(|k| d.remove(k).is_some()).count();match vp {Some(Object::Ref(r)) => {let mut n = 0;diff --git a/crates/optimize/src/links.rs b/crates/optimize/src/links.rsindex b294cfe2d..744881df7 100644--- a/crates/optimize/src/links.rs+++ b/crates/optimize/src/links.rs@@ -3,7 +3,7 @@use std::collections::{HashSet, VecDeque};-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};/// Named destinations: the `/Names /Dests` tree (entries) and the old `/Dests` dictionary.fn named_dests(doc: &Document) -> HashSet<Vec<u8>> {@@ -87,7 +87,7 @@ fn valid(o: &Object, pages: &HashSet<ObjRef>, count: usize, names: &HashSet<Vec</// Remove links whose destination is missing, and clear the destination of such bookmarks/// (they stay, so their children do too). Returns (links, bookmarks).-pub(crate) fn remove_invalid(doc: &mut Document, pages: &[ObjRef]) -> Result<(usize, usize), printcraft_cos::CosError> {+pub(crate) fn remove_invalid(doc: &mut Document, pages: &[ObjRef]) -> Result<(usize, usize), pdfcraft_cos::CosError> {let set: HashSet<ObjRef> = pages.iter().copied().collect();let names = named_dests(doc);let mut links = 0;@@ -176,7 +176,7 @@ fn referenced_names(doc: &Document) -> HashSet<Vec<u8>> {}/// Remove named destinations nothing refers to. Returns how many went.-pub(crate) fn remove_unreferenced_dests(doc: &mut Document) -> Result<usize, printcraft_cos::CosError> {+pub(crate) fn remove_unreferenced_dests(doc: &mut Document) -> Result<usize, pdfcraft_cos::CosError> {let Some(root) = doc.root() else { return Ok(0) };let cat = doc.get(root).as_dict().cloned().unwrap_or_default();let used = referenced_names(doc);diff --git a/crates/optimize/tests/optimize.rs b/crates/optimize/tests/optimize.rsindex 3fcb593ed..1b9b969a7 100644--- a/crates/optimize/tests/optimize.rs+++ b/crates/optimize/tests/optimize.rs@@ -2,8 +2,8 @@use std::sync::Arc;-use printcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, Stream, write_full};-use printcraft_optimize::{Compression, ImageSettings, Settings, SpaceCategory, audit_space, effective_resolutions, optimize};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, Stream, write_full};+use pdfcraft_optimize::{Compression, ImageSettings, Settings, SpaceCategory, audit_space, effective_resolutions, optimize};fn image(doc: &mut Document, w: u32, h: u32, n: usize, jpeg: bool, smask: Option<ObjRef>) -> ObjRef {// A smooth gradient with a little texture (photo-like).@@ -94,7 +94,7 @@ fn images_are_measured_where_drawn_and_downsampled() {&[("A", masked), ("B", photo), ("C", twice)],"q 72 0 0 72 36 36 cm /A Do Q q 1 0 0 1 100 100 cm 600 0 0 400 0 0 cm /B Do Q q 72 0 0 72 0 0 cm /C Do Q q 288 0 0 288 300 300 cm /C Do Q",);- let pages = printcraft_annot::page_refs(&doc).unwrap();+ let pages = pdfcraft_annot::page_refs(&doc).unwrap();let ppi = effective_resolutions(&doc, &pages);assert_eq!(ppi[&big].round(), 600.0);assert_eq!(ppi[&small].round(), 50.0);@@ -122,9 +122,9 @@ fn images_are_measured_where_drawn_and_downsampled() {// The optimized file opens, and the page still shows the picture where it was.let reopened = Document::open(Arc::new(after_bytes.clone())).unwrap();- assert_eq!(printcraft_annot::page_refs(&reopened).unwrap().len(), 2);- let mut r = printcraft_render::PageRenderer::new(Arc::new(after_bytes), printcraft_render::RenderConfig::default());- let out = r.render(printcraft_render::RenderRequest { page: 0, scale: 1.0, ..Default::default() });+ assert_eq!(pdfcraft_annot::page_refs(&reopened).unwrap().len(), 2);+ let mut r = pdfcraft_render::PageRenderer::new(Arc::new(after_bytes), pdfcraft_render::RenderConfig::default());+ let out = r.render(pdfcraft_render::RenderRequest { page: 0, scale: 1.0, ..Default::default() });assert!(out.error.is_none(), "{:?}", out.error);// Top-left image area (36..180 x 600..744 user → y from the top 48..192): drawn, not white.let i = ((100 * out.width + 100) * 4) as usize;@@ -224,7 +224,7 @@ fn invalid_links_and_unreferenced_destinations_go() {d.set(b"Dest".to_vec(), dest);Object::Ref(doc.add(Object::Dict(d)))};- let s = |t: &str| Object::String(printcraft_cos::PdfString::literal(t.as_bytes().to_vec()));+ let s = |t: &str| Object::String(pdfcraft_cos::PdfString::literal(t.as_bytes().to_vec()));let annots = vec![link(&mut doc, Object::Array(vec![Object::Ref(p), Object::name("Fit")])),link(&mut doc, Object::Array(vec![Object::Ref(ObjRef::new(999, 0)), Object::name("Fit")])),diff --git a/crates/organize/Cargo.toml b/crates/organize/Cargo.tomlindex 46fb417e9..c047afc35 100644--- a/crates/organize/Cargo.toml+++ b/crates/organize/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-organize"+name = "pdfcraft-organize"description = "Page and document-structure edits: rotate, delete, move, insert pages; document info"version.workspace = trueedition.workspace = true@@ -9,7 +9,7 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }+pdfcraft-cos = { workspace = true }thiserror = { workspace = true }[dev-dependencies]diff --git a/crates/organize/src/boxes.rs b/crates/organize/src/boxes.rsindex 3e199605e..c9ccb0f15 100644--- a/crates/organize/src/boxes.rs+++ b/crates/organize/src/boxes.rs@@ -4,7 +4,7 @@//! → crop) and are clipped to the media box. Margins are measured inward from the media box in//! default user space (unrotated), as Acrobat's dialog does.-use printcraft_cos::{Document, Object};+use pdfcraft_cos::{Document, Object};use crate::{OrganizeError, check, walk};diff --git a/crates/organize/src/dedupe.rs b/crates/organize/src/dedupe.rsindex 96a327168..ba1f39eb2 100644--- a/crates/organize/src/dedupe.rs+++ b/crates/organize/src/dedupe.rs@@ -20,7 +20,7 @@use std::collections::{HashMap, HashSet};use std::hash::{Hash, Hasher};-use printcraft_cos::{Document, ObjRef, Object};+use pdfcraft_cos::{Document, ObjRef, Object};const RESOURCE_TYPES: &[&[u8]] = &[b"Font", b"FontDescriptor", b"ExtGState", b"Pattern", b"Encoding", b"CMap", b"Halftone"];const COLOR_SPACE_FAMILIES: &[&[u8]] = &[b"ICCBased", b"Indexed", b"Separation", b"DeviceN", b"CalRGB", b"CalGray", b"Lab", b"Pattern"];@@ -240,7 +240,7 @@ pub fn dedupe_resources(doc: &mut Document, candidates: &[ObjRef], index_existin#[cfg(test)]mod tests {use super::*;- use printcraft_cos::{Dict, Stream};+ use pdfcraft_cos::{Dict, Stream};use std::sync::Arc;fn stream(data: &[u8]) -> Object {diff --git a/crates/organize/src/import.rs b/crates/organize/src/import.rsindex b5fe841d6..ddd4fa236 100644--- a/crates/organize/src/import.rs+++ b/crates/organize/src/import.rs@@ -19,7 +19,7 @@use std::collections::HashMap;-use printcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_cos::{Dict, Document, ObjRef, Object};use crate::{INHERITABLE, OrganizeError, pages_root, rebuild, walk};@@ -534,7 +534,7 @@ fn set_attachments(dst: &mut Document, mut entries: Vec<(Vec<u8>, Object)>) -> Rentries.sort_by(|a, b| a.0.cmp(&b.0));let mut names = Vec::new();for (k, v) in entries {- names.push(Object::String(printcraft_cos::PdfString::literal(k)));+ names.push(Object::String(pdfcraft_cos::PdfString::literal(k)));names.push(v);}let mut tree = Dict::new();@@ -565,7 +565,7 @@ fn add_outline(doc: &mut Document, marks: &[Mark<'_>]) -> Result<(), OrganizeErrlet (Some(&first_item), Some(&last_item)) = (items.first(), items.last()) else { return Ok(()) };for (i, ((title, page, src, page_map), r)) in marks.iter().zip(&items).enumerate() {let mut d = Dict::new();- d.set(b"Title".to_vec(), Object::String(printcraft_cos::PdfString::text(title)));+ d.set(b"Title".to_vec(), Object::String(pdfcraft_cos::PdfString::text(title)));d.set(b"Parent".to_vec(), Object::Ref(outlines));d.set(b"Dest".to_vec(), Object::Array(vec![Object::Ref(*page), Object::name("Fit")]));if i > 0 {@@ -668,7 +668,7 @@ fn copy_outline_level(/// and its `/Matrix` undoes the page rotation, so it draws upright as displayed. Returns the/// form and its displayed size in points.pub fn page_as_form(dst: &mut Document, src: &Document, page: usize) -> Result<(ObjRef, (f64, f64)), OrganizeError> {- use printcraft_cos::Stream;+ use pdfcraft_cos::Stream;let all = walk(src)?;// `walk` gives the inheritable attributes (resources, boxes, rotation); the content is// the page's own.diff --git a/crates/organize/src/labels.rs b/crates/organize/src/labels.rsindex 8f406c0bd..e25a408c7 100644--- a/crates/organize/src/labels.rs+++ b/crates/organize/src/labels.rs@@ -5,7 +5,7 @@//! `from..=to`, and keep every later page showing the label it had before. The tree is written//! back as one flat `/Nums` array, with ranges that merely continue the previous one merged.-use printcraft_cos::{Dict, Document, Object, PdfString};+use pdfcraft_cos::{Dict, Document, Object, PdfString};use crate::{OrganizeError, page_count, pages_root};diff --git a/crates/organize/src/lib.rs b/crates/organize/src/lib.rsindex 6d34d7977..f6786509e 100644--- a/crates/organize/src/lib.rs+++ b/crates/organize/src/lib.rs@@ -1,6 +1,6 @@-//! printcraft-organize — page and document-structure edits (L4).+//! pdfcraft-organize — page and document-structure edits (L4).//!-//! Every operation mutates a `printcraft_cos::Document` (copy-on-write), so callers snapshot the+//! Every operation mutates a `pdfcraft_cos::Document` (copy-on-write), so callers snapshot the//! document before an edit for undo. Operations never drop data they do not understand.//!//! Page-tree strategy: before restructuring, inheritable page attributes (`Resources`,@@ -11,7 +11,7 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};mod boxes;mod dedupe;@@ -42,7 +42,7 @@ pub enum OrganizeError {#[error("{0}")]Invalid(String),#[error("{0}")]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}const INHERITABLE: [&[u8]; 4] = [b"Resources", b"MediaBox", b"CropBox", b"Rotate"];diff --git a/crates/organize/src/outline.rs b/crates/organize/src/outline.rsindex 50a4d2d49..ac1ffff31 100644--- a/crates/organize/src/outline.rs+++ b/crates/organize/src/outline.rs@@ -11,7 +11,7 @@use std::collections::HashSet;-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};use crate::{OrganizeError, walk};@@ -39,7 +39,7 @@ pub enum OutlineError {#[error("{0}")]Organize(#[from] OrganizeError),#[error("{0}")]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}type Result<T> = std::result::Result<T, OutlineError>;diff --git a/crates/organize/src/tests.rs b/crates/organize/src/tests.rsindex 5d105a77f..f8c30ca42 100644--- a/crates/organize/src/tests.rs+++ b/crates/organize/src/tests.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use printcraft_cos::{Document, Object, SaveOptions, write_full, write_incremental};+use pdfcraft_cos::{Document, Object, SaveOptions, write_full, write_incremental};use super::*;@@ -181,11 +181,11 @@ fn inserts_blank_page() {fn document_info_edits_round_trip_with_unicode() {let mut doc = open(fixture());set_info(&mut doc, "Title", "Résumé — 履歴書").unwrap();- set_info(&mut doc, "Author", "PrintCraft").unwrap();+ set_info(&mut doc, "Author", "PdfCraft").unwrap();set_info(&mut doc, "Producer", "").unwrap(); // clearing removes the keylet doc = save_and_reopen(&doc);assert_eq!(info(&doc, "Title").as_deref(), Some("Résumé — 履歴書"));- assert_eq!(info(&doc, "Author").as_deref(), Some("PrintCraft"));+ assert_eq!(info(&doc, "Author").as_deref(), Some("PdfCraft"));assert_eq!(info(&doc, "Producer"), None);}@@ -705,9 +705,9 @@ fn initial_view_round_trips_and_keeps_scripts() {// A script opening action survives a change that needs no destination.let mut doc = doc;let root = doc.root().unwrap();- let mut js = printcraft_cos::Dict::new();+ let mut js = pdfcraft_cos::Dict::new();js.set(b"S".to_vec(), Object::name("JavaScript"));- js.set(b"JS".to_vec(), printcraft_cos::PdfString::text("app.alert('hi')"));+ js.set(b"JS".to_vec(), pdfcraft_cos::PdfString::text("app.alert('hi')"));doc.update_dict(root, |c| c.set(b"OpenAction".to_vec(), Object::Dict(js))).unwrap();crate::set_initial_view(&mut doc, &crate::InitialView { layout: Layout::SinglePage, ..Default::default() }).unwrap();assert!(doc.get(root).as_dict().unwrap().get(b"OpenAction").and_then(|o| o.as_dict()).is_some_and(|d| d.name(b"S") == Some(b"JavaScript")));diff --git a/crates/organize/src/view.rs b/crates/organize/src/view.rsindex 0f9516980..efca2ce4d 100644--- a/crates/organize/src/view.rs+++ b/crates/organize/src/view.rs@@ -2,7 +2,7 @@//! panel, page layout, magnification, page; window and interface options) and its language and//! binding (ISO 32000-2 §7.7.2 Table 29, §12.2 viewer preferences).-use printcraft_cos::{Dict, Document, Object, PdfString};+use pdfcraft_cos::{Dict, Document, Object, PdfString};use crate::OrganizeError;@@ -65,7 +65,7 @@ pub struct InitialView {pub right_to_left: bool,}-fn catalog(doc: &Document) -> Result<(printcraft_cos::ObjRef, Dict), OrganizeError> {+fn catalog(doc: &Document) -> Result<(pdfcraft_cos::ObjRef, Dict), OrganizeError> {let r = doc.root().ok_or(OrganizeError::NoPageTree)?;Ok((r, doc.get(r).as_dict().cloned().ok_or(OrganizeError::NoPageTree)?))}diff --git a/crates/preflight/Cargo.toml b/crates/preflight/Cargo.tomlindex 26adc2ddb..b0eef0054 100644--- a/crates/preflight/Cargo.toml+++ b/crates/preflight/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-preflight"+name = "pdfcraft-preflight"description = "Standards: verify PDF/A (ISO 19005) conformance and convert documents to PDF/A-2b or 3b"version.workspace = trueedition.workspace = true@@ -11,5 +11,5 @@ repository.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-model = { workspace = true }diff --git a/crates/preflight/src/icc.rs b/crates/preflight/src/icc.rsindex dcd3bf681..935dd105c 100644--- a/crates/preflight/src/icc.rs+++ b/crates/preflight/src/icc.rs@@ -48,7 +48,7 @@ fn curve() -> Vec<u8> {pub fn srgb() -> Vec<u8> {// sRGB primaries, Bradford-adapted to the D50 profile connection space.let tags: Vec<(&[u8; 4], Vec<u8>)> = vec![- (b"desc", desc("sRGB (PrintCraft)")),+ (b"desc", desc("sRGB (PdfCraft)")),(b"cprt", text("No copyright, use freely")),(b"wtpt", xyz(0.9642, 1.0, 0.8249)),(b"rXYZ", xyz(0.4361, 0.2225, 0.0139)),diff --git a/crates/preflight/src/lib.rs b/crates/preflight/src/lib.rsindex beb78dc35..eb6bedd52 100644--- a/crates/preflight/src/lib.rs+++ b/crates/preflight/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-preflight — Standards: PDF/A (L4).+//! pdfcraft-preflight — Standards: PDF/A (L4).//!//! [`verify`] checks a document against the parts of ISO 19005-2/-3 (PDF/A-2b, PDF/A-3b) that can//! be decided from the object graph:@@ -24,7 +24,7 @@pub mod icc;mod xmp;-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString, Stream};/// The PDF/A part and conformance level.#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -226,7 +226,7 @@ pub fn verify(doc: &Document, level: Level) -> Vec<Issue> {issue("6.4.1", "The form asks viewers to make appearances (NeedAppearances)".into(), None, true);}// Pages: annotations and page actions.- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);let page_of = |r: ObjRef| {pages.iter().position(|p| {p.dict@@ -398,13 +398,13 @@ fn strip_actions(doc: &Document, d: &mut Dict) -> bool {}/// Make `doc` conform to `level` as far as possible, then re-check it.-pub fn convert(doc: &mut Document, level: Level) -> Result<Report, printcraft_cos::CosError> {+pub fn convert(doc: &mut Document, level: Level) -> Result<Report, pdfcraft_cos::CosError> {let mut fixed = Vec::new();if doc.trailer().get(b"Encrypt").is_some() {doc.remove_encryption();fixed.push("Removed encryption".into());}- let root = doc.root().ok_or(printcraft_cos::CosError::Syntax { offset: 0, detail: "no catalog".into() })?;+ let root = doc.root().ok_or(pdfcraft_cos::CosError::Syntax { offset: 0, detail: "no catalog".into() })?;// Catalog: actions, JavaScript, NeedAppearances, output intent, metadata.let mut cat = catalog(doc);if cat.remove(b"AA").is_some() {@@ -462,7 +462,7 @@ pub fn convert(doc: &mut Document, level: Level) -> Result<Report, printcraft_co// Pages, annotations, fields, images, embedded files.let (mut actions, mut flags, mut images, mut removed, mut files) = (0, 0, 0, 0, 0);- for p in printcraft_model::pages(doc) {+ for p in pdfcraft_model::pages(doc) {let mut changed = false;doc.update_dict(p.obj, |d| changed = d.remove(b"AA").is_some())?;actions += changed as usize;@@ -474,7 +474,7 @@ pub fn convert(doc: &mut Document, level: Level) -> Result<Report, printcraft_colet is_annot = ty.as_deref() == Some(b"Annot");if is_annot && sub.as_deref().is_some_and(|s| FORBIDDEN_ANNOTS.contains(&s)) {// Take it off its page.- for p in printcraft_model::pages(doc) {+ for p in pdfcraft_model::pages(doc) {let annots = p.dict.get(b"Annots").map(|a| doc.resolve(a)).and_then(|a| a.as_array().cloned()).unwrap_or_default();if annots.iter().any(|a| a.as_ref() == Some(r)) {let kept: Vec<Object> = annots.into_iter().filter(|a| a.as_ref() != Some(r)).collect();diff --git a/crates/preflight/src/tests.rs b/crates/preflight/src/tests.rsindex aee23f438..6613e6fc5 100644--- a/crates/preflight/src/tests.rs+++ b/crates/preflight/src/tests.rs@@ -77,7 +77,7 @@ fn convert_fixes_all_but_fonts() {assert_eq!(xmp::value(&x, "dc:title").as_deref(), Some("Report"));assert_eq!(xmp::value(&x, "xmp:CreateDate").as_deref(), Some("2024-01-05T09:30:00Z"));// It survives a save.- let bytes = printcraft_cos::write_full(&doc, &Default::default()).unwrap();+ let bytes = pdfcraft_cos::write_full(&doc, &Default::default()).unwrap();let back = Document::open(std::sync::Arc::new(bytes)).unwrap();assert_eq!(verify(&back, Level::A2b).len(), 1);}diff --git a/crates/preflight/src/xmp.rs b/crates/preflight/src/xmp.rsindex f4dc189b2..3057213d1 100644--- a/crates/preflight/src/xmp.rs+++ b/crates/preflight/src/xmp.rs@@ -1,7 +1,7 @@//! XMP metadata for PDF/A: the identification schema and the document information, kept//! consistent (ISO 19005-2 §6.6).-use printcraft_cos::Document;+use pdfcraft_cos::Document;/// The value of a simple XMP property, written either as an attribute (`pdfaid:part="2"`) or/// as an element (`<pdfaid:part>2</pdfaid:part>`, or inside an `rdf:Alt`/`rdf:Seq`).diff --git a/crates/print/Cargo.toml b/crates/print/Cargo.tomlindex aca8388e5..83b98de7a 100644--- a/crates/print/Cargo.toml+++ b/crates/print/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-print"+name = "pdfcraft-print"description = "Printing: page selection, sizing (fit, actual, shrink, custom), multiple pages per sheet, booklets, posters, comments & forms; print-ready PDF and the system spooler"version.workspace = trueedition.workspace = true@@ -9,7 +9,7 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-content = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-content = { workspace = true }+pdfcraft-model = { workspace = true }thiserror = { workspace = true }diff --git a/crates/print/README.md b/crates/print/README.mdindex abadfbc0f..074e05a5a 100644--- a/crates/print/README.md+++ b/crates/print/README.md@@ -1,4 +1,4 @@-# printcraft-print+# pdfcraft-printLayer L4: printing (execution plan M10.5).diff --git a/crates/print/src/lib.rs b/crates/print/src/lib.rsindex a0ef79890..31edd8744 100644--- a/crates/print/src/lib.rs+++ b/crates/print/src/lib.rs@@ -17,8 +17,8 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_content::Matrix;-use printcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, Stream, write_full};+use pdfcraft_content::Matrix;+use pdfcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, Stream, write_full};pub mod range;pub mod spool;@@ -36,7 +36,7 @@ pub enum PrintError {#[error("{0}")]Spool(String),#[error(transparent)]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]@@ -449,7 +449,7 @@ fn appearance_matrix(doc: &Document, form: &Dict, rect: [f64; 4]) -> Option<Matr/// A Form XObject holding page `index` as it prints (user space; BBox = crop box).fn page_form(doc: &mut Document, index: usize, content: Content) -> Result<ObjRef, PrintError> {- let page = printcraft_model::pages(doc).swap_remove(index);+ let page = pdfcraft_model::pages(doc).swap_remove(index);let crop = page.crop(doc);let mut res = page.dict.get(b"Resources").and_then(|r| doc.resolve(r).as_dict().cloned()).unwrap_or_default();let mut body = if content == Content::FormFieldsOnly { Vec::new() } else { decoded_contents(doc, &page.dict) };@@ -500,7 +500,7 @@ fn page_form(doc: &mut Document, index: usize, content: Content) -> Result<ObjRe/// Build the print-ready PDF for `settings`. Encryption is not carried over (the file goes to a/// printer or is the user's own copy); callers must check the print permission first.pub fn impose(src: &Document, settings: &Settings) -> Result<Vec<u8>, PrintError> {- let pages = printcraft_model::pages(src);+ let pages = pdfcraft_model::pages(src);let sizes: Vec<(f64, f64)> = pages.iter().map(|p| p.display_size(src)).collect();let sheets = layout(&sizes, settings)?;let mut doc = src.clone();diff --git a/crates/print/src/spool.rs b/crates/print/src/spool.rsindex 8ca21758a..c744579d2 100644--- a/crates/print/src/spool.rs+++ b/crates/print/src/spool.rs@@ -31,7 +31,7 @@ pub struct Job {impl Default for Job {fn default() -> Self {- Job { printer: None, copies: 1, collate: true, duplex: Duplex::Off, grayscale: false, title: "PrintCraft".into() }+ Job { printer: None, copies: 1, collate: true, duplex: Duplex::Off, grayscale: false, title: "PdfCraft".into() }}}@@ -89,7 +89,7 @@ pub fn printers() -> Vec<Printer> {pub fn submit(pdf: &[u8], job: &Job) -> Result<String, PrintError> {#[cfg(all(unix, not(target_arch = "wasm32")))]{- let dir = std::env::temp_dir().join(format!("printcraft-print-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-print-{}", std::process::id()));std::fs::create_dir_all(&dir).map_err(|e| PrintError::Spool(e.to_string()))?;let file = dir.join(format!("job-{}.pdf", std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_nanos())));std::fs::write(&file, pdf).map_err(|e| PrintError::Spool(e.to_string()))?;diff --git a/crates/print/src/tests.rs b/crates/print/src/tests.rsindex f2a09d6da..9ef4ab7db 100644--- a/crates/print/src/tests.rs+++ b/crates/print/src/tests.rs@@ -143,7 +143,7 @@ fn imposed_pdf_has_the_sheets_and_honours_comments_and_forms() {let doc = fixture(3);let out = impose(&doc, &settings(vec![0, 1, 2], Layout::multiple(2))).unwrap();let printed = Document::open(Arc::new(out.clone())).unwrap();- let pages = printcraft_model::pages(&printed);+ let pages = pdfcraft_model::pages(&printed);assert_eq!(pages.len(), 2);assert_eq!(pages[0].crop(&printed), [0.0, 0.0, 792.0, 612.0]);// The source pages are form XObjects holding their content.diff --git a/crates/redact/Cargo.toml b/crates/redact/Cargo.tomlindex 64b0d2ba1..4aee20bfc 100644--- a/crates/redact/Cargo.toml+++ b/crates/redact/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-redact"+name = "pdfcraft-redact"description = "Redaction (architecture §11.2): marks, apply (glyphs, images, vectors, XObjects, annotations, fields), verification"version.workspace = trueedition.workspace = true@@ -9,13 +9,13 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-content = { workspace = true }-printcraft-fonts = { workspace = true }-printcraft-model = { workspace = true }-printcraft-forms = { workspace = true }-printcraft-edit = { workspace = true }-printcraft-annot = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-content = { workspace = true }+pdfcraft-fonts = { workspace = true }+pdfcraft-model = { workspace = true }+pdfcraft-forms = { workspace = true }+pdfcraft-edit = { workspace = true }+pdfcraft-annot = { workspace = true }thiserror = { workspace = true }[dev-dependencies]diff --git a/crates/redact/README.md b/crates/redact/README.mdindex e32cbb24b..61bf80b8c 100644--- a/crates/redact/README.md+++ b/crates/redact/README.md@@ -1,9 +1,9 @@-# printcraft-redact+# pdfcraft-redactLayer L4 (may use `edit`): redaction, architecture §11.2.```rust-// Marks are Redact annotations (printcraft-annot: Shape::Redact { quads, overlay }).+// Marks are Redact annotations (pdfcraft-annot: Shape::Redact { quads, overlay }).let marks: Vec<Mark> = marks(&doc); // page, areas (user space), fill, overlay textlet report = apply(&mut doc, None)?; // everything, or Some(&[pages])clear_marks(&mut doc, None)?; // remove marks without applying@@ -18,7 +18,7 @@ clear_marks(&mut doc, None)?; // remove marks without appmore than a fifth of its size (or a point) both ways; zero-size text goes when its origin isinside;- **images**: fully covered → removed; partly covered → a copy with the covered pixels cleared- (8/16-bit and 1/2/4-bit images, image masks; Flate/LZW/RL/A85/AHx). Codecs PrintCraft can't+ (8/16-bit and 1/2/4-bit images, image masks; Flate/LZW/RL/A85/AHx). Codecs PdfCraft can'tre-encode (DCT, JPX, JBIG2, CCITT) are removed whole (fail-closed); inline images under anarea are removed;- **vectors**: covered paths are removed; partly covered paths and shadings are clipped sodiff --git a/crates/redact/src/image.rs b/crates/redact/src/image.rsindex f76dce939..4d61fd6c6 100644--- a/crates/redact/src/image.rs+++ b/crates/redact/src/image.rs@@ -1,11 +1,11 @@//! Clearing the pixels of an image under redaction regions. The image is decoded, every pixel//! whose centre maps into a region is set to zero (no ink for image masks), and the result is//! written as a new Flate image; the original object is untouched (other pages may use it).-//! Images whose codec PrintCraft can't decode (DCT, JPX, JBIG2, CCITT) return `None`, and the+//! Images whose codec PdfCraft can't decode (DCT, JPX, JBIG2, CCITT) return `None`, and the//! caller removes the whole image instead; that is fail-closed.-use printcraft_content::{Matrix, overlaps};-use printcraft_cos::{Document, Object, Stream};+use pdfcraft_content::{Matrix, overlaps};+use pdfcraft_cos::{Document, Object, Stream};/// Most pixels an image may have to be cleared in place (larger ones are removed).const MAX_PIXELS: u64 = 64 << 20;diff --git a/crates/redact/src/interp.rs b/crates/redact/src/interp.rsindex 2feb7679b..e0c64a3d0 100644--- a/crates/redact/src/interp.rs+++ b/crates/redact/src/interp.rs@@ -20,11 +20,11 @@use std::collections::HashMap;use std::rc::Rc;-use printcraft_content::{Matrix, Op, contains, num, overlaps, parse, serialize_ops, string};-use printcraft_cos::{Dict, Document, ObjRef, Object, Stream};+use pdfcraft_content::{Matrix, Op, contains, num, overlaps, parse, serialize_ops, string};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, Stream};use crate::{Report, image};-use printcraft_fonts::pdf::Metrics;+use pdfcraft_fonts::pdf::Metrics;const MAX_DEPTH: usize = 12;diff --git a/crates/redact/src/lib.rs b/crates/redact/src/lib.rsindex 57189ade4..fa29fbc11 100644--- a/crates/redact/src/lib.rs+++ b/crates/redact/src/lib.rs@@ -1,6 +1,6 @@//! Redaction (architecture §11.2, execution plan M8.5–M8.7). Layer L4.//!-//! Content is marked for redaction with Redact annotations (§12.5.6.23); `printcraft-annot`+//! Content is marked for redaction with Redact annotations (§12.5.6.23); `pdfcraft-annot`//! creates them. [`apply`] then removes everything under the marks, for good://! - text glyphs (the rest of each line keeps its position), inline images, and paths that the//! marks cover; images and vectors partly under a mark lose the covered part;@@ -14,7 +14,7 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]-use printcraft_cos::{Dict, Document, ObjRef, Object, Stream};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, Stream};mod image;mod interp;@@ -37,11 +37,11 @@ pub enum RedactError {#[error("redaction could not be verified: {0} item(s) were still found under the marks, so nothing was changed")]Residue(usize),#[error(transparent)]- Edit(#[from] printcraft_edit::EditError),+ Edit(#[from] pdfcraft_edit::EditError),#[error(transparent)]- Form(#[from] printcraft_forms::FormError),+ Form(#[from] pdfcraft_forms::FormError),#[error(transparent)]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}/// A redaction mark on a page.@@ -56,13 +56,13 @@ pub struct Mark {pub fill: Option<Rgb>,pub overlay: String,/// How the overlay text is drawn (`/DA`, `/Q`, `/Repeat`).- pub look: printcraft_annot::OverlayLook,+ pub look: pdfcraft_annot::OverlayLook,}/// The overlay look of a Redact annotation: font, size and colour from `/DA`, alignment from/// `/Q`, repetition from `/Repeat`.-fn overlay_look(doc: &Document, d: &Dict) -> printcraft_annot::OverlayLook {- let mut look = printcraft_annot::OverlayLook::default();+fn overlay_look(doc: &Document, d: &Dict) -> pdfcraft_annot::OverlayLook {+ let mut look = pdfcraft_annot::OverlayLook::default();if let Some(da) = d.get(b"DA").and_then(|o| doc.resolve(o).as_string().map(|s| String::from_utf8_lossy(&s.bytes).into_owned())) {let t: Vec<&str> = da.split_whitespace().collect();for (i, w) in t.iter().enumerate() {@@ -78,7 +78,7 @@ fn overlay_look(doc: &Document, d: &Dict) -> printcraft_annot::OverlayLook {}}"Tf" if i >= 2 => {- look.font = printcraft_annot::OverlayFont::from_resource(t[i - 2].trim_start_matches('/'));+ look.font = pdfcraft_annot::OverlayFont::from_resource(t[i - 2].trim_start_matches('/'));look.size = t[i - 1].parse::<f64>().unwrap_or(0.0).max(0.0);}_ => {}@@ -130,7 +130,7 @@ pub(crate) fn annots_of(doc: &Document, page: &Dict) -> Vec<Object> {/// Every redaction mark in the document, page by page.pub fn marks(doc: &Document) -> Vec<Mark> {let mut out = Vec::new();- for (pi, p) in printcraft_model::pages(doc).iter().enumerate() {+ for (pi, p) in pdfcraft_model::pages(doc).iter().enumerate() {for a in annots_of(doc, &p.dict) {let Some(r) = a.as_ref() else { continue };let obj = doc.get(r);@@ -214,10 +214,10 @@ fn overlay_content(marks: &[&Mark]) -> Vec<u8> {// set; repeated to fill the area when asked.let look = &m.look;let (res, width): (&str, fn(&str, f64) -> f64) = match look.font {- printcraft_annot::OverlayFont::Helvetica => ("PCHelv", printcraft_fonts::helvetica_width),+ pdfcraft_annot::OverlayFont::Helvetica => ("PCHelv", pdfcraft_fonts::helvetica_width),// Approximations of the standard metrics (no font program is bundled).- printcraft_annot::OverlayFont::Times => ("PCTimes", |s, size| printcraft_fonts::helvetica_width(s, size) * 0.9),- printcraft_annot::OverlayFont::Courier => ("PCCour", |s, size| s.chars().count() as f64 * size * 0.6),+ pdfcraft_annot::OverlayFont::Times => ("PCTimes", |s, size| pdfcraft_fonts::helvetica_width(s, size) * 0.9),+ pdfcraft_annot::OverlayFont::Courier => ("PCCour", |s, size| s.chars().count() as f64 * size * 0.6),};let [cr, cg, cb] = look.color.map(|v| v.clamp(0.0, 1.0));for r in &m.rects {@@ -252,7 +252,7 @@ fn overlay_content(marks: &[&Mark]) -> Vec<u8> {_ => r[0] + (w - lw) / 2.0,};c.extend(format!("1 0 0 1 {} {} Tm ", n(x), n(y)).bytes());- c.extend_from_slice(&printcraft_fonts::literal(&printcraft_fonts::win_ansi(line)));+ c.extend_from_slice(&pdfcraft_fonts::literal(&pdfcraft_fonts::win_ansi(line)));c.extend_from_slice(b" Tj ");y -= size * 1.2;}@@ -277,10 +277,10 @@ pub fn apply(doc: &mut Document, pages: Option<&[usize]>) -> Result<Report, Redareport.pages = by_page.len();let mut doomed_fields: Vec<String> = Vec::new();let widget_owner: Vec<(ObjRef, String)> =- printcraft_forms::fields(doc).into_iter().flat_map(|f| f.widgets.iter().map(|w| (w.obj, f.name.clone())).collect::<Vec<_>>()).collect();+ pdfcraft_forms::fields(doc).into_iter().flat_map(|f| f.widgets.iter().map(|w| (w.obj, f.name.clone())).collect::<Vec<_>>()).collect();for &pi in &by_page {- let page = printcraft_model::pages(doc).swap_remove(pi);+ let page = pdfcraft_model::pages(doc).swap_remove(pi);let page_marks: Vec<&Mark> = chosen.iter().copied().filter(|m| m.page == pi).collect();let rects: Vec<[f64; 4]> = page_marks.iter().flat_map(|m| m.rects.iter().copied()).collect();@@ -289,7 +289,7 @@ pub fn apply(doc: &mut Document, pages: Option<&[usize]>) -> Result<Report, Redalet resources = page.dict.get(b"Resources").and_then(|r| doc.resolve(r).as_dict().cloned()).unwrap_or_default();let out = {let mut scope = Scope::new(&rects, Mode::Apply, &mut report);- process(doc, &mut scope, &data, &resources, printcraft_content::Matrix::IDENTITY)+ process(doc, &mut scope, &data, &resources, pdfcraft_content::Matrix::IDENTITY)};let mut new_list = list.clone();let mut changed = false;@@ -345,7 +345,7 @@ pub fn apply(doc: &mut Document, pages: Option<&[usize]>) -> Result<Report, Redaif subtype == b"Popup" {continue;}- if rect_of(doc, d.get(b"Rect")).is_some_and(|b| rects.iter().any(|x| printcraft_content::overlaps(*x, b, 0.0))) {+ if rect_of(doc, d.get(b"Rect")).is_some_and(|b| rects.iter().any(|x| pdfcraft_content::overlaps(*x, b, 0.0))) {removed.push(r);if subtype == b"Widget" {if let Some((_, name)) = widget_owner.iter().find(|(w, _)| *w == r)@@ -381,8 +381,8 @@ pub fn apply(doc: &mut Document, pages: Option<&[usize]>) -> Result<Report, Reda// 3. Form fields with a widget under a mark (all their widgets go).for name in &doomed_fields {- if printcraft_forms::fields(doc).iter().any(|f| &f.name == name) {- printcraft_forms::delete_field(doc, name)?;+ if pdfcraft_forms::fields(doc).iter().any(|f| &f.name == name) {+ pdfcraft_forms::delete_field(doc, name)?;report.fields += 1;}}@@ -392,14 +392,14 @@ pub fn apply(doc: &mut Document, pages: Option<&[usize]>) -> Result<Report, Redalet page_marks: Vec<&Mark> = chosen.iter().copied().filter(|m| m.page == pi).collect();let content = overlay_content(&page_marks);if !content.is_empty() {- printcraft_edit::stamp(doc, pi, "Redaction", content)?;+ pdfcraft_edit::stamp(doc, pi, "Redaction", content)?;}}// 5. Verify: nothing readable may remain under a region.let mut residue = 0;for &pi in &by_page {- let page = printcraft_model::pages(doc).swap_remove(pi);+ let page = pdfcraft_model::pages(doc).swap_remove(pi);let rects: Vec<[f64; 4]> = chosen.iter().filter(|m| m.page == pi).flat_map(|m| m.rects.iter().copied()).collect();let (list, data) = page_streams(doc, &page.dict, pi)?;// The overlay stream (last) draws text of its own: the overlay label is allowed.@@ -412,7 +412,7 @@ pub fn apply(doc: &mut Document, pages: Option<&[usize]>) -> Result<Report, Redalet resources = page.dict.get(b"Resources").and_then(|r| doc.resolve(r).as_dict().cloned()).unwrap_or_default();let mut scratch = Report::default();let mut scope = Scope::new(&rects, Mode::Verify, &mut scratch);- residue += process(doc, &mut scope, &original, &resources, printcraft_content::Matrix::IDENTITY).residue;+ residue += process(doc, &mut scope, &original, &resources, pdfcraft_content::Matrix::IDENTITY).residue;}if residue > 0 {return Err(RedactError::Residue(residue));@@ -429,7 +429,7 @@ pub fn clear_marks(doc: &mut Document, pages: Option<&[usize]>) -> Result<usize,if doomed.is_empty() {return Err(RedactError::NothingToApply);}- for p in printcraft_model::pages(doc) {+ for p in pdfcraft_model::pages(doc) {let annots = annots_of(doc, &p.dict);let kept: Vec<Object> = annots.iter()diff --git a/crates/redact/src/sanitize.rs b/crates/redact/src/sanitize.rsindex 0b61df402..11756bba1 100644--- a/crates/redact/src/sanitize.rs+++ b/crates/redact/src/sanitize.rs@@ -4,13 +4,13 @@//! categories; [`sanitize`] removes all of them. Every removal makes the next save a full//! rewrite, so the earlier revision (which still holds the data) leaves the file.-use printcraft_content::Matrix;-use printcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_content::Matrix;+use pdfcraft_cos::{Dict, Document, ObjRef, Object};use crate::interp::{Mode, Scope, process};use crate::{RedactError, Report, annots_of, page_streams};-/// The categories of Acrobat's Remove Hidden Information panel that PrintCraft handles.+/// The categories of Acrobat's Remove Hidden Information panel that PdfCraft handles.#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]pub enum Hidden {/// Document information (`/Info`) and XMP metadata streams.@@ -142,9 +142,9 @@ fn content_pass(doc: &mut Document, text: bool, layers: bool, write: bool) -> Rereturn Ok(0);}let mut total = 0;- let n = printcraft_model::pages(doc).len();+ let n = pdfcraft_model::pages(doc).len();for pi in 0..n {- let page = printcraft_model::pages(doc).swap_remove(pi);+ let page = pdfcraft_model::pages(doc).swap_remove(pi);let Ok((list, data)) = page_streams(doc, &page.dict, pi) else {if write {return Err(RedactError::Unreadable(pi + 1));@@ -175,7 +175,7 @@ fn content_pass(doc: &mut Document, text: bool, layers: bool, write: bool) -> Re_ => Dict::new(),};dict.remove(b"Length");- new_list[i] = Object::Ref(doc.add(Object::Stream(printcraft_cos::Stream::flate(dict, &bytes))));+ new_list[i] = Object::Ref(doc.add(Object::Stream(pdfcraft_cos::Stream::flate(dict, &bytes))));changed = true;}if changed || !out.xobjects.is_empty() {@@ -199,7 +199,7 @@ fn content_pass(doc: &mut Document, text: bool, layers: bool, write: bool) -> Re/// How many items each category would remove (categories with nothing are included as 0).pub fn scan(doc: &Document) -> Vec<(Hidden, usize)> {let cat = catalog(doc).map(|c| c.1).unwrap_or_default();- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);let annots: Vec<Dict> = pages.iter().flat_map(|p| annots_of(doc, &p.dict)).filter_map(|a| doc.resolve(&a).as_dict().cloned()).collect();let count_sub = |s: &[u8]| annots.iter().filter(|a| a.name(b"Subtype") == Some(s)).count();let names = sub(doc, &cat, b"Names").unwrap_or_default();@@ -215,7 +215,7 @@ pub fn scan(doc: &Document) -> Vec<(Hidden, usize)> {}Hidden::Attachments => sub(doc, &names, b"EmbeddedFiles").map_or(0, |t| name_tree_len(doc, &t, 0)) + count_sub(b"FileAttachment"),Hidden::Comments => annots.iter().filter(|a| is_comment(a.name(b"Subtype").unwrap_or(b""))).count(),- Hidden::FormFields => printcraft_forms::fields(doc).len(),+ Hidden::FormFields => pdfcraft_forms::fields(doc).len(),Hidden::HiddenText => content_pass(&mut doc2, true, false, false).unwrap_or(0),Hidden::HiddenLayers => {let off = hidden_layers(doc).len();@@ -250,13 +250,13 @@ pub fn remove_hidden(doc: &mut Document, which: &[Hidden]) -> Result<Vec<(Hidden}if which.contains(&Hidden::FormFields) && count(Hidden::FormFields) > 0 {// Fields without appearances get one first, so their values stay visible.- for f in printcraft_forms::fields(doc) {+ for f in pdfcraft_forms::fields(doc) {if f.widgets.iter().any(|w| !doc.get(w.obj).as_dict().is_some_and(|d| d.contains(b"AP"))) {- printcraft_forms::redraw_field(doc, &f.name)?;+ pdfcraft_forms::redraw_field(doc, &f.name)?;}}- let n = printcraft_model::pages(doc).len();- printcraft_edit::flatten(doc, &(0..n).collect::<Vec<_>>(), false, true)?;+ let n = pdfcraft_model::pages(doc).len();+ pdfcraft_edit::flatten(doc, &(0..n).collect::<Vec<_>>(), false, true)?;doc.update_dict(root, |d| {d.remove(b"AcroForm");})?;@@ -268,7 +268,7 @@ pub fn remove_hidden(doc: &mut Document, which: &[Hidden]) -> Result<Vec<(Hidden|| (which.contains(&Hidden::Attachments) && s == b"FileAttachment")|| (which.contains(&Hidden::LinksActionsScripts) && s == b"Link")};- for p in printcraft_model::pages(doc) {+ for p in pdfcraft_model::pages(doc) {let list = annots_of(doc, &p.dict);let mut removed: Vec<ObjRef> = Vec::new();for a in &list {diff --git a/crates/redact/src/tags.rs b/crates/redact/src/tags.rsindex 5df296a4f..d233b2661 100644--- a/crates/redact/src/tags.rs+++ b/crates/redact/src/tags.rs@@ -7,13 +7,13 @@use std::collections::{HashMap, HashSet};-use printcraft_cos::{Dict, Document, ObjRef, Object};+use pdfcraft_cos::{Dict, Document, ObjRef, Object};/// Each MCID's operators (serialized), and whether anything is still drawn inside it.fn by_mcid(data: &[u8]) -> HashMap<i64, (Vec<u8>, bool)> {let mut out: HashMap<i64, (Vec<u8>, bool)> = HashMap::new();let mut stack: Vec<Option<i64>> = Vec::new();- for op in printcraft_content::parse(data).ops {+ for op in pdfcraft_content::parse(data).ops {match op.op.as_slice() {b"BDC" => {let id = match op.operands.get(1) {@@ -45,7 +45,7 @@ fn by_mcid(data: &[u8]) -> HashMap<i64, (Vec<u8>, bool)> {_ => false,};let mut bytes = Vec::new();- printcraft_content::write_op(&op, &mut bytes);+ pdfcraft_content::write_op(&op, &mut bytes);for id in stack.iter().flatten() {let e = out.entry(*id).or_default();e.0.extend_from_slice(&bytes);@@ -91,7 +91,7 @@ fn mcid_of(o: &Object, page: Option<ObjRef>, target: ObjRef) -> Option<i64> {}/// Clean the elements owning `changed` marked content on `page`; returns how many changed.-pub(crate) fn clean(doc: &mut Document, page: ObjRef, changed: &HashSet<i64>, empty: &HashSet<i64>) -> Result<usize, printcraft_cos::CosError> {+pub(crate) fn clean(doc: &mut Document, page: ObjRef, changed: &HashSet<i64>, empty: &HashSet<i64>) -> Result<usize, pdfcraft_cos::CosError> {if changed.is_empty() {return Ok(0);}diff --git a/crates/redact/src/tests.rs b/crates/redact/src/tests.rsindex 0ca0b794e..1f4175fa0 100644--- a/crates/redact/src/tests.rs+++ b/crates/redact/src/tests.rs@@ -1,7 +1,7 @@use std::sync::Arc;-use printcraft_annot::{Meta, NewAnnotation, Shape, Style, add_annotation, rect_quad};-use printcraft_cos::{Document, SaveOptions, write_full, write_incremental};+use pdfcraft_annot::{Meta, NewAnnotation, Shape, Style, add_annotation, rect_quad};+use pdfcraft_cos::{Document, SaveOptions, write_full, write_incremental};use super::*;@@ -60,19 +60,19 @@ fn mark(doc: &mut Document, page: usize, rects: &[[f64; 4]], overlay: &str) {/// The decoded content streams of a page, joined.fn content(doc: &Document, page: usize) -> String {- let p = &printcraft_model::pages(doc)[page];+ let p = &pdfcraft_model::pages(doc)[page];let (_, data) = page_streams(doc, &p.dict, page).unwrap();data.iter().map(|d| String::from_utf8_lossy(d).into_owned()).collect::<Vec<_>>().join("\n")}/// Glyphs (and inline images) of page `page` under `rects` (the verifier's count).fn under(doc: &mut Document, page: usize, rects: &[[f64; 4]]) -> usize {- let p = printcraft_model::pages(doc).swap_remove(page);+ let p = pdfcraft_model::pages(doc).swap_remove(page);let (_, data) = page_streams(doc, &p.dict, page).unwrap();let res = p.dict.get(b"Resources").and_then(|r| doc.resolve(r).as_dict().cloned()).unwrap_or_default();let mut rep = Report::default();let mut scope = Scope::new(rects, Mode::Verify, &mut rep);- process(doc, &mut scope, &data, &res, printcraft_content::Matrix::IDENTITY).residue+ process(doc, &mut scope, &data, &res, pdfcraft_content::Matrix::IDENTITY).residue}fn reopen(doc: &Document) -> Document {@@ -146,11 +146,11 @@ fn rotated_text_and_composite_fonts() {let mut doc = one_page(src, "", vec![]);let font_ref = doc.add(Object::Dict(Dict::new()));let parsed = {- let mut lx = printcraft_cos::Lexer::new(&t0, 0);+ let mut lx = pdfcraft_cos::Lexer::new(&t0, 0);lx.object().unwrap()};doc.set(font_ref, parsed);- let page = printcraft_model::pages(&doc)[0].obj;+ let page = pdfcraft_model::pages(&doc)[0].obj;doc.update_dict(page, |d| {let mut res = d.get(b"Resources").and_then(Object::as_dict).cloned().unwrap();let mut fonts = res.get(b"Font").and_then(Object::as_dict).cloned().unwrap();@@ -178,7 +178,7 @@ fn images_are_removed_or_have_their_pixels_cleared() {assert_eq!((r.images_removed, r.images_cleared), (1, 1), "{r:?}");let c = content(&doc, 0);assert!(!c.contains("/Im1 Do") && !c.contains("/Im2 Do"), "{c}");- let p = printcraft_model::pages(&doc).swap_remove(0);+ let p = pdfcraft_model::pages(&doc).swap_remove(0);let res = doc.resolve(p.dict.get(b"Resources").unwrap()).as_dict().cloned().unwrap();let xo = doc.resolve(res.get(b"XObject").unwrap()).as_dict().cloned().unwrap();let new = xo.iter().find(|(k, _)| k.starts_with(b"PCRedacted")).map(|(_, v)| v.clone()).expect("a cleared copy");@@ -244,12 +244,12 @@ fn comments_links_and_fields_under_a_mark_go() {&Meta::default(),).unwrap();- printcraft_forms::add_field(&mut doc, 0, [10.0, 50.0, 100.0, 70.0], &printcraft_forms::NewField::Text { multiline: false }, Some("ssn")).unwrap();+ pdfcraft_forms::add_field(&mut doc, 0, [10.0, 50.0, 100.0, 70.0], &pdfcraft_forms::NewField::Text { multiline: false }, Some("ssn")).unwrap();mark(&mut doc, 0, &[[0.0, 0.0, 120.0, 80.0]], "REDACTED");let r = apply(&mut doc, None).unwrap();assert_eq!((r.annotations, r.fields), (1, 1), "{r:?}");- assert!(printcraft_forms::fields(&doc).is_empty());- let p = printcraft_model::pages(&doc).swap_remove(0);+ assert!(pdfcraft_forms::fields(&doc).is_empty());+ let p = pdfcraft_model::pages(&doc).swap_remove(0);assert_eq!(annots_of(&doc, &p.dict).len(), 1, "only the far rectangle stays");let c = content(&doc, 0);assert!(c.contains("(REDACTED) Tj"), "overlay text: {c}");@@ -269,7 +269,7 @@ fn nothing_to_apply_and_clearing_marks() {#[test]fn unreadable_content_fails_closed() {let mut doc = one_page(b"", "", vec![]);- let page = printcraft_model::pages(&doc)[0].obj;+ let page = pdfcraft_model::pages(&doc)[0].obj;let bad = doc.add(Object::Stream(Stream::from_raw({let mut d = Dict::new();@@ -314,8 +314,8 @@ fn hidden_fixture() -> Document {let mut doc = pdf(objs);let info = doc.add(Object::Dict({let mut d = Dict::new();- d.set(b"Title".to_vec(), printcraft_cos::PdfString::text("Secret plan"));- d.set(b"Author".to_vec(), printcraft_cos::PdfString::text("Ada"));+ d.set(b"Title".to_vec(), pdfcraft_cos::PdfString::text("Secret plan"));+ d.set(b"Author".to_vec(), pdfcraft_cos::PdfString::text("Ada"));d}));doc.trailer_mut().set(b"Info".to_vec(), Object::Ref(info));@@ -357,8 +357,8 @@ fn hidden_information_is_counted_and_removed() {for k in [&b"Outlines"[..], b"OpenAction", b"PieceInfo", b"AcroForm", b"Metadata"] {assert!(!cat.contains(k), "{}", String::from_utf8_lossy(k));}- assert!(printcraft_forms::fields(&doc).is_empty());- let p = printcraft_model::pages(&doc).swap_remove(0);+ assert!(pdfcraft_forms::fields(&doc).is_empty());+ let p = pdfcraft_model::pages(&doc).swap_remove(0);assert!(annots_of(&doc, &p.dict).is_empty());let shown = doc.object_numbers().into_iter().any(|n| match &*doc.get(ObjRef::new(n, doc.generation(n))) {Object::Stream(s) => s.decoded().is_ok_and(|d| d.windows(5).any(|w| w == b"(Ada)")),@@ -370,8 +370,7 @@ fn hidden_information_is_counted_and_removed() {#[test]fn overlay_text_takes_its_font_size_colour_alignment_and_repeats() {let mut doc = one_page(b"BT /F1 12 Tf 20 250 Td (Secret salary figures) Tj ET", "", Vec::new());- let look =- printcraft_annot::OverlayLook { font: printcraft_annot::OverlayFont::Courier, size: 8.0, color: [0.0, 0.0, 1.0], align: 0, repeat: true };+ let look = pdfcraft_annot::OverlayLook { font: pdfcraft_annot::OverlayFont::Courier, size: 8.0, color: [0.0, 0.0, 1.0], align: 0, repeat: true };let shape = Shape::Redact { quads: vec![rect_quad([10.0, 200.0, 290.0, 270.0])], overlay: "REDACTED".into(), look };let style = Style::default_for(&shape);add_annotation(&mut doc, &NewAnnotation { page: 0, shape, style, contents: String::new(), author: "T".into() }, &Meta::default()).unwrap();@@ -385,7 +384,7 @@ fn overlay_text_takes_its_font_size_colour_alignment_and_repeats() {// 70 pt high at 8 pt × 1.2 leading: several lines, each the word repeated.assert!(c.matches(" Tm (REDACTED REDACTED").count() >= 5, "{c}");assert!(c.contains("1 0 0 1 11 "), "left aligned at the area's edge: {c}");- let p = &printcraft_model::pages(&doc)[0];+ let p = &pdfcraft_model::pages(&doc)[0];let fonts = p.dict.get(b"Resources")@@ -413,10 +412,10 @@ fn tags_lose_what_redaction_removed() {mark(&mut doc, 0, &[[5.0, 195.0, 60.0, 212.0]], "");let report = apply(&mut doc, None).unwrap();assert_eq!(report.tags, 1);- let secret = doc.get(printcraft_cos::ObjRef::new(9, 0)).as_dict().cloned().unwrap();+ let secret = doc.get(pdfcraft_cos::ObjRef::new(9, 0)).as_dict().cloned().unwrap();assert!(secret.get(b"ActualText").is_none() && secret.get(b"Alt").is_none());assert!(secret.get(b"K").is_none(), "its marked content is empty now");- let public = doc.get(printcraft_cos::ObjRef::new(10, 0)).as_dict().cloned().unwrap();+ let public = doc.get(pdfcraft_cos::ObjRef::new(10, 0)).as_dict().cloned().unwrap();assert_eq!(public.get(b"K").and_then(Object::as_int), Some(1));assert!(public.get(b"ActualText").is_some(), "untouched content keeps its tags");}diff --git a/crates/render/Cargo.toml b/crates/render/Cargo.tomlindex 5e646481e..49d10378f 100644--- a/crates/render/Cargo.toml+++ b/crates/render/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft-render"-description = "Page rendering (bootstrap: hayro) and document inspection for PrintCraft"+name = "pdfcraft-render"+description = "Page rendering (bootstrap: hayro) and document inspection for PdfCraft"version.workspace = trueedition.workspace = truelicense.workspace = truediff --git a/crates/render/src/inspect.rs b/crates/render/src/inspect.rsindex c1f5b16dc..e5c4f4295 100644--- a/crates/render/src/inspect.rs+++ b/crates/render/src/inspect.rs@@ -1,7 +1,7 @@//! Document inspection: everything panels need that is not pixels.//!//! Page geometry comes from hayro (which resolves inheritance and rotation); the rest comes from-//! lopdf (bootstrap, replaced by `printcraft-model` in M2). Inspection is *tolerant*: when lopdf+//! lopdf (bootstrap, replaced by `pdfcraft-model` in M2). Inspection is *tolerant*: when lopdf//! cannot load a file that hayro can render, panels are simply empty and `warnings` says why.use std::collections::{BTreeMap, HashMap, HashSet};diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rsindex 4dfc82c74..506dd89e0 100644--- a/crates/render/src/lib.rs+++ b/crates/render/src/lib.rs@@ -1,4 +1,4 @@-//! printcraft-render — page rasterization and document inspection.+//! pdfcraft-render — page rasterization and document inspection.//!//! **Bootstrap status (see ADR-0004):** rasterization goes straight through the `hayro` crate//! (hayro-interpret + vello_cpu), and inspection (outline, annotations, fields, layers,diff --git a/crates/render/src/raster.rs b/crates/render/src/raster.rsindex 3088e7863..47261f68f 100644--- a/crates/render/src/raster.rs+++ b/crates/render/src/raster.rs@@ -298,7 +298,7 @@ impl RenderPool {};let (wtx, wrx) = channel::<()>();let (shared, out, bytes, config) = (self.shared.clone(), self.results_tx.clone(), self.bytes.clone(), self.config.clone());- match std::thread::Builder::new().name(format!("printcraft-render-{id}")).spawn(move || worker(id, bytes, config, shared, wrx, out)) {+ match std::thread::Builder::new().name(format!("pdfcraft-render-{id}")).spawn(move || worker(id, bytes, config, shared, wrx, out)) {Ok(h) => {lock(&self.wake).push(wtx);lock(&self._workers).push(h);diff --git a/crates/render/src/text.rs b/crates/render/src/text.rsindex eebf675d3..624a956cf 100644--- a/crates/render/src/text.rs+++ b/crates/render/src/text.rs@@ -1,4 +1,4 @@-//! Text extraction (bootstrap for `printcraft-text`, architecture §8).+//! Text extraction (bootstrap for `pdfcraft-text`, architecture §8).//!//! A hayro `Device` that ignores paint and records every glyph: its Unicode value (ToUnicode →//! encoding → glyph name fallbacks, handled by hayro) and its box in *page view space*, i.e.@@ -180,7 +180,7 @@ impl<'a> Device<'a> for TextDevice {fn push_transparency_group(&mut self, _: f32, _: Option<SoftMask<'a>>, _: BlendMode) {}fn draw_glyph(&mut self, glyph: &Glyph<'a>, transform: Affine, glyph_transform: Affine, _: &Paint<'a>, _: &GlyphDrawMode) {let Some(u) = glyph.as_unicode() else {- if std::env::var_os("PRINTCRAFT_TEXT_DEBUG").is_some() {+ if std::env::var_os("PDFCRAFT_TEXT_DEBUG").is_some() {eprintln!("NOUNICODE {} {:?}", if matches!(glyph, Glyph::Type3(_)) { "t3" } else { "ol" }, (transform * glyph_transform).as_coeffs());}return;@@ -195,7 +195,7 @@ impl<'a> Device<'a> for TextDevice {// Glyph space → view space. Glyph space uses 1000 units per em for outline glyphs; the em// box spans descender (−200) to ascender (800), the advance gives the width.let t = transform * glyph_transform;- if std::env::var_os("PRINTCRAFT_TEXT_DEBUG").is_some() {+ if std::env::var_os("PDFCRAFT_TEXT_DEBUG").is_some() {let kind = if matches!(glyph, Glyph::Type3(_)) { "t3" } else { "ol" };eprintln!("{kind} {text:?} transform={:?} glyph_transform={:?}", transform.as_coeffs(), glyph_transform.as_coeffs());}diff --git a/crates/sign/Cargo.toml b/crates/sign/Cargo.tomlindex 259ce0c8a..ddb23cdd7 100644--- a/crates/sign/Cargo.toml+++ b/crates/sign/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-sign"+name = "pdfcraft-sign"description = "Digital signatures (ISO 32000-2 §12.8, PAdES): X.509, CMS, PKCS #12, signing and validation"version.workspace = trueedition.workspace = true@@ -11,9 +11,9 @@ repository.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-annot = { workspace = true }-printcraft-fonts = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-annot = { workspace = true }+pdfcraft-fonts = { workspace = true }thiserror.workspace = truesha1 = "0.11"sha2 = "0.11"diff --git a/crates/sign/README.md b/crates/sign/README.mdindex e21157772..bd6c40b49 100644--- a/crates/sign/README.md+++ b/crates/sign/README.md@@ -1,4 +1,4 @@-# printcraft-sign+# pdfcraft-signLayer L4: digital signatures (execution plan M9; ISO 32000-2 §12.8; PAdES, ETSI EN 319 142).diff --git a/crates/sign/src/keychain.rs b/crates/sign/src/keychain.rsindex 49392203c..4d52031bb 100644--- a/crates/sign/src/keychain.rs+++ b/crates/sign/src/keychain.rs@@ -1,6 +1,6 @@//! Digital IDs from the macOS Keychain: identities (a certificate with its private key) that//! sign through the Security framework. The private key never leaves the Keychain; macOS may-//! ask the user to allow PrintCraft to use it.+//! ask the user to allow PdfCraft to use it.use std::path::Path;use std::sync::Arc;@@ -31,7 +31,7 @@ impl ExternalKey for KeychainKey {}}-/// The `keychain:<SHA-256 of the certificate>` reference PrintCraft keeps for an identity.+/// The `keychain:<SHA-256 of the certificate>` reference PdfCraft keeps for an identity.pub fn reference(c: &Certificate) -> String {let d = DigestAlg::Sha256.digest(&[&c.raw]);format!("keychain:{}", d.iter().map(|b| format!("{b:02x}")).collect::<String>())@@ -49,7 +49,7 @@ pub fn find(reference_or_name: &str) -> Result<DigitalId, SignError> {}/// The signing identities in the user's keychains (or only in the keychain file `keychain`).-/// Identities with keys PrintCraft can't use (other curves, Ed25519) are left out.+/// Identities with keys PdfCraft can't use (other curves, Ed25519) are left out.pub fn identities(keychain: Option<&Path>) -> Result<Vec<DigitalId>, SignError> {let mut search = ItemSearchOptions::new();search.class(ItemClass::identity()).load_refs(true).limit(Limit::All);diff --git a/crates/sign/src/keys.rs b/crates/sign/src/keys.rsindex 9b125743f..5799195e9 100644--- a/crates/sign/src/keys.rs+++ b/crates/sign/src/keys.rs@@ -227,7 +227,7 @@ enum Inner {External(std::sync::Arc<dyn ExternalKey>),}-/// A private key PrintCraft can't read, only ask to sign (OS key stores, tokens).+/// A private key PdfCraft can't read, only ask to sign (OS key stores, tokens).pub trait ExternalKey: Send + Sync {/// Sign `msg`, hashing it with `alg` (PKCS #1 v1.5 for RSA, DER-encoded ECDSA).fn sign(&self, alg: DigestAlg, msg: &[u8]) -> Result<Vec<u8>, SignError>;@@ -248,7 +248,7 @@ impl std::fmt::Debug for PrivateKey {}impl PrivateKey {- /// A key held outside PrintCraft's memory (its public half is `public`). It can't be+ /// A key held outside PdfCraft's memory (its public half is `public`). It can't be/// exported to a PKCS #12 file.pub fn external(public: PublicKey, key: std::sync::Arc<dyn ExternalKey>) -> PrivateKey {PrivateKey { inner: Inner::External(key), public, pkcs8: Vec::new() }diff --git a/crates/sign/src/lib.rs b/crates/sign/src/lib.rsindex 9af82ba15..e46b2da37 100644--- a/crates/sign/src/lib.rs+++ b/crates/sign/src/lib.rs@@ -35,5 +35,5 @@ pub enum SignError {#[error("{0}")]Pdf(String),#[error(transparent)]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}diff --git a/crates/sign/src/pdf.rs b/crates/sign/src/pdf.rsindex be20a4456..ddfa3ea70 100644--- a/crates/sign/src/pdf.rs+++ b/crates/sign/src/pdf.rs@@ -14,7 +14,7 @@use std::collections::{HashMap, HashSet};use std::sync::Arc;-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString, SaveOptions, Stream};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString, SaveOptions, Stream};use crate::SignError;use crate::cms::SignedData;@@ -235,7 +235,7 @@ fn sig_fields(doc: &Document) -> Vec<Field> {/// Which page holds each annotation.fn annot_pages(doc: &Document) -> HashMap<ObjRef, usize> {let mut map = HashMap::new();- for (i, p) in printcraft_annot::page_refs(doc).unwrap_or_default().into_iter().enumerate() {+ for (i, p) in pdfcraft_annot::page_refs(doc).unwrap_or_default().into_iter().enumerate() {if let Some(a) = doc.get(p).as_dict().and_then(|d| d.get(b"Annots").map(|a| doc.resolve(a))).and_then(|a| a.as_array().cloned()) {for r in a.iter().filter_map(Object::as_ref) {map.insert(r, i);@@ -301,7 +301,7 @@ pub fn list_cached(doc: &Document, bytes: &[u8], trust: &TrustStore, cache: &Dig}fn page_index(doc: &Document, p: ObjRef) -> Option<usize> {- printcraft_annot::page_refs(doc).ok()?.iter().position(|r| *r == p)+ pdfcraft_annot::page_refs(doc).ok()?.iter().position(|r| *r == p)}/// Validate one signature dictionary.@@ -355,7 +355,7 @@ fn validate_into(doc: &Document, bytes: &[u8], trust: &TrustStore, v: &Dict, inf// The signed revision's number: its cross-reference sections (1 for a reconstructed file).info.revision = cache.revision(bytes, covered).map_or(1, |d| d.revisions().len().max(1));if info.sub_filter.as_deref() == Some("adbe.x509.rsa_sha1") {- info.details.push("This signature uses the legacy adbe.x509.rsa_sha1 format, which PrintCraft does not validate yet.".into());+ info.details.push("This signature uses the legacy adbe.x509.rsa_sha1 format, which PdfCraft does not validate yet.".into());return;}let sd = match SignedData::parse(&contents) {@@ -452,7 +452,7 @@ fn classify_changes(doc: &Document, old: Option<Document>, p: Option<u8>) -> Modlet Some(old) = old else {return Modification::Disallowed(vec!["the signed version could not be read".into()]);};- let old_content: HashSet<ObjRef> = printcraft_annot::page_refs(&old)+ let old_content: HashSet<ObjRef> = pdfcraft_annot::page_refs(&old).unwrap_or_default().into_iter().flat_map(|pg| {@@ -470,7 +470,7 @@ fn classify_changes(doc: &Document, old: Option<Document>, p: Option<u8>) -> Modlet (mut allowed, mut disallowed): (Vec<&str>, Vec<&str>) = (Vec::new(), Vec::new());// Stored at the same place in both (and not edited since): the same bytes, unchanged.let same_place = |num: u32| -> bool {- use printcraft_cos::XrefEntry;+ use pdfcraft_cos::XrefEntry;if doc.is_edited(num) {return false;}@@ -706,7 +706,7 @@ pub fn sign(doc: &Document, id: &DigitalId, opts: &SignOptions) -> Result<Vec<u8}}let mut app = Dict::new();- app.set(b"Name".to_vec(), Object::name("PrintCraft"));+ app.set(b"Name".to_vec(), Object::name("PdfCraft"));let mut build = Dict::new();build.set(b"App".to_vec(), Object::Dict(app));v.set(b"Prop_Build".to_vec(), Object::Dict(build));@@ -729,7 +729,7 @@ pub fn sign(doc: &Document, id: &DigitalId, opts: &SignOptions) -> Result<Vec<u8doc.update_dict(root, |c| c.set(b"Perms".to_vec(), Object::Dict(perms)))?;}// The field and its widget.- let pages = printcraft_annot::page_refs(&doc).map_err(|e| SignError::Pdf(e.to_string()))?;+ let pages = pdfcraft_annot::page_refs(&doc).map_err(|e| SignError::Pdf(e.to_string()))?;let existing = opts.field.as_deref()@@ -820,7 +820,7 @@ pub fn sign(doc: &Document, id: &DigitalId, opts: &SignOptions) -> Result<Vec<u8doc.update_dict(widget, |w| w.set(b"AP".to_vec(), Object::Dict(apd)))?;// Write with the placeholders, then patch them.let save = SaveOptions { mod_date: Some(opts.date.clone()), object_streams: false, ..SaveOptions::default() };- let mut out = printcraft_cos::write_incremental(&doc, &save)?;+ let mut out = pdfcraft_cos::write_incremental(&doc, &save)?;let (br_at, gap) = locate(&out, reserve)?;let (start, end) = gap;let ranges = [0usize, start, end, out.len() - end];@@ -873,7 +873,7 @@ pub fn display_date(pdf: &str) -> String {/// The visible signature: the signer's name large on the left, the details on the right/// (Acrobat's standard layout), in Helvetica.fn appearance(rect: [f64; 4], name: &str, cert: &Certificate, opts: &SignOptions) -> Stream {- use printcraft_fonts::{helvetica_width, literal, win_ansi, wrap};+ use pdfcraft_fonts::{helvetica_width, literal, win_ansi, wrap};let (w, h) = ((rect[2] - rect[0]).max(0.0), (rect[3] - rect[1]).max(0.0));let a = &opts.appearance;let mut lines: Vec<String> = Vec::new();diff --git a/crates/sign/tests/crypto.rs b/crates/sign/tests/crypto.rsindex 25eb80b73..df60eac1e 100644--- a/crates/sign/tests/crypto.rs+++ b/crates/sign/tests/crypto.rs@@ -1,8 +1,8 @@//! The cryptographic core against files made by OpenSSL 3 (tests/data/README.md).-use printcraft_sign::der::Time;-use printcraft_sign::keys::DigestAlg;-use printcraft_sign::{Certificate, Name, PublicKey, SignError, cms, pkcs12};+use pdfcraft_sign::der::Time;+use pdfcraft_sign::keys::DigestAlg;+use pdfcraft_sign::{Certificate, Name, PublicKey, SignError, cms, pkcs12};fn data(name: &str) -> Vec<u8> {std::fs::read(format!("{}/tests/data/{name}", env!("CARGO_MANIFEST_DIR"))).unwrap()@@ -61,6 +61,7 @@ fn opens_every_openssl_flavour_of_pkcs12() {#[test]fn certificates_parse_as_openssl_made_them() {let c = Certificate::parse(&pem("rsa.crt.pem")).unwrap();+ // The fixtures were made when the app was called PrintCraft.assert_eq!(c.subject.display(), "CN=Test Signer RSA, O=PrintCraft Tests, C=US");assert_eq!(c.serial_hex(), "03E9");assert!(c.is_self_signed());@@ -97,7 +98,7 @@ fn signatures_round_trip_for_every_key_type() {fn new_digital_ids_are_self_signed_and_survive_a_p12_round_trip() {let name = Name::build("Grace Hopper", "Compilers", "Navy", "[email protected]", "us");let now = Time { year: 2026, month: 10, day: 2, hour: 12, minute: 0, second: 0 };- for key in [printcraft_sign::PrivateKey::generate_rsa(2048).unwrap(), printcraft_sign::PrivateKey::generate_p256().unwrap()] {+ for key in [pdfcraft_sign::PrivateKey::generate_rsa(2048).unwrap(), pdfcraft_sign::PrivateKey::generate_p256().unwrap()] {let cert = Certificate::self_signed(&name, &key, now, 5, &[0x42, 0x01]).unwrap();assert!(cert.is_self_signed());assert_eq!(cert.subject.display(), "C=US, O=Navy, OU=Compilers, CN=Grace Hopper, [email protected]");@@ -119,11 +120,11 @@ fn new_digital_ids_are_self_signed_and_survive_a_p12_round_trip() {#[test]fn certificates_load_from_pem_and_der_and_export_as_pem() {let pem_text = data("rsa.crt.pem");- let certs = printcraft_sign::x509::load_certificates(&pem_text).unwrap();+ let certs = pdfcraft_sign::x509::load_certificates(&pem_text).unwrap();assert_eq!(certs.len(), 1);let der = certs[0].raw.clone();- assert_eq!(printcraft_sign::x509::load_certificates(&der).unwrap()[0], certs[0]);- let back = printcraft_sign::x509::to_pem(&certs[0]);- assert_eq!(printcraft_sign::x509::load_certificates(back.as_bytes()).unwrap()[0], certs[0]);- assert!(printcraft_sign::x509::load_certificates(b"hello").is_err());+ assert_eq!(pdfcraft_sign::x509::load_certificates(&der).unwrap()[0], certs[0]);+ let back = pdfcraft_sign::x509::to_pem(&certs[0]);+ assert_eq!(pdfcraft_sign::x509::load_certificates(back.as_bytes()).unwrap()[0], certs[0]);+ assert!(pdfcraft_sign::x509::load_certificates(b"hello").is_err());}diff --git a/crates/sign/tests/data/README.md b/crates/sign/tests/data/README.mdindex a77b448d6..4b9c98d0c 100644--- a/crates/sign/tests/data/README.md+++ b/crates/sign/tests/data/README.md@@ -34,4 +34,4 @@ openssl pkcs12 -export -inkey leaf.key -in leaf.crt -certfile ca.crt -out chain.`openssl-signed.pdf` is a hand-written one-page PDF with a `/Contents` placeholder, signed with`openssl cms -sign -binary -md sha256 -outform DER -signer rsa.crt -inkey rsa.key` over itsbyte ranges (`adbe.pkcs7.detached`, with OpenSSL's signing-time attribute). It checks the-validator against a signature PrintCraft did not make; poppler's `pdfsig` reports it valid.+validator against a signature PdfCraft did not make; poppler's `pdfsig` reports it valid.diff --git a/crates/sign/tests/pdf.rs b/crates/sign/tests/pdf.rsindex 4b0eafc8f..f3fbeb4bc 100644--- a/crates/sign/tests/pdf.rs+++ b/crates/sign/tests/pdf.rs@@ -2,8 +2,8 @@use std::sync::Arc;-use printcraft_cos::{Document, Object, PdfString, SaveOptions, write_incremental};-use printcraft_sign::{Modification, SignOptions, Status, TrustStore, pkcs12, signatures};+use pdfcraft_cos::{Document, Object, PdfString, SaveOptions, write_incremental};+use pdfcraft_sign::{Modification, SignOptions, Status, TrustStore, pkcs12, signatures};fn data(name: &str) -> Vec<u8> {std::fs::read(format!("{}/tests/data/{name}", env!("CARGO_MANIFEST_DIR"))).unwrap()@@ -55,7 +55,7 @@ fn opts() -> SignOptions {fn signing_then_validating_with_and_without_trust() {for file in ["rsa-aes.p12", "ec-p256.p12", "ec-p384.p12", "chain.p12"] {let id = pkcs12::open(&data(file), "test").unwrap();- let signed = printcraft_sign::sign(&open(&fixture()), &id, &opts()).unwrap();+ let signed = pdfcraft_sign::sign(&open(&fixture()), &id, &opts()).unwrap();assert!(signed.starts_with(&fixture()), "{file}: an incremental update");let doc = open(&signed);let sigs = signatures(&doc, &signed, &TrustStore::default());@@ -88,9 +88,9 @@ fn signing_then_validating_with_and_without_trust() {#[test]fn signing_an_existing_field_and_counter_signing() {let id = pkcs12::open(&data("ec-p256.p12"), "test").unwrap();- let first = printcraft_sign::sign(&open(&fixture()), &id, &SignOptions { field: Some("Approval".into()), ..opts() }).unwrap();+ let first = pdfcraft_sign::sign(&open(&fixture()), &id, &SignOptions { field: Some("Approval".into()), ..opts() }).unwrap();let id2 = pkcs12::open(&data("rsa-aes.p12"), "test").unwrap();- let second = printcraft_sign::sign(&open(&first), &id2, &opts()).unwrap();+ let second = pdfcraft_sign::sign(&open(&first), &id2, &opts()).unwrap();let doc = open(&second);let sigs = signatures(&doc, &second, &TrustStore::default());let a = sigs.iter().find(|s| s.field == "Approval").unwrap();@@ -102,8 +102,8 @@ fn signing_an_existing_field_and_counter_signing() {let b = sigs.iter().find(|s| s.field == "Signature1").unwrap();assert_eq!((b.revision, b.modification.clone()), (3, Modification::None));assert!(matches!(- printcraft_sign::sign(&doc, &id, &SignOptions { field: Some("Approval".into()), ..opts() }),- Err(printcraft_sign::SignError::Pdf(_))+ pdfcraft_sign::sign(&doc, &id, &SignOptions { field: Some("Approval".into()), ..opts() }),+ Err(pdfcraft_sign::SignError::Pdf(_))));}@@ -115,13 +115,13 @@ fn edit_after(signed: &[u8], f: impl FnOnce(&mut Document)) -> Vec<u8> {}fn add_comment(doc: &mut Document) {- let mut d = printcraft_cos::Dict::new();+ let mut d = pdfcraft_cos::Dict::new();d.set(b"Type".to_vec(), Object::name("Annot"));d.set(b"Subtype".to_vec(), Object::name("Text"));d.set(b"Rect".to_vec(), Object::Array(vec![Object::Int(10), Object::Int(10), Object::Int(30), Object::Int(30)]));d.set(b"Contents".to_vec(), PdfString::text("A note"));let r = doc.add(Object::Dict(d));- let page = printcraft_cos::ObjRef { num: 3, generation: 0 };+ let page = pdfcraft_cos::ObjRef { num: 3, generation: 0 };doc.update_dict(page, |p| {if let Some(Object::Array(a)) = p.get_mut(b"Annots") {a.push(Object::Ref(r));@@ -131,10 +131,10 @@ fn add_comment(doc: &mut Document) {}fn change_text(doc: &mut Document) {- let mut d = printcraft_cos::Dict::new();+ let mut d = pdfcraft_cos::Dict::new();d.set(b"Length".to_vec(), Object::Int(40));- let s = printcraft_cos::Stream::from_raw(d, b"BT /F1 14 Tf 20 250 Td (Other text) Tj ET".to_vec());- doc.set(printcraft_cos::ObjRef { num: 4, generation: 0 }, Object::Stream(s));+ let s = pdfcraft_cos::Stream::from_raw(d, b"BT /F1 14 Tf 20 250 Td (Other text) Tj ET".to_vec());+ doc.set(pdfcraft_cos::ObjRef { num: 4, generation: 0 }, Object::Stream(s));}#[test]@@ -143,7 +143,7 @@ fn later_changes_are_classified_under_the_signature_permissions() {let trust = TrustStore { certs: vec![id.certificate.clone()] };let check = |bytes: &[u8]| signatures(&open(bytes), bytes, &trust).into_iter().find(|s| s.signed).unwrap();// Approval signature: comments are permitted, rewriting page content is not.- let signed = printcraft_sign::sign(&open(&fixture()), &id, &opts()).unwrap();+ let signed = pdfcraft_sign::sign(&open(&fixture()), &id, &opts()).unwrap();let s = check(&edit_after(&signed, add_comment));assert_eq!(s.status, Status::Valid, "{:?}", s.details);assert_eq!(s.modification, Modification::Allowed(vec!["comments".into()]));@@ -151,23 +151,23 @@ fn later_changes_are_classified_under_the_signature_permissions() {assert_eq!(s.status, Status::Invalid);assert_eq!(s.modification, Modification::Disallowed(vec!["page content".into()]));// Certified with "no changes allowed": even a comment invalidates it.- let certified = printcraft_sign::sign(&open(&fixture()), &id, &SignOptions { certify: Some(1), ..opts() }).unwrap();+ let certified = pdfcraft_sign::sign(&open(&fixture()), &id, &SignOptions { certify: Some(1), ..opts() }).unwrap();let s = check(&certified);assert_eq!((s.certify, s.status), (Some(1), Status::Valid));assert_eq!(check(&edit_after(&certified, add_comment)).status, Status::Invalid);// Certified allowing comments: fine.- let certified3 = printcraft_sign::sign(&open(&fixture()), &id, &SignOptions { certify: Some(3), ..opts() }).unwrap();+ let certified3 = pdfcraft_sign::sign(&open(&fixture()), &id, &SignOptions { certify: Some(3), ..opts() }).unwrap();assert_eq!(check(&edit_after(&certified3, add_comment)).status, Status::Valid);}#[test]fn invisible_signatures_and_refusals() {let id = pkcs12::open(&data("ec-p256.p12"), "test").unwrap();- let signed = printcraft_sign::sign(&open(&fixture()), &id, &SignOptions { rect: None, ..opts() }).unwrap();+ let signed = pdfcraft_sign::sign(&open(&fixture()), &id, &SignOptions { rect: None, ..opts() }).unwrap();let s = signatures(&open(&signed), &signed, &TrustStore::default()).into_iter().find(|s| s.signed).unwrap();assert!(!s.visible);- assert!(printcraft_sign::sign(&open(&fixture()), &id, &SignOptions { page: 5, ..opts() }).is_err());- assert_eq!(printcraft_sign::pdf::display_date("D:20261002120000+01'00'"), "2026.10.02 12:00:00 +01'00'");+ assert!(pdfcraft_sign::sign(&open(&fixture()), &id, &SignOptions { page: 5, ..opts() }).is_err());+ assert_eq!(pdfcraft_sign::pdf::display_date("D:20261002120000+01'00'"), "2026.10.02 12:00:00 +01'00'");}#[test]@@ -180,7 +180,7 @@ fn validates_a_signature_made_by_openssl() {assert_eq!(s.signer.as_deref(), Some("Test Signer RSA"));assert!(s.signing_time.is_some_and(|t| t.year == 2026), "from the CMS signing-time attribute");assert!(!s.visible);- let rsa = printcraft_sign::Certificate::parse(&pkcs12::open(&data("rsa-aes.p12"), "test").unwrap().certificate.raw).unwrap();+ let rsa = pdfcraft_sign::Certificate::parse(&pkcs12::open(&data("rsa-aes.p12"), "test").unwrap().certificate.raw).unwrap();let s = signatures(&doc, &bytes, &TrustStore { certs: vec![rsa] }).into_iter().next().unwrap();assert_eq!(s.status, Status::Valid, "{:?}", s.details);// A later comment is allowed for this approval signature.@@ -201,7 +201,7 @@ trailer << /Root 1 0 R >>.to_vec();let id = pkcs12::open(&data("ec-p256.p12"), "test").unwrap();for certify in [None, Some(2)] {- let signed = printcraft_sign::sign(&open(&bytes), &id, &SignOptions { certify, rect: None, ..opts() }).unwrap();+ let signed = pdfcraft_sign::sign(&open(&bytes), &id, &SignOptions { certify, rect: None, ..opts() }).unwrap();let s = signatures(&open(&signed), &signed, &TrustStore::default()).into_iter().find(|s| s.signed).unwrap();assert_eq!((s.status, s.certify, s.modification.clone()), (Status::Unknown, certify, Modification::None), "{:?}", s.details);}@@ -214,7 +214,7 @@ trailer << /Root 1 0 R >>#[ignore = "creates a temporary macOS keychain; run with --ignored"]fn signing_with_keychain_identities() {use std::process::Command;- let dir = std::env::temp_dir().join(format!("printcraft-keychain-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-keychain-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();let kc = dir.join("test.keychain-db");let sec = |args: &[&str]| Command::new("security").args(args).output().unwrap();@@ -237,11 +237,11 @@ fn signing_with_keychain_identities() {let out = sec(&["import", &p, "-k", k, "-P", "test", "-A"]);assert!(out.status.success(), "{f}: {}", String::from_utf8_lossy(&out.stderr));}- let ids = printcraft_sign::keychain::identities(Some(&kc)).unwrap();+ let ids = pdfcraft_sign::keychain::identities(Some(&kc)).unwrap();assert_eq!(ids.len(), 2, "{ids:?}");for id in &ids {assert!(id.key.is_external());- let signed = printcraft_sign::sign(&open(&fixture()), id, &opts()).unwrap();+ let signed = pdfcraft_sign::sign(&open(&fixture()), id, &opts()).unwrap();let trusted = signatures(&open(&signed), &signed, &TrustStore { certs: vec![id.certificate.clone()] });let s = trusted.iter().find(|s| s.signed).unwrap();assert_eq!(s.status, Status::Valid, "{:?}", s.details);diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.tomlindex ee199abfb..38c23962e 100644--- a/crates/ui-egui/Cargo.toml+++ b/crates/ui-egui/Cargo.toml@@ -1,6 +1,6 @@[package]-name = "printcraft-ui-egui"-description = "The egui shell of PrintCraft"+name = "pdfcraft-ui-egui"+description = "The egui shell of PdfCraft"version.workspace = trueedition.workspace = truelicense.workspace = true@@ -9,9 +9,9 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-fonts = { workspace = true }-printcraft-engine = { workspace = true }-printcraft-render = { workspace = true }+pdfcraft-fonts = { workspace = true }+pdfcraft-engine = { workspace = true }+pdfcraft-render = { workspace = true }egui = { workspace = true }egui_extras = { workspace = true }eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "persistence", "links"] }@@ -36,7 +36,7 @@ js-sys = "0.3"web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "Url"] }[dev-dependencies]-printcraft-cos = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-model = { workspace = true }egui_kittest = { workspace = true, features = ["eframe", "wgpu"] }image = { version = "0.25", default-features = false, features = ["png"] }diff --git a/crates/ui-egui/examples/shot.rs b/crates/ui-egui/examples/shot.rsindex 93642d2b1..01e48e03d 100644--- a/crates/ui-egui/examples/shot.rs+++ b/crates/ui-egui/examples/shot.rs@@ -1,16 +1,16 @@-//! Headless screenshot of the real PrintCraft shell (egui_kittest + wgpu, no window needed).+//! Headless screenshot of the real PdfCraft shell (egui_kittest + wgpu, no window needed).//!//! ```text-//! cargo run -p printcraft-ui-egui --example shot -- out.png [file.pdf] [--size 1440x900] [--scale 2] [--page 3 --panel pages …]+//! cargo run -p pdfcraft-ui-egui --example shot -- out.png [file.pdf] [--size 1440x900] [--scale 2] [--page 3 --panel pages …]//! ```//! `--width N` downscales the image to N pixels wide (README screenshots). Any other-//! `--key value` pair is passed to `PrintCraftApp::set_option`+//! `--key value` pair is passed to `PdfCraftApp::set_option`//! (the same verbs as the desktop app's command-line flags and the future control channel).use std::time::{Duration, Instant};use egui_kittest::Harness;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;fn main() -> Result<(), String> {let mut args = std::env::args().skip(1);@@ -32,7 +32,7 @@ fn main() -> Result<(), String> {}}let mut harness = Harness::builder().with_size(size).with_pixels_per_point(scale).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();if let Some(f) = &file {let bytes = std::fs::read(f).unwrap_or_default();let name = std::path::Path::new(f).file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();diff --git a/crates/ui-egui/src/a11y_ui.rs b/crates/ui-egui/src/a11y_ui.rsindex 4d518193f..90317cea9 100644--- a/crates/ui-egui/src/a11y_ui.rs+++ b/crates/ui-egui/src/a11y_ui.rs@@ -5,11 +5,11 @@use std::collections::BTreeSet;use egui::{Align, Layout};-use printcraft_engine::DocId;-use printcraft_engine::a11y::{Category, Options, Report, Rule, Status};+use pdfcraft_engine::DocId;+use pdfcraft_engine::a11y::{Category, Options, Report, Rule, Status};use crate::theme::{self, Tokens};-use crate::{Dialog, PrintCraftApp, PropsTab, RightPanel, icons, widgets};+use crate::{Dialog, PdfCraftApp, PropsTab, RightPanel, icons, widgets};/// The options dialog's settings (kept for the session, like Acrobat's).#[derive(Clone, Debug, PartialEq)]@@ -67,7 +67,7 @@ pub(crate) fn fixable(rule: Rule) -> bool {matches!(rule, Rule::PrimaryLanguage | Rule::Title | Rule::TabOrder)}-pub(crate) fn options_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn options_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {let pages = app.active_ids().and_then(|(_, id)| app.session.get(id)).map_or(1, |d| d.info.pages.len().max(1));let o = &mut app.a11y_options;o.to = o.to.clamp(1, pages);@@ -283,7 +283,7 @@ pub(crate) fn panel(ui: &mut egui::Ui, t: &Tokens, state: &mut A11yState, doc: Daction}-impl PrintCraftApp {+impl PdfCraftApp {/// Check for accessibility: the options first, unless they are turned off.pub(crate) fn start_accessibility_check(&mut self) {if self.a11y_options.show_dialog {@@ -336,7 +336,7 @@ impl PrintCraftApp {let Some((_, report)) = self.a11y.report.as_ref().filter(|(d, _)| *d == id) else { return };let Some(doc) = self.session.get(id) else { return };let (y, m, d) = self.session.today();- let html = printcraft_engine::a11y::report_html(report, &doc.name, &format!("{y}-{m:02}-{d:02}"));+ let html = pdfcraft_engine::a11y::report_html(report, &doc.name, &format!("{y}-{m:02}-{d:02}"));let stem = doc.name.trim_end_matches(".pdf").trim_end_matches(".PDF").to_string();self.write_files(&[(format!("{stem} Accessibility Report.html"), std::sync::Arc::new(html.into_bytes()))], "Save the accessibility report");}@@ -387,7 +387,7 @@ impl PrintCraftApp {#[derive(Clone, Default)]pub struct AltDraft {pub doc: Option<DocId>,- pub figures: Vec<printcraft_engine::a11y::Figure>,+ pub figures: Vec<pdfcraft_engine::a11y::Figure>,pub index: usize,pub texts: Vec<String>,pub decorative: Vec<bool>,@@ -402,22 +402,22 @@ impl std::fmt::Debug for AltDraft {}/// Render a figure's area for the dialog (at most 360 × 220 px).-fn figure_picture(ctx: &egui::Context, doc: &printcraft_engine::Document, f: &printcraft_engine::a11y::Figure) -> Option<egui::TextureHandle> {+fn figure_picture(ctx: &egui::Context, doc: &pdfcraft_engine::Document, f: &pdfcraft_engine::a11y::Figure) -> Option<egui::TextureHandle> {let (page, b) = (f.page?, f.bbox?);let info = doc.info.pages.get(page)?;let (u, v) = (info.user_to_view(b[0] as f32, b[1] as f32), info.user_to_view(b[2] as f32, b[3] as f32));let (x0, y0, x1, y1) = (u[0].min(v[0]), u[1].min(v[1]), u[0].max(v[0]), u[1].max(v[1]));let (w, h) = ((x1 - x0).max(1.0), (y1 - y0).max(1.0));let scale = (360.0 / w).min(220.0 / h).clamp(0.05, 8.0);- let tile = printcraft_render::Tile {+ let tile = pdfcraft_render::Tile {x: (x0 * scale).floor().max(0.0) as u32,y: (y0 * scale).floor().max(0.0) as u32,w: (w * scale).ceil().max(1.0) as u32,h: (h * scale).ceil().max(1.0) as u32,};- let config = printcraft_render::RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..Default::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);- let out = r.render(printcraft_render::RenderRequest { page, kind: printcraft_render::RequestKind::Pixels, tile: Some(tile), scale, tag: 0 });+ let config = pdfcraft_render::RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..Default::default() };+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let out = r.render(pdfcraft_render::RenderRequest { page, kind: pdfcraft_render::RequestKind::Pixels, tile: Some(tile), scale, tag: 0 });if out.error.is_some() || out.width == 0 {return None;}@@ -425,7 +425,7 @@ fn figure_picture(ctx: &egui::Context, doc: &printcraft_engine::Document, f: &prSome(ctx.load_texture("alt-figure", img, egui::TextureOptions::LINEAR))}-pub(crate) fn alt_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn alt_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {let ctx = ui.ctx().clone();let doc = app.alt_draft.doc.and_then(|id| app.session.get(id));let d = &mut app.alt_draft;@@ -489,7 +489,7 @@ pub(crate) fn alt_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -(save, cancel)}-impl PrintCraftApp {+impl PdfCraftApp {/// Prepare for accessibility ▸ Add alternate text.pub(crate) fn start_alt_text(&mut self) {let Some((_, id)) = self.active_ids() else { return };@@ -512,13 +512,13 @@ impl PrintCraftApp {let mut edits = Vec::new();for (k, f) in d.figures.iter().enumerate() {if d.decorative[k] {- edits.push(printcraft_engine::Edit::MarkDecorative { figure: f.obj.num });+ edits.push(pdfcraft_engine::Edit::MarkDecorative { figure: f.obj.num });} else if d.texts[k].trim() != f.alt.as_deref().unwrap_or("").trim() {- edits.push(printcraft_engine::Edit::SetAltText { figure: f.obj.num, alt: Some(d.texts[k].clone()) });+ edits.push(pdfcraft_engine::Edit::SetAltText { figure: f.obj.num, alt: Some(d.texts[k].clone()) });}}if !edits.is_empty() {- self.apply_edit(printcraft_engine::Edit::Batch { label: "Set alternate text".into(), edits });+ self.apply_edit(pdfcraft_engine::Edit::Batch { label: "Set alternate text".into(), edits });}}}diff --git a/crates/ui-egui/src/actions_ui.rs b/crates/ui-egui/src/actions_ui.rsindex 04058551c..7e78a2406 100644--- a/crates/ui-egui/src/actions_ui.rs+++ b/crates/ui-egui/src/actions_ui.rs@@ -1,13 +1,13 @@-//! Action Wizard: the actions (PrintCraft's and your own), running one over files in the+//! Action Wizard: the actions (PdfCraft's and your own), running one over files in the//! background, and creating or editing an action's steps. Your actions are remembered.use std::sync::{Arc, Mutex};use egui::{Align, Layout};-use printcraft_engine::actions::{Action, Step, builtin};+use pdfcraft_engine::actions::{Action, Step, builtin};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};/// The Action Wizard's state.#[derive(Clone, Debug, Default, PartialEq)]@@ -28,7 +28,7 @@ pub struct RunProgress {pub message: Option<String>,}-impl PrintCraftApp {+impl PdfCraftApp {/// Built-in actions, then the user's.pub fn all_actions(&self) -> Vec<Action> {let mut v = builtin();@@ -58,7 +58,7 @@ impl PrintCraftApp {if let Ok(mut s) = p.lock() {s.done = i;}- let r = printcraft_engine::actions::run_on(&action, &name, Arc::new(bytes), |_, _| {}).and_then(|r| {+ let r = pdfcraft_engine::actions::run_on(&action, &name, Arc::new(bytes), |_, _| {}).and_then(|r| {#[cfg(not(target_arch = "wasm32"))]crate::editing::write_atomically(&dir.join(&name).to_string_lossy(), &r.bytes).map_err(|e| e.to_string())?;#[cfg(target_arch = "wasm32")]@@ -83,7 +83,7 @@ impl PrintCraftApp {if self.run_inline {work();} else {- std::thread::Builder::new().name("printcraft-action".into()).spawn(work).ok();+ std::thread::Builder::new().name("pdfcraft-action".into()).spawn(work).ok();}#[cfg(target_arch = "wasm32")]work();@@ -177,7 +177,7 @@ pub fn decode(v: &serde_json::Value) -> Vec<Action> {}/// The Action Wizard dialog. Returns `true` to close.-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {if app.wizard.editing.is_some() {return edit_body(ui, app, t);}@@ -245,7 +245,7 @@ pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> boclose}-fn edit_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+fn edit_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {let Some((original, a)) = app.wizard.editing.as_mut() else { return false };ui.label(egui::RichText::new(if original.is_some() { "Edit Action" } else { "New Action" }).font(theme::semibold(18.0)));ui.add_space(8.0);diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex d75ced886..e939c2a5c 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -9,11 +9,11 @@ use std::ops::Range;use std::sync::Arc;use egui::{Align2, Color32, CornerRadius, Pos2, Rect, Sense, Stroke, TextureHandle, TextureOptions, Vec2, pos2, vec2};-use printcraft_engine::{DocId, Edit};-use printcraft_render::{DocInfo, LinkTarget, PageText, RenderPool, RenderRequest, RequestKind, Tile};+use pdfcraft_engine::{DocId, Edit};+use pdfcraft_render::{DocInfo, LinkTarget, PageText, RenderPool, RenderRequest, RequestKind, Tile};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, QuickTool, RightPanel, comments, icons, widgets};+use crate::{PdfCraftApp, QuickTool, RightPanel, comments, icons, widgets};/// Logical pixels per PDF point at 100% (96 dpi, like browsers).pub const PT: f32 = 96.0 / 72.0;@@ -141,10 +141,10 @@ pub struct DocView {pub pending_edit: Option<Edit>,/// Edit text: the lines per page (with the document generation they were read at), and the/// line being edited.- pub(crate) edit_lines: HashMap<usize, (u64, Vec<printcraft_engine::TextBlock>)>,+ pub(crate) edit_lines: HashMap<usize, (u64, Vec<pdfcraft_engine::TextBlock>)>,pub line_editor: Option<crate::edit_text_ui::LineEditor>,/// Edit text & images: the images per page (by document generation), and the selected one.- pub(crate) edit_images: HashMap<usize, (u64, Vec<printcraft_engine::PageImage>)>,+ pub(crate) edit_images: HashMap<usize, (u64, Vec<pdfcraft_engine::PageImage>)>,pub image_selection: Option<crate::edit_text_ui::ImageSelection>,/// A paragraph box being dragged (moved, or resized from its right edge) in Edit text.pub block_drag: Option<crate::edit_text_ui::BlockDrag>,@@ -566,7 +566,7 @@ impl DocView {}/// Displayed page size in points for this view rotation.- fn display_size(&self, p: &printcraft_render::PageInfo) -> (f32, f32) {+ fn display_size(&self, p: &pdfcraft_render::PageInfo) -> (f32, f32) {if self.rotation % 180 == 90 { (p.height, p.width) } else { (p.width, p.height) }}@@ -713,7 +713,7 @@ impl DocView {}PageLayout::TwoUp => {// With a cover page, the first page sits alone on the right.- let rows: Vec<&[printcraft_render::PageInfo]> = if self.cover && !info.pages.is_empty() {+ let rows: Vec<&[pdfcraft_render::PageInfo]> = if self.cover && !info.pages.is_empty() {std::iter::once(&info.pages[..1]).chain(info.pages[1..].chunks(2)).collect()} else {info.pages.chunks(2).collect()@@ -898,7 +898,7 @@ pub fn shortcuts(view: &mut DocView, ctx: &egui::Context) {}}-pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {+pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());// The Search panel closed: its search moves to the find bar.let search_open = app.right == Some(crate::RightPanel::Search);@@ -1176,11 +1176,11 @@ pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {let corners = [(vx as f64 - w / 2.0, vy as f64 - h / 2.0), (vx as f64 + w / 2.0, vy as f64 + h / 2.0)];let u: Vec<[f32; 2]> = corners.iter().map(|(x, y)| info.pages[i].view_to_user(*x as f32, *y as f32)).collect();let rect = [u[0][0].min(u[1][0]) as f64, u[0][1].min(u[1][1]) as f64, u[0][0].max(u[1][0]) as f64, u[0][1].max(u[1][1]) as f64];- let by = (kind.group() == printcraft_engine::StampGroup::Dynamic).then(|| by_line.clone());- let shape = printcraft_engine::Shape::Stamp { rect, stamp: kind, by };- view.pending_edit = Some(printcraft_engine::Edit::AddAnnotation(printcraft_engine::NewAnnotation {+ let by = (kind.group() == pdfcraft_engine::StampGroup::Dynamic).then(|| by_line.clone());+ let shape = pdfcraft_engine::Shape::Stamp { rect, stamp: kind, by };+ view.pending_edit = Some(pdfcraft_engine::Edit::AddAnnotation(pdfcraft_engine::NewAnnotation {page: i,- style: printcraft_engine::Style::default_for(&shape),+ style: pdfcraft_engine::Style::default_for(&shape),shape,contents: String::new(),author: author.clone(),@@ -1198,11 +1198,11 @@ pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {let (vx, vy) = xf.screen_to_view(p);let u = info.pages[i].view_to_user(vx, vy);let (x, y) = (u[0] as f64, u[1] as f64);- view.pending_edit = Some(printcraft_engine::Edit::AddCustomStamp {+ view.pending_edit = Some(pdfcraft_engine::Edit::AddCustomStamp {page: i,rect: [x, y, x, y],name: cs.name.clone(),- file: printcraft_engine::MarkFile { name: cs.file.clone(), bytes: cs.data.clone(), page: cs.page },+ file: pdfcraft_engine::MarkFile { name: cs.file.clone(), bytes: cs.data.clone(), page: cs.page },author: author.clone(),});stamp_placed = true;@@ -1370,7 +1370,7 @@ pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {// red border.if view.highlight_fields {for f in form.iter() {- let required = f.has(printcraft_engine::field_flags::REQUIRED);+ let required = f.has(pdfcraft_engine::field_flags::REQUIRED);for w in f.widgets.iter().filter(|w| w.page == Some(i)) {let r = w.rect;let sr = xf.user_rect(info, i, [r[0] as f32, r[1] as f32, r[2] as f32, r[3] as f32]);@@ -1563,7 +1563,7 @@ pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {}let form_notice = view.forms.notice.take();// One crop, then back to selecting (as Acrobat does).- let cropped = view.pending_edit.as_ref().is_some_and(|e| matches!(e, printcraft_engine::Edit::SetPageBox { .. }));+ let cropped = view.pending_edit.as_ref().is_some_and(|e| matches!(e, pdfcraft_engine::Edit::SetPageBox { .. }));let mut tool = app.quick_tool;comments::keys(ui.ctx(), view, &mut tool, allowed);if preparing {@@ -1658,9 +1658,9 @@ pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {app.views[index].pending_edit = Some(if app.quick_tool == QuickTool::Comment(comments::CommentTool::Highlight) {// An area highlight: a highlight over the box.let style = app.comment_prefs.style(comments::CommentTool::Highlight);- printcraft_engine::Edit::AddAnnotation(printcraft_engine::NewAnnotation {+ pdfcraft_engine::Edit::AddAnnotation(pdfcraft_engine::NewAnnotation {page,- shape: printcraft_engine::Shape::TextMarkup { kind: printcraft_engine::Markup::Highlight, quads },+ shape: pdfcraft_engine::Shape::TextMarkup { kind: pdfcraft_engine::Markup::Highlight, quads },style,contents: String::new(),author,@@ -1693,8 +1693,8 @@ pub fn document_area(app: &mut PrintCraftApp, index: usize, ui: &mut egui::Ui) {}/// Run a push button's action (the ones that need no JavaScript engine).-fn run_button(app: &mut PrintCraftApp, index: usize, ctx: &egui::Context, name: &str, action: printcraft_engine::form_scripts::ButtonAction) {- use printcraft_engine::form_scripts::ButtonAction as B;+fn run_button(app: &mut PdfCraftApp, index: usize, ctx: &egui::Context, name: &str, action: pdfcraft_engine::form_scripts::ButtonAction) {+ use pdfcraft_engine::form_scripts::ButtonAction as B;let pages = app.session.get(app.views[index].id).map_or(0, |d| d.info.pages.len());match action {B::Reset { fields, exclude } => {@@ -1706,7 +1706,7 @@ fn run_button(app: &mut PrintCraftApp, index: usize, ctx: &egui::Context, name:(false, true) => Some(all.iter().filter(|n| !listed(n)).cloned().collect()),};app.views[index].forms.focus = None;- app.views[index].pending_edit = Some(printcraft_engine::Edit::ResetForm { names });+ app.views[index].pending_edit = Some(pdfcraft_engine::Edit::ResetForm { names });}B::Named(n) => match n.as_str() {"Print" => app.open_print(),@@ -1720,7 +1720,7 @@ fn run_button(app: &mut PrintCraftApp, index: usize, ctx: &egui::Context, name:B::GoTo(p) => app.views[index].go_to_page(p.min(pages.saturating_sub(1))),B::Alert(m) => app.notify(m),B::Submit(url) => {- app.notify(format!("{name} submits the form to {url}; PrintCraft doesn't send form data. Save the document to keep your entries."))+ app.notify(format!("{name} submits the form to {url}; PdfCraft doesn't send form data. Save the document to keep your entries."))}B::ImportIcon => app.choose_field_image(name),B::Script(js) => {@@ -1859,16 +1859,16 @@ fn notices(let mut open_repairs = false;let msg = if secured {Some(("lock", "This document is secured. Some changes are restricted by its security settings.".to_string(), false))- } else if info.xfa == Some(printcraft_render::Xfa::Dynamic) {+ } else if info.xfa == Some(pdfcraft_render::Xfa::Dynamic) {Some(("triangle-alert",- "This is a dynamic XFA form, which PrintCraft can't display yet. What you see is the file's placeholder page.".to_string(),+ "This is a dynamic XFA form, which PdfCraft can't display yet. What you see is the file's placeholder page.".to_string(),false,))- } else if info.xfa == Some(printcraft_render::Xfa::Static) {+ } else if info.xfa == Some(pdfcraft_render::Xfa::Static) {Some(("triangle-alert",- "This form also contains XFA data, which PrintCraft doesn't read yet. You can fill its fields, but Acrobat may show the XFA values instead.".to_string(),+ "This form also contains XFA data, which PdfCraft doesn't read yet. You can fill its fields, but Acrobat may show the XFA values instead.".to_string(),true,))} else if !info.fields.is_empty() {@@ -1911,7 +1911,7 @@ fn notices(}/// The floating quick-action bar at the left edge of the document area.-fn quick_bar(app: &mut PrintCraftApp, area: Rect, ui: &mut egui::Ui) {+fn quick_bar(app: &mut PdfCraftApp, area: Rect, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());let pos = area.left_top() + vec2(14.0, 14.0);egui::Area::new(egui::Id::new("quick-bar")).order(egui::Order::Middle).fixed_pos(pos).show(ui.ctx(), |ui| {@@ -2094,7 +2094,7 @@ fn organize_toolbar(view: &mut DocView, info: &DocInfo, editable: bool, ui: &mut// selection in Organize Pages).let sel = icons::button(ui, "list", 30.0, false, "Select pages");egui::Popup::menu(&sel).show(|ui| {- use printcraft_engine::{PageOrientation as O, PageParity as P, filter_pages};+ use pdfcraft_engine::{PageOrientation as O, PageParity as P, filter_pages};let all: Vec<usize> = (0..n).collect();for (label, parity, orient) in [("All pages", P::Both, O::Both),diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rsindex cb7376003..71b347604 100644--- a/crates/ui-egui/src/chrome.rs+++ b/crates/ui-egui/src/chrome.rs@@ -4,9 +4,9 @@ use egui::{Align, Align2, Color32, CornerRadius, Layout, Rect, Sense, Stroke, veuse crate::canvas::{Fit, PageLayout};use crate::theme::{self, ThemeKind, Tokens};-use crate::{Dialog, Mode, PrintCraftApp, PropsTab, RightPanel, icons, widgets};+use crate::{Dialog, Mode, PdfCraftApp, PropsTab, RightPanel, icons, widgets};-pub fn tab_strip(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+pub fn tab_strip(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());let left = if cfg!(target_os = "macos") && app.integrated_titlebar { 80 } else { 8 };egui::Panel::top("tab_strip")@@ -55,7 +55,7 @@ pub fn tab_strip(app: &mut PrintCraftApp, ui: &mut egui::Ui) {app.dialog = Some(Dialog::Shortcuts);}// One click to the community, from anywhere in the app.- if widgets::ghost_button(ui, "messages-square", "Discord").on_hover_text(printcraft_engine::links::DISCORD).clicked() {+ if widgets::ghost_button(ui, "messages-square", "Discord").on_hover_text(pdfcraft_engine::links::DISCORD).clicked() {app.execute("help.discord");}});@@ -103,7 +103,7 @@ fn tab(ui: &mut egui::Ui, t: &Tokens, name: &str, dirty: bool, active: bool, cloresp.on_hover_text(if dirty { format!("{name} — unsaved changes") } else { name.to_string() })}-pub fn mode_bar(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+pub fn mode_bar(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());egui::Panel::top("mode_bar").exact_size(48.0)@@ -152,7 +152,7 @@ pub fn mode_bar(app: &mut PrintCraftApp, ui: &mut egui::Ui) {});}-fn main_menu(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+fn main_menu(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let language = app.language;let t = Tokens::get(ui.ctx());let resp = widgets::ghost_button(ui, "panel-left", language.tr("Menu"));@@ -256,7 +256,7 @@ fn main_menu(app: &mut PrintCraftApp, ui: &mut egui::Ui) {});}-pub fn right_rail(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+pub fn right_rail(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());let Some((index, id)) = app.active_ids() else { return };let Some(doc) = app.session.get(id) else { return };diff --git a/crates/ui-egui/src/combine_ui.rs b/crates/ui-egui/src/combine_ui.rsindex 3f168c784..6466e8d28 100644--- a/crates/ui-egui/src/combine_ui.rs+++ b/crates/ui-egui/src/combine_ui.rs@@ -6,7 +6,7 @@ use std::sync::Arc;use egui::{Align, Layout};use crate::theme::{self, Tokens};-use crate::{Dialog, PrintCraftApp, icons, widgets};+use crate::{Dialog, PdfCraftApp, icons, widgets};#[derive(Clone, Debug)]pub struct CombineFile {@@ -23,7 +23,7 @@ enum RowAction {Remove(usize),}-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {ui.label(egui::RichText::new("Combine files").font(theme::semibold(18.0)));ui.add_space(4.0);ui.label(egui::RichText::new("Files are combined in this order. Leave Pages empty to take every page.").small().color(t.text_faint));@@ -88,12 +88,12 @@ pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (b(go, cancel)}-impl PrintCraftApp {+impl PdfCraftApp {/// Add picked files to the Combine files list (and show it).pub(crate) fn stage_combine(&mut self, files: Vec<(String, Vec<u8>)>) {for (name, bytes) in files {let bytes = Arc::new(bytes);- match printcraft_render::inspect(bytes.clone(), None) {+ match pdfcraft_render::inspect(bytes.clone(), None) {Ok(info) => self.combine_draft.push(CombineFile { name, bytes, pages: info.pages.len(), range: String::new() }),Err(e) => self.notify(format!("Couldn't add {name}: {e}")),}diff --git a/crates/ui-egui/src/commands.rs b/crates/ui-egui/src/commands.rsindex c1a0e8b53..276f9c032 100644--- a/crates/ui-egui/src/commands.rs+++ b/crates/ui-egui/src/commands.rs@@ -1,15 +1,15 @@-//! What each registered command does in this frontend (`printcraft_engine::commands` says+//! What each registered command does in this frontend (`pdfcraft_engine::commands` says//! what it is called, where it appears, which key runs it and when it is enabled).//!//! Menus, keyboard shortcuts, the palette, the tool panels and automation (`set_option`, and-//! the control channel later) all call `PrintCraftApp::execute`.+//! the control channel later) all call `PdfCraftApp::execute`.-use printcraft_engine::Edit;-use printcraft_engine::commands::{self, COMMANDS, CommandSpec};+use pdfcraft_engine::Edit;+use pdfcraft_engine::commands::{self, COMMANDS, CommandSpec};-use crate::{Dialog, Mode, PrintCraftApp, PropsTab, RightPanel, SaveTarget, theme::ThemeKind, widgets};+use crate::{Dialog, Mode, PdfCraftApp, PropsTab, RightPanel, SaveTarget, theme::ThemeKind, widgets};-impl PrintCraftApp {+impl PdfCraftApp {pub(crate) fn command_enabled(&self, spec: &CommandSpec) -> bool {commands::is_enabled(spec, &self.session, self.active_ids().map(|(_, id)| id))}@@ -20,7 +20,7 @@ impl PrintCraftApp {/// Last-resort guard (AGENTS.md §4): a command that panics is reported and the app, with its/// open documents, keeps running. Edits are applied to a copy, so the document is unchanged.pub fn execute(&mut self, id: &str) -> bool {- match printcraft_engine::guard(|| self.execute_unguarded(id)) {+ match pdfcraft_engine::guard(|| self.execute_unguarded(id)) {Ok(done) => done,Err(m) => {self.notify(format!("That didn't work: an internal error stopped it ({m}). Your documents are unchanged."));@@ -44,9 +44,9 @@ impl PrintCraftApp {commands::Needs::Marks(k) if self.active.is_some() => format!("This document has no {} to change",match k {- printcraft_engine::MarkKind::HeaderFooter => "header or footer",- printcraft_engine::MarkKind::Watermark => "watermark",- printcraft_engine::MarkKind::Background => "background",+ pdfcraft_engine::MarkKind::HeaderFooter => "header or footer",+ pdfcraft_engine::MarkKind::Watermark => "watermark",+ pdfcraft_engine::MarkKind::Background => "background",}),commands::Needs::Security | commands::Needs::ProtectedSecurity if self.active.is_some() => {@@ -102,8 +102,8 @@ impl PrintCraftApp {}self.dialog = Some(Dialog::NumberPages);}- link if printcraft_engine::links::for_command(link).is_some() => {- if let Some(l) = printcraft_engine::links::for_command(link) {+ link if pdfcraft_engine::links::for_command(link).is_some() => {+ if let Some(l) = pdfcraft_engine::links::for_command(link) {self.open_url(l.url);}}@@ -149,14 +149,8 @@ impl PrintCraftApp {self.views[i].clear_selection();let style = self.comment_prefs.style(tool);let author = self.comment_prefs.author.clone();- let shape = printcraft_engine::Shape::TextMarkup { kind, quads };- self.apply_edit(Edit::AddAnnotation(printcraft_engine::NewAnnotation {- page,- shape,- style,- contents: String::new(),- author,- }));+ let shape = pdfcraft_engine::Shape::TextMarkup { kind, quads };+ self.apply_edit(Edit::AddAnnotation(pdfcraft_engine::NewAnnotation { page, shape, style, contents: String::new(), author }));}}}@@ -206,7 +200,7 @@ impl PrintCraftApp {| "edit.header_footer.update"| "edit.watermark.update"| "edit.background.update" => {- use printcraft_engine::MarkKind as K;+ use pdfcraft_engine::MarkKind as K;let kind = if id.starts_with("edit.header_footer") {K::HeaderFooter} else if id.starts_with("edit.watermark") {@@ -225,10 +219,10 @@ impl PrintCraftApp {self.marks_draft.hf.text[5] = "<<Bates Number#6#1##>>".into();}self.marks_draft.focused_box = 5;- self.dialog = Some(Dialog::Marks(printcraft_engine::MarkKind::HeaderFooter));+ self.dialog = Some(Dialog::Marks(pdfcraft_engine::MarkKind::HeaderFooter));}"edit.header_footer.remove" | "edit.watermark.remove" | "edit.background.remove" => {- use printcraft_engine::MarkKind as K;+ use pdfcraft_engine::MarkKind as K;let kind = match id {"edit.header_footer.remove" => K::HeaderFooter,"edit.watermark.remove" => K::Watermark,@@ -323,9 +317,9 @@ impl PrintCraftApp {}"form.tab_order.row" | "form.tab_order.column" | "form.tab_order.structure" => {let order = match id {- "form.tab_order.row" => printcraft_engine::TabOrder::Row,- "form.tab_order.column" => printcraft_engine::TabOrder::Column,- _ => printcraft_engine::TabOrder::Structure,+ "form.tab_order.row" => pdfcraft_engine::TabOrder::Row,+ "form.tab_order.column" => pdfcraft_engine::TabOrder::Column,+ _ => pdfcraft_engine::TabOrder::Structure,};let n = active.and_then(|i| self.session.get(self.views[i].id)).map_or(0, |d| d.info.pages.len());self.apply_edit(Edit::SetTabOrder { pages: (0..n).collect(), order });@@ -379,9 +373,9 @@ impl PrintCraftApp {}"form.export_data" => self.export_data_dialog(false, true),"form.merge_data" => self.merge_data_dialog(),- "export.docx" => self.export_office_dialog(printcraft_engine::compare::OfficeFormat::Docx),- "export.html" => self.export_office_dialog(printcraft_engine::compare::OfficeFormat::Html),- "export.rtf" => self.export_office_dialog(printcraft_engine::compare::OfficeFormat::Rtf),+ "export.docx" => self.export_office_dialog(pdfcraft_engine::compare::OfficeFormat::Docx),+ "export.html" => self.export_office_dialog(pdfcraft_engine::compare::OfficeFormat::Html),+ "export.rtf" => self.export_office_dialog(pdfcraft_engine::compare::OfficeFormat::Rtf),"form.prepare" => {self.left = crate::LeftPanel::Tool("form");self.left_open = true;@@ -496,7 +490,7 @@ impl PrintCraftApp {}/// Render a top-level menu's registered commands (with live labels, shortcuts and enablement).-pub(crate) fn registry_menu(app: &mut PrintCraftApp, ui: &mut egui::Ui, menu: &str) {+pub(crate) fn registry_menu(app: &mut PdfCraftApp, ui: &mut egui::Ui, menu: &str) {let mac = cfg!(target_os = "macos") || cfg!(target_arch = "wasm32");for spec in commands::menu(menu) {let label = commands::current_label(spec, &app.session, app.active_ids().map(|(_, id)| id));diff --git a/crates/ui-egui/src/comment_props.rs b/crates/ui-egui/src/comment_props.rsindex 2bffc6ccc..8468feff8 100644--- a/crates/ui-egui/src/comment_props.rs+++ b/crates/ui-egui/src/comment_props.rs@@ -3,11 +3,11 @@//! subject, modified) and Review History (status changes), with Acrobat's Locked box.use egui::{Align, Layout};-use printcraft_engine::{CommentProps, Edit, NoteIcon};+use pdfcraft_engine::{CommentProps, Edit, NoteIcon};use crate::comments::swatch_grid;use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum PropsTab {@@ -28,7 +28,7 @@ pub struct PropsDraft {const ICONS: [NoteIcon; 7] =[NoteIcon::Comment, NoteIcon::Note, NoteIcon::Help, NoteIcon::Insert, NoteIcon::Key, NoteIcon::NewParagraph, NoteIcon::Paragraph];-impl PrintCraftApp {+impl PdfCraftApp {/// Attach file: ask for a file (or take `attach_override`) and attach it at `at`.pub fn attach_file_comment(&mut self, page: usize, at: [f64; 2]) {let picked = match self.attach_override.take() {@@ -43,8 +43,8 @@ impl PrintCraftApp {};let Some((file, data)) = picked else { return };let tool = crate::comments::CommentTool::Attach;- let shape = printcraft_engine::Shape::Attachment { at, icon: printcraft_engine::AttachIcon::PushPin, file, data };- let edit = Edit::AddAnnotation(printcraft_engine::NewAnnotation {+ let shape = pdfcraft_engine::Shape::Attachment { at, icon: pdfcraft_engine::AttachIcon::PushPin, file, data };+ let edit = Edit::AddAnnotation(pdfcraft_engine::NewAnnotation {page,shape,style: self.comment_prefs.style(tool),@@ -114,7 +114,7 @@ pub fn edits(d: &PropsDraft) -> Vec<Edit> {}/// Draw the dialog; returns (apply, cancel).-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {let history: Vec<(String, String, String)> = app.active_ids().and_then(|(_, id)| app.session.get(id))@@ -188,7 +188,7 @@ pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bui.add(egui::TextEdit::singleline(&mut e.subject).desired_width(280.0)).labelled_by(l.id);ui.end_row();ui.label("Modified");- ui.label(e.modified.as_deref().map(printcraft_render::pretty_date).unwrap_or_else(|| "—".into()));+ ui.label(e.modified.as_deref().map(pdfcraft_render::pretty_date).unwrap_or_else(|| "—".into()));ui.end_row();});}diff --git a/crates/ui-egui/src/comments.rs b/crates/ui-egui/src/comments.rsindex fe75ba968..d1a093abd 100644--- a/crates/ui-egui/src/comments.rs+++ b/crates/ui-egui/src/comments.rs@@ -9,12 +9,12 @@//! Reply, Set status, Colour and Delete.//! - **Composer:** the floating "Add a comment" card used for new notes, text boxes and edits.//!-//! Everything is turned into `printcraft_engine::Edit`s, queued on the view as `pending_edit` and+//! Everything is turned into `pdfcraft_engine::Edit`s, queued on the view as `pending_edit` and//! applied by the app, so each change is one undo step.use egui::{Color32, CornerRadius, Pos2, Rect, Sense, Stroke, pos2, vec2};-use printcraft_engine::{Edit, Markup, NewAnnotation, NoteIcon, ReviewState, Rgb, Shape, Style};-use printcraft_render::{Annotation, DocInfo};+use pdfcraft_engine::{Edit, Markup, NewAnnotation, NoteIcon, ReviewState, Rgb, Shape, Style};+use pdfcraft_render::{Annotation, DocInfo};use crate::canvas::{DocView, PageXform};use crate::theme::{self, Tokens};@@ -211,7 +211,7 @@ impl CommentTool {Self::Caret => Shape::Caret { rect: [0.0; 4] },Self::ReplaceText => Shape::TextMarkup { kind: Markup::StrikeOut, quads: Vec::new() },Self::Eraser => Shape::Ink { strokes: Vec::new() },- Self::Attach => Shape::Attachment { at: [0.0; 2], icon: printcraft_engine::AttachIcon::PushPin, file: String::new(), data: Vec::new() },+ Self::Attach => Shape::Attachment { at: [0.0; 2], icon: pdfcraft_engine::AttachIcon::PushPin, file: String::new(), data: Vec::new() },}}}@@ -1115,7 +1115,7 @@ pub(crate) fn composer(ctx: &egui::Context, view: &mut DocView, info: &DocInfo,/// A text box sized to its text (at most 300 pt wide), hanging from its top-left corner.pub fn text_box_rect(at: [f64; 2], text: &str, size: f64) -> [f64; 4] {- use printcraft_engine::annot_text::{text_width, wrap};+ use pdfcraft_engine::annot_text::{text_width, wrap};let pad = 2.0;let longest = text.lines().map(|l| text_width(l, size)).fold(0.0, f64::max);let w = (longest + 2.0 * pad + 4.0).clamp(40.0, 300.0);@@ -1186,8 +1186,7 @@ pub(crate) fn context_menu(ui: &mut egui::Ui, view: &mut DocView, info: &DocInfo}});});- let thread: Vec<&printcraft_render::Annotation> =- info.annotations.iter().filter(|r| a.name.is_some() && r.in_reply_to == a.name).collect();+ let thread: Vec<&pdfcraft_render::Annotation> = info.annotations.iter().filter(|r| a.name.is_some() && r.in_reply_to == a.name).collect();let marked = crate::comments_panel::is_marked(&thread);if ui.add_enabled(allowed, egui::Button::new(if marked { "Remove checkmark" } else { "Mark with checkmark" })).clicked() {action = Some(CanvasAction::Edit(Box::new(Edit::MarkAnnotation { page, index, marked: !marked, author: prefs.author.clone() })));@@ -1317,7 +1316,7 @@ mod tests {fn tools_round_trip_through_their_commands() {for t in ALL {assert_eq!(CommentTool::from_command(t.command()), Some(t));- assert!(printcraft_engine::commands::command(t.command()).is_some(), "{} is registered", t.command());+ assert!(pdfcraft_engine::commands::command(t.command()).is_some(), "{} is registered", t.command());assert!(icons::exists(t.icon()), "icon {}", t.icon());assert!(GROUPS[t.group()].contains(&t));}diff --git a/crates/ui-egui/src/comments_panel.rs b/crates/ui-egui/src/comments_panel.rsindex e5a66905d..b86b7aa49 100644--- a/crates/ui-egui/src/comments_panel.rs+++ b/crates/ui-egui/src/comments_panel.rs@@ -5,8 +5,8 @@//! opens its reply box and "…" menu (Edit, Set status, Delete). Status replies show as a badge.use egui::{Align, Color32, CornerRadius, Layout, Sense, Stroke, vec2};-use printcraft_engine::{Edit, NoteIcon, ReviewState, Shape};-use printcraft_render::{Annotation, DocInfo};+use pdfcraft_engine::{Edit, NoteIcon, ReviewState, Shape};+use pdfcraft_render::{Annotation, DocInfo};use crate::canvas::DocView;use crate::comments::{CommentPrefs, CommentTool, SortBy, color32, status_badge};@@ -128,7 +128,7 @@ pub(crate) fn show(if let Some(p) = info.pages.get(page) {let at = p.view_to_user(p.width - 44.0, 24.0);let text = std::mem::take(&mut view.comments.add_box);- edit = Some(Edit::AddAnnotation(printcraft_engine::NewAnnotation {+ edit = Some(Edit::AddAnnotation(pdfcraft_engine::NewAnnotation {page,shape: Shape::Note { at: [at[0] as f64, at[1] as f64], icon: NoteIcon::Comment },style: prefs.style(CommentTool::Note),diff --git a/crates/ui-egui/src/compare_ui.rs b/crates/ui-egui/src/compare_ui.rsindex 83a395e6a..0f8ff312d 100644--- a/crates/ui-egui/src/compare_ui.rs+++ b/crates/ui-egui/src/compare_ui.rs@@ -3,11 +3,11 @@//! offers a report or the differences as comments.use egui::{Align, Color32, Layout};-use printcraft_engine::DocId;-use printcraft_engine::compare::{Comparison, Kind};+use pdfcraft_engine::DocId;+use pdfcraft_engine::compare::{Comparison, Kind};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, RightPanel, widgets};+use crate::{PdfCraftApp, RightPanel, widgets};/// The last comparison.pub struct CompareState {@@ -31,12 +31,12 @@ pub enum PanelAction {}pub fn colour(kind: Kind) -> Color32 {- let [r, g, b] = printcraft_engine::compare::colour(kind);+ let [r, g, b] = pdfcraft_engine::compare::colour(kind);Color32::from_rgb((r * 255.0) as u8, (g * 255.0) as u8, (b * 255.0) as u8)}/// The Compare Files dialog: pick the older document. Returns (compare, cancel).-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {ui.label(egui::RichText::new("Compare Files").font(theme::semibold(18.0)));ui.add_space(8.0);let Some((_, new)) = app.active_ids() else { return (false, true) };@@ -136,7 +136,7 @@ pub(crate) fn panel(ui: &mut egui::Ui, t: &Tokens, state: &Option<CompareState>,action}-impl PrintCraftApp {+impl PdfCraftApp {/// Compare the chosen older document with the active one and show the differences.pub fn run_compare(&mut self) {let Some((i, new)) = self.active_ids() else { return };diff --git a/crates/ui-egui/src/content_ui.rs b/crates/ui-egui/src/content_ui.rsindex 456e5d082..c852b3ca5 100644--- a/crates/ui-egui/src/content_ui.rs+++ b/crates/ui-egui/src/content_ui.rs@@ -4,8 +4,8 @@//! Delete to remove it. Each change is one undoable engine edit.use egui::{Color32, CornerRadius, Pos2, Rect, Stroke};-use printcraft_engine::{Added, AddedContent, AddedText, Edit, FontFamily, TextAlign};-use printcraft_render::DocInfo;+use pdfcraft_engine::{Added, AddedContent, AddedText, Edit, FontFamily, TextAlign};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};use crate::theme::Tokens;@@ -403,7 +403,7 @@ pub(crate) fn hint(ui: &mut egui::Ui, t: &Tokens) {ui.add_space(4.0);}-impl crate::PrintCraftApp {+impl crate::PdfCraftApp {/// Edit a PDF ▸ Add content ▸ Image: pick a file and place it in the middle of the current page.pub fn add_image_dialog(&mut self) {#[cfg(not(target_arch = "wasm32"))]@@ -449,7 +449,7 @@ impl crate::PrintCraftApp {self.apply_edit(Edit::EditPageImage {page,index,- change: printcraft_engine::ImageEdit::Replace { name, bytes: std::sync::Arc::new(bytes) },+ change: pdfcraft_engine::ImageEdit::Replace { name, bytes: std::sync::Arc::new(bytes) },});}Err(e) => self.notify(format!("Couldn't read {}: {e}", path.display())),@@ -539,18 +539,18 @@ impl crate::PrintCraftApp {/// What the image tools ask for.pub(crate) enum ImageAction {- Update(printcraft_engine::AddedContent),+ Update(pdfcraft_engine::AddedContent),Replace,}/// Edit image: rotate, flip, crop, replace (shown while an added image is selected).-pub(crate) fn image_panel(ui: &mut egui::Ui, t: &Tokens, img: &printcraft_engine::AddedImage) -> Option<ImageAction> {+pub(crate) fn image_panel(ui: &mut egui::Ui, t: &Tokens, img: &pdfcraft_engine::AddedImage) -> Option<ImageAction> {let mut out = None;widgets::section_title(ui, "Edit image");ui.horizontal(|ui| {let mut i = img.clone();let r = i.rect;- let turn = |i: &mut printcraft_engine::AddedImage, k: u8| {+ let turn = |i: &mut pdfcraft_engine::AddedImage, k: u8| {i.rotation = (i.rotation + k) % 4;// The box turns with the picture, around its centre.let (cx, cy, w, h) = ((r[0] + r[2]) / 2.0, (r[1] + r[3]) / 2.0, r[2] - r[0], r[3] - r[1]);diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rsindex ae3a255d4..c644c3609 100644--- a/crates/ui-egui/src/control.rs+++ b/crates/ui-egui/src/control.rs@@ -8,7 +8,7 @@//! - [`ControlPlugin`], an egui plugin, keeps a copy of the AccessKit tree from every frame's//! output (the widget tree with ids, roles, labels, rects and states) and injects queued input//! events (AccessKit click actions, pointer events, keys, text) at the start of later frames.-//! - Requests reach the app through a channel; `PrintCraftApp` answers them at the start of a+//! - Requests reach the app through a channel; `PdfCraftApp` answers them at the start of a//! frame, so they see and change exactly what the user would.//!//! Methods (JSON in, JSON out):@@ -105,7 +105,7 @@ pub struct ControlPlugin {impl egui::Plugin for ControlPlugin {fn debug_name(&self) -> &'static str {- "printcraft-control"+ "pdfcraft-control"}fn input_hook(&mut self, ctx: &egui::Context, input: &mut egui::RawInput) {@@ -163,7 +163,7 @@ pub fn attach(ctx: &egui::Context) -> (Control, ControlClient) {(Control { rx, shared, pending: Vec::new(), next_tag: 1 }, ControlClient { tx, ctx: ctx.clone() })}-/// What a request needs from the app (implemented by `PrintCraftApp`).+/// What a request needs from the app (implemented by `PdfCraftApp`).pub(crate) trait Host {fn state(&self) -> Value;fn command(&mut self, id: &str) -> Reply;@@ -510,7 +510,7 @@ fn screenshot_png(image: &egui::ColorImage, region: Option<egui::Rect>, ppp: f32Ok(json!({ "png_base64": base64::engine::general_purpose::STANDARD.encode(out), "width": cw, "height": ch, "pixels_per_point": ppp }))}-impl Host for crate::PrintCraftApp {+impl Host for crate::PdfCraftApp {fn state(&self) -> Value {let active = self.active.and_then(|i| self.views.get(i));let docs: Vec<Value> = self@@ -571,7 +571,7 @@ impl Host for crate::PrintCraftApp {}fn command(&mut self, id: &str) -> Reply {- let spec = printcraft_engine::commands::command(id).ok_or_else(|| format!("unknown command {id:?} (see ui.commands)"))?;+ let spec = pdfcraft_engine::commands::command(id).ok_or_else(|| format!("unknown command {id:?} (see ui.commands)"))?;if !self.command_enabled(spec) {return Err(format!("{id} is disabled right now"));}@@ -580,7 +580,7 @@ impl Host for crate::PrintCraftApp {}fn commands(&self) -> Value {- let list: Vec<Value> = printcraft_engine::commands::COMMANDS+ let list: Vec<Value> = pdfcraft_engine::commands::COMMANDS.iter().map(|c| json!({ "id": c.id, "label": c.label, "menu": c.menu, "enabled": self.command_enabled(c), "shortcut": c.shortcut.map(|s| s.label(cfg!(target_os = "macos"))) })).collect();@@ -628,11 +628,11 @@ pub fn serve(client: ControlClient) -> std::io::Result<Endpoint> {let port = listener.local_addr()?.port();let token = random_token()?;let expected = token.clone();- std::thread::Builder::new().name("printcraft-control".into()).spawn(move || {+ std::thread::Builder::new().name("pdfcraft-control".into()).spawn(move || {for stream in listener.incoming().flatten() {let client = client.clone();let expected = expected.clone();- let _ = std::thread::Builder::new().name("printcraft-control-conn".into()).spawn(move || {+ let _ = std::thread::Builder::new().name("pdfcraft-control-conn".into()).spawn(move || {let Ok(read) = stream.try_clone() else { return };let mut write = stream;let mut authed = false;diff --git a/crates/ui-egui/src/create_ui.rs b/crates/ui-egui/src/create_ui.rsindex e0cb428cf..17f3e96ad 100644--- a/crates/ui-egui/src/create_ui.rs+++ b/crates/ui-egui/src/create_ui.rs@@ -3,7 +3,7 @@use std::sync::Arc;-use crate::PrintCraftApp;+use crate::PdfCraftApp;/// File types Open accepts besides PDF (converted on open).pub const CONVERTIBLE: [&str; 12] = ["png", "jpg", "jpeg", "tif", "tiff", "gif", "bmp", "jp2", "j2k", "jpx", "txt", "text"];@@ -62,7 +62,7 @@ fn stem(name: &str) -> &str {name.rsplit_once('.').map_or(name, |(s, _)| s)}-impl PrintCraftApp {+impl PdfCraftApp {/// Convert a non-PDF file (image, text) into a new tab. Returns `None` when `bytes` is not/// something Create understands (the caller then tries to open it as a PDF).pub(crate) fn open_converted(&mut self, name: &str, bytes: &[u8]) -> Option<Result<(), String>> {@@ -178,9 +178,9 @@ impl PrintCraftApp {/// the saving.pub(crate) fn save_optimized(&mut self,- id: printcraft_engine::DocId,+ id: pdfcraft_engine::DocId,suffix: &str,- result: Result<(Arc<Vec<u8>>, String), printcraft_engine::EditError>,+ result: Result<(Arc<Vec<u8>>, String), pdfcraft_engine::EditError>,) {let Some(doc) = self.session.get(id) else { return };let (before, name) = (doc.bytes.len(), format!("{} ({suffix}).pdf", stem(&doc.name)));@@ -191,7 +191,7 @@ impl PrintCraftApp {return;}};- let saved = |app: &mut PrintCraftApp, place: String| {+ let saved = |app: &mut PdfCraftApp, place: String| {let pct = 100.0 * (1.0 - bytes.len() as f64 / before.max(1) as f64);app.notify(format!("Saved {place}: {} → {} ({pct:.0}% smaller){detail}",diff --git a/crates/ui-egui/src/crop.rs b/crates/ui-egui/src/crop.rsindex 096f7a948..1344a30f3 100644--- a/crates/ui-egui/src/crop.rs+++ b/crates/ui-egui/src/crop.rs@@ -2,8 +2,8 @@//! rectangle; double-click a page to open Set Page Boxes for it.use egui::{Color32, CornerRadius, Pos2, Rect, Stroke};-use printcraft_engine::{BoxSpec, Edit, PageBox};-use printcraft_render::DocInfo;+use pdfcraft_engine::{BoxSpec, Edit, PageBox};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex d69d88cd9..e47853ec3 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -3,13 +3,13 @@use egui::{Align, Layout};use crate::theme::{self, Tokens};-use printcraft_engine::Edit;+use pdfcraft_engine::Edit;-use crate::{CloseRequest, Dialog, PrintCraftApp, PropsTab, panels::human_size, widgets};+use crate::{CloseRequest, Dialog, PdfCraftApp, PropsTab, panels::human_size, widgets};const INFO_KEYS: [&str; 4] = ["Title", "Author", "Subject", "Keywords"];-pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {+pub fn show(app: &mut PdfCraftApp, ctx: &egui::Context) {password(app, ctx);save_prompt(app, ctx);crate::updates::dialog(app, ctx);@@ -130,7 +130,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {row(ui, "PDF producer", i.producer.clone().unwrap_or_default());}PropsTab::InitialView => {- use printcraft_engine::{InitialLayout as L, Magnification as M, Navigation as N};+ use pdfcraft_engine::{InitialLayout as L, Magnification as M, Navigation as N};let editable = doc.allows_modification();let pages = i.pages.len();let Some((_, v)) = app.view_draft.as_mut() else { return };@@ -410,15 +410,15 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {ui.radio_value(&mut draft.mode, M::Selection, "Before each selected page (select pages in Organize)")});let plan = match draft.mode {- M::Pages => crate::SplitPlan::By(printcraft_engine::SplitBy::PageCount(draft.every)),- M::Selection => crate::SplitPlan::By(printcraft_engine::SplitBy::Before(selected)),+ M::Pages => crate::SplitPlan::By(pdfcraft_engine::SplitBy::PageCount(draft.every)),+ M::Selection => crate::SplitPlan::By(pdfcraft_engine::SplitBy::Before(selected)),M::Size => crate::SplitPlan::Size((draft.size_mb * 1_048_576.0) as usize),M::Bookmarks => crate::SplitPlan::Bookmarks,};let files = match &plan {- crate::SplitPlan::By(by) => Some(printcraft_engine::split_ranges(n, by).len()),+ crate::SplitPlan::By(by) => Some(pdfcraft_engine::split_ranges(n, by).len()),crate::SplitPlan::Bookmarks => {- Some(printcraft_engine::split_ranges(n, &printcraft_engine::SplitBy::Before(marks.iter().map(|m| m.0).collect())).len())+ Some(pdfcraft_engine::split_ranges(n, &pdfcraft_engine::SplitBy::Before(marks.iter().map(|m| m.0).collect())).len())}crate::SplitPlan::Size(_) => None,};@@ -547,7 +547,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {return;}Dialog::RotatePages => {- use printcraft_engine::{PageOrientation as O, PageParity as P};+ use pdfcraft_engine::{PageOrientation as O, PageParity as P};let n = app.active_ids().and_then(|(_, id)| app.session.get(id)).map_or(1, |d| d.info.pages.len());let d = &mut app.rotate_draft;ui.label(egui::RichText::new("Rotate Pages").font(theme::semibold(18.0)));@@ -701,7 +701,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {ui.horizontal(|ui| {ui.label("Sort comments by:");egui::ComboBox::from_id_salt("summary-sort").selected_text(app.summary_sort.name()).show_ui(ui, |ui| {- for s in printcraft_engine::SummarySort::ALL {+ for s in pdfcraft_engine::SummarySort::ALL {ui.selectable_value(&mut app.summary_sort, s, s.name());}});@@ -888,7 +888,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {return;}Dialog::NumberPages => {- use printcraft_engine::LabelStyle as L;+ use pdfcraft_engine::LabelStyle as L;ui.label(egui::RichText::new("Number pages").font(theme::semibold(18.0)));ui.add_space(8.0);let Some((_, id)) = app.active_ids() else { return };@@ -955,7 +955,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {ui.label(egui::RichText::new("Recover unsaved documents?").font(theme::semibold(18.0)));});ui.add_space(6.0);- ui.label("PrintCraft didn't shut down normally. These documents had changes that were autosaved:");+ ui.label("PdfCraft didn't shut down normally. These documents had changes that were autosaved:");ui.add_space(8.0);let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0);egui::Grid::new("recoverable").num_columns(2).spacing([18.0, 6.0]).show(ui, |ui| {@@ -979,7 +979,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {let mac = cfg!(target_os = "macos") || cfg!(target_arch = "wasm32");// Registered commands first (always in sync with the real bindings), then the// keys the document view handles itself.- let mut rows: Vec<(String, String)> = printcraft_engine::commands::COMMANDS+ let mut rows: Vec<(String, String)> = pdfcraft_engine::commands::COMMANDS.iter().filter_map(|c| c.shortcut.map(|k| (k.label(mac), c.label.trim_end_matches('…').to_string()))).collect();@@ -1015,7 +1015,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {ui.horizontal(|ui| {widgets::artcraft_mark(ui, 40.0);ui.vertical(|ui| {- ui.label(egui::RichText::new("PrintCraft").font(theme::semibold(20.0)));+ ui.label(egui::RichText::new("PdfCraft").font(theme::semibold(20.0)));ui.label(format!("Version {}", env!("CARGO_PKG_VERSION")));});});@@ -1130,7 +1130,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {app.redact_search.found = Some(n);}Some(Dialog::RemoveHidden) => {- let which: Vec<printcraft_engine::Hidden> = app.hidden_draft.found.iter().filter(|f| f.2 && f.1 > 0).map(|f| f.0).collect();+ let which: Vec<pdfcraft_engine::Hidden> = app.hidden_draft.found.iter().filter(|f| f.2 && f.1 > 0).map(|f| f.0).collect();let n: usize = app.hidden_draft.found.iter().filter(|f| f.2).map(|f| f.1).sum();if app.apply_edit(Edit::RemoveHidden { which }) {app.notify(format!("Removed {n} hidden item{}. Save to remove them from the file.", if n == 1 { "" } else { "s" }));@@ -1235,7 +1235,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {}/// Info edits needed to make the document match the Description draft.-fn draft_changes(app: &PrintCraftApp) -> Option<Vec<Edit>> {+fn draft_changes(app: &PdfCraftApp) -> Option<Vec<Edit>> {let (id, draft) = app.props_draft.as_ref()?;let doc = app.session.get(*id)?;let mut edits: Vec<Edit> = INFO_KEYS@@ -1272,7 +1272,7 @@ pub(crate) fn save_prompt_key(ctx: &egui::Context) -> Option<Option<bool>> {}/// "Save changes?" when closing a tab or quitting with unsaved edits.-fn save_prompt(app: &mut PrintCraftApp, ctx: &egui::Context) {+fn save_prompt(app: &mut PdfCraftApp, ctx: &egui::Context) {let Some(req) = app.close_request else { return };let index = match req {CloseRequest::Tab(i) => Some(i),@@ -1320,7 +1320,7 @@ fn yes(b: bool) -> String {}/// Password prompt for encrypted documents (Acrobat: "Password" dialog on open).-fn password(app: &mut PrintCraftApp, ctx: &egui::Context) {+fn password(app: &mut PdfCraftApp, ctx: &egui::Context) {let Some(prompt) = app.password_prompt.as_mut() else { return };let t = Tokens::get(ctx);let mut submit = false;diff --git a/crates/ui-egui/src/edit_text_ui.rs b/crates/ui-egui/src/edit_text_ui.rsindex 4805b43c8..633cb5454 100644--- a/crates/ui-egui/src/edit_text_ui.rs+++ b/crates/ui-egui/src/edit_text_ui.rs@@ -5,8 +5,8 @@//! its proportions), right-click for rotate, flip, replace, save and delete; Delete removes it.use egui::{Color32, CornerRadius, FontFamily, FontId, Pos2, Rect, Stroke};-use printcraft_engine::Edit;-use printcraft_render::DocInfo;+use pdfcraft_engine::Edit;+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};@@ -31,8 +31,8 @@ pub struct LineEditor {size: f32,focus: bool,/// The Format text panel's values, and what the paragraph had (to send only changes).- pub look: printcraft_engine::AddedText,- look0: printcraft_engine::AddedText,+ pub look: pdfcraft_engine::AddedText,+ look0: pdfcraft_engine::AddedText,/// Underline, line spacing (× size; 0 = the paragraph's own), character spacing (pt) and/// horizontal scale (%), and what they were.pub extras: Extras,@@ -87,9 +87,9 @@ impl LineEditor {}/// The formatting the panel changed.- pub fn style(&self) -> printcraft_engine::BlockStyle {+ pub fn style(&self) -> pdfcraft_engine::BlockStyle {let (l, o) = (&self.look, &self.look0);- printcraft_engine::BlockStyle {+ pdfcraft_engine::BlockStyle {family: (l.family != o.family || l.bold != o.bold || l.italic != o.italic).then_some((l.family, l.bold, l.italic)),size: (l.size != o.size).then_some(l.size),color: (l.color != o.color).then_some(l.color),@@ -112,15 +112,15 @@ impl LineEditor {}/// Adopt the rewritten paragraph's current geometry before the next overlay frame.- pub(crate) fn refresh_source(&mut self, block: &printcraft_engine::TextBlock) {+ pub(crate) fn refresh_source(&mut self, block: &pdfcraft_engine::TextBlock) {self.source_rect = block.rect.map(|v| v as f32);self.multiline = block.lines.len() > 1;}}/// The look shown for a paragraph: the family and weight guessed from its PDF font name.-fn source_look(base_font: &str, size: f64, color: [f64; 3], detected_bold: bool, detected_italic: bool) -> printcraft_engine::AddedText {- use printcraft_engine::FontFamily as F;+fn source_look(base_font: &str, size: f64, color: [f64; 3], detected_bold: bool, detected_italic: bool) -> pdfcraft_engine::AddedText {+ use pdfcraft_engine::FontFamily as F;let name = base_font.to_ascii_lowercase();let family = if ["courier", "mono", "consolas", "menlo", "monaco", "lucida console"].iter().any(|s| name.contains(s)) {F::Courier@@ -129,7 +129,7 @@ fn source_look(base_font: &str, size: f64, color: [f64; 3], detected_bold: bool,} else {F::Helvetica};- printcraft_engine::AddedText {+ pdfcraft_engine::AddedText {family,bold: detected_bold || ["bold", "black", "heavy", "semibold", "demi"].iter().any(|s| name.contains(s)),italic: detected_italic || ["italic", "oblique", "slanted"].iter().any(|s| name.contains(s)),@@ -139,13 +139,13 @@ fn source_look(base_font: &str, size: f64, color: [f64; 3], detected_bold: bool,}}-fn look_of(b: &printcraft_engine::TextBlock) -> printcraft_engine::AddedText {+fn look_of(b: &pdfcraft_engine::TextBlock) -> pdfcraft_engine::AddedText {source_look(&b.base_font, b.size, b.color, b.bold, b.italic)}-fn editor_font(look: &printcraft_engine::AddedText, size: f32) -> FontId {+fn editor_font(look: &pdfcraft_engine::AddedText, size: f32) -> FontId {let family = match (look.family, look.bold) {- (printcraft_engine::FontFamily::Courier, _) => FontFamily::Monospace,+ (pdfcraft_engine::FontFamily::Courier, _) => FontFamily::Monospace,(_, true) => FontFamily::Name("semibold".into()),(_, false) => FontFamily::Proportional,};@@ -206,7 +206,7 @@ pub(crate) fn image_input(xf: &PageXform,page: usize,info: &DocInfo,- images: &[printcraft_engine::PageImage],+ images: &[pdfcraft_engine::PageImage],view: &mut DocView,action: &mut Option<ImageAction>,) -> bool {@@ -280,14 +280,14 @@ pub(crate) fn image_input(}if preview != b {view.pending_edit =- Some(Edit::EditPageImage { page, index: i, change: printcraft_engine::ImageEdit::Move(user_box(xf, info, page, preview)) });+ Some(Edit::EditPageImage { page, index: i, change: pdfcraft_engine::ImageEdit::Move(user_box(xf, info, page, preview)) });}}return true;}if ui.input(|inp| inp.key_pressed(egui::Key::Delete) || inp.key_pressed(egui::Key::Backspace)) && !ui.ctx().egui_wants_keyboard_input() {view.image_selection = None;- view.pending_edit = Some(Edit::EditPageImage { page, index: i, change: printcraft_engine::ImageEdit::Delete });+ view.pending_edit = Some(Edit::EditPageImage { page, index: i, change: pdfcraft_engine::ImageEdit::Delete });return true;}}@@ -302,7 +302,7 @@ pub(crate) fn image_input(}if selected == Some(hit) {resp.context_menu(|ui| {- use printcraft_engine::ImageEdit as E;+ use pdfcraft_engine::ImageEdit as E;let items: [(&str, Option<E>); 4] = [("Rotate Clockwise", Some(E::Rotate(1))),("Rotate Counterclockwise", Some(E::Rotate(3))),@@ -342,7 +342,7 @@ pub(crate) fn page_input(xf: &PageXform,page: usize,info: &DocInfo,- lines: &[printcraft_engine::TextBlock],+ lines: &[pdfcraft_engine::TextBlock],view: &mut DocView,) -> bool {let boxes: Vec<Rect> = lines.iter().map(|l| xf.user_rect(info, page, l.rect.map(|v| v as f32)).expand(2.0)).collect();@@ -377,9 +377,9 @@ pub(crate) fn page_input(let style = if d.resize {// The new width in user space: the box's change, added to the paragraph's own.let width = (l.rect[2] - l.rect[0]) + (to[2] - to[0]) - (from[2] - from[0]);- printcraft_engine::BlockStyle { width: Some(width), ..Default::default() }+ pdfcraft_engine::BlockStyle { width: Some(width), ..Default::default() }} else {- printcraft_engine::BlockStyle { offset: Some([to[0] - from[0], to[1] - from[1]]), ..Default::default() }+ pdfcraft_engine::BlockStyle { offset: Some([to[0] - from[0], to[1] - from[1]]), ..Default::default() }};if preview != b {view.pending_edit = Some(Edit::EditTextBlock { page, block: d.block, text: l.text.clone(), style });@@ -495,7 +495,7 @@ pub(crate) fn overlay(ctx: &egui::Context, view: &mut DocView, info: &DocInfo) -Some(apply) => {let ed = view.line_editor.take()?;let style = ed.style();- (apply && (ed.text != ed.original || style != printcraft_engine::BlockStyle::default())).then_some(Edit::EditTextBlock {+ (apply && (ed.text != ed.original || style != pdfcraft_engine::BlockStyle::default())).then_some(Edit::EditTextBlock {page: ed.page,block: ed.block,text: ed.text,diff --git a/crates/ui-egui/src/editing.rs b/crates/ui-egui/src/editing.rsindex 12f0ccda7..cfe4f8aa2 100644--- a/crates/ui-egui/src/editing.rs+++ b/crates/ui-egui/src/editing.rs@@ -1,9 +1,9 @@//! Editing glue: apply engine edits from the UI, undo/redo, save/save-as, and the//! "save changes?" prompt when closing a tab or quitting with unsaved edits.-use printcraft_engine::Edit;+use pdfcraft_engine::Edit;-use crate::PrintCraftApp;+use crate::PdfCraftApp;/// What the user was doing when we asked whether to save.#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -25,7 +25,7 @@ pub enum SaveTarget {As,}-impl PrintCraftApp {+impl PdfCraftApp {/// Apply an edit to the active document. Returns `true` on success; failures are shown.pub fn apply_edit(&mut self, edit: Edit) -> bool {let Some((i, id)) = self.active_ids() else { return false };@@ -341,7 +341,7 @@ pub fn write_atomically(path: &str, bytes: &[u8]) -> std::io::Result<()> {use std::io::Write;let target = std::path::Path::new(path);let dir = target.parent().filter(|d| !d.as_os_str().is_empty()).unwrap_or(std::path::Path::new("."));- let tmp = dir.join(format!(".{}.printcraft-{}.tmp", target.file_name().and_then(|n| n.to_str()).unwrap_or("save"), std::process::id()));+ let tmp = dir.join(format!(".{}.pdfcraft-{}.tmp", target.file_name().and_then(|n| n.to_str()).unwrap_or("save"), std::process::id()));let result = (|| {let mut f = std::fs::File::create(&tmp)?;f.write_all(bytes)?;@@ -379,7 +379,7 @@ pub(crate) fn download(name: &str, bytes: &[u8]) -> Result<(), String> {Ok(())}-impl PrintCraftApp {+impl PdfCraftApp {/// Carry out a Bookmarks-panel action as an undoable edit.pub fn bookmark_action(&mut self, action: crate::panels::BmAction) {use crate::panels::BmAction as A;@@ -427,7 +427,7 @@ impl PrintCraftApp {}}-fn bookmark_at<'a>(items: &'a [printcraft_render::OutlineItem], path: &[usize]) -> Option<&'a printcraft_render::OutlineItem> {+fn bookmark_at<'a>(items: &'a [pdfcraft_render::OutlineItem], path: &[usize]) -> Option<&'a pdfcraft_render::OutlineItem> {let (first, rest) = path.split_first()?;let item = items.get(*first)?;if rest.is_empty() { Some(item) } else { bookmark_at(&item.children, rest) }diff --git a/crates/ui-egui/src/export_ui.rs b/crates/ui-egui/src/export_ui.rsindex bcee1e776..437f8e934 100644--- a/crates/ui-egui/src/export_ui.rs+++ b/crates/ui-egui/src/export_ui.rs@@ -6,11 +6,11 @@use std::sync::{Arc, Mutex};use egui::{Align, Layout};-use printcraft_engine::export::{ExportSource, Exporter, ImageFormat};+use pdfcraft_engine::export::{ExportSource, Exporter, ImageFormat};use crate::marks_ui::PageRange;use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum ExportKind {@@ -38,7 +38,7 @@ impl Default for ExportDraft {/// Progress of a background export: (done, total, final message once finished).pub type ExportStatus = Arc<Mutex<Option<(usize, usize, Option<String>)>>>;-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens, kind: ExportKind) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens, kind: ExportKind) -> (bool, bool) {let count = app.active_ids().and_then(|(_, id)| app.session.get(id)).map(|d| d.info.pages.len()).unwrap_or(0);let d = &mut app.export_draft;ui.label(@@ -137,12 +137,12 @@ fn run(};if kind == ExportKind::AllImages {set(0, None);- let out = match printcraft_engine::export::extract_images(&src, &pages, min_side) {+ let out = match pdfcraft_engine::export::extract_images(&src, &pages, min_side) {Ok(o) => o,Err(e) => return format!("Export stopped: {e}"),};for (k, img) in out.images.iter().enumerate() {- if let Err(e) = sink(&printcraft_engine::export::image_file_name(&stem, img, k + 1), img.data.clone()) {+ if let Err(e) = sink(&pdfcraft_engine::export::image_file_name(&stem, img, k + 1), img.data.clone()) {return format!("Export stopped: {e}");}}@@ -177,7 +177,7 @@ fn run(}}-impl PrintCraftApp {+impl PdfCraftApp {/// Start exporting the active document with the dialog's settings.pub(crate) fn start_export(&mut self, kind: ExportKind) {let Some((_, id)) = self.active_ids() else { return };@@ -211,7 +211,7 @@ impl PrintCraftApp {if self.export_dir_override.is_some() {work(); // tests and automation: synchronous} else {- std::thread::Builder::new().name("printcraft-export".into()).spawn(work).ok();+ std::thread::Builder::new().name("pdfcraft-export".into()).spawn(work).ok();}}#[cfg(target_arch = "wasm32")]diff --git a/crates/ui-egui/src/files.rs b/crates/ui-egui/src/files.rsindex a5b8766d2..c211019e4 100644--- a/crates/ui-egui/src/files.rs+++ b/crates/ui-egui/src/files.rs@@ -5,9 +5,9 @@use std::sync::Arc;-use printcraft_engine::{Edit, SplitBy};+use pdfcraft_engine::{Edit, SplitBy};-use crate::PrintCraftApp;+use crate::PdfCraftApp;/// Why files were picked.#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -49,7 +49,7 @@ impl Default for SplitDraft {}}-/// Acrobat's Split by: number of pages, file size, top-level bookmarks (and PrintCraft's+/// Acrobat's Split by: number of pages, file size, top-level bookmarks (and PdfCraft's/// before-selected-pages).#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum SplitMode {@@ -85,8 +85,8 @@ pub struct RotateDraft {pub which: u8,pub from: usize,pub to: usize,- pub parity: printcraft_engine::PageParity,- pub orientation: printcraft_engine::PageOrientation,+ pub parity: pdfcraft_engine::PageParity,+ pub orientation: pdfcraft_engine::PageOrientation,}impl Default for RotateDraft {@@ -95,7 +95,7 @@ impl Default for RotateDraft {}}-impl PrintCraftApp {+impl PdfCraftApp {/// Ask for files to combine (File ▸ Combine files…).pub fn combine_dialog(&mut self) {self.pick_files(FilePurpose::Combine, true);@@ -245,7 +245,7 @@ impl PrintCraftApp {if opts.delete {// Back on the original document.self.active = Some(i);- self.apply_edit(printcraft_engine::Edit::DeletePages { pages });+ self.apply_edit(pdfcraft_engine::Edit::DeletePages { pages });}}@@ -290,12 +290,12 @@ impl PrintCraftApp {2 => (d.from.max(1) - 1..d.to.min(n)).collect(),_ => (0..n).collect(),};- let pages = printcraft_engine::filter_pages(&doc.info, &base, d.parity, d.orientation);+ let pages = pdfcraft_engine::filter_pages(&doc.info, &base, d.parity, d.orientation);if pages.is_empty() {self.notify("No pages match those choices");return;}- self.apply_edit(printcraft_engine::Edit::RotatePages { pages, degrees: d.degrees });+ self.apply_edit(pdfcraft_engine::Edit::RotatePages { pages, degrees: d.degrees });}/// Split the active document and write the parts: into a chosen folder (desktop) or as@@ -364,7 +364,7 @@ pub(crate) fn strip_pdf(name: &str) -> &str {name.strip_suffix(".pdf").or_else(|| name.strip_suffix(".PDF")).unwrap_or(name)}-impl PrintCraftApp {+impl PdfCraftApp {/// Comments ▸ Import comments / Prepare a form ▸ Import data: XFDF, FDF, XML, CSV or text.pub fn import_data_dialog(&mut self) {#[cfg(not(target_arch = "wasm32"))]@@ -381,7 +381,7 @@ impl PrintCraftApp {match std::fs::read(&path) {Ok(bytes) => {let name = path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();- self.apply_edit(printcraft_engine::Edit::ImportData { name, bytes: std::sync::Arc::new(bytes) });+ self.apply_edit(pdfcraft_engine::Edit::ImportData { name, bytes: std::sync::Arc::new(bytes) });}Err(e) => self.notify(format!("Couldn't read {}: {e}", path.display())),}@@ -392,7 +392,7 @@ impl PrintCraftApp {/// Export all comments / form data: the format follows the file name's extension./// Export a PDF ▸ Word, HTML or RTF: ask where (`save_override` in tests), then write.- pub fn export_office_dialog(&mut self, format: printcraft_engine::compare::OfficeFormat) {+ pub fn export_office_dialog(&mut self, format: pdfcraft_engine::compare::OfficeFormat) {let Some((_, id)) = self.active_ids() else { return };let Some(doc) = self.session.get(id) else { return };let stem = doc.name.trim_end_matches(".pdf").trim_end_matches(".PDF").to_string();@@ -448,7 +448,7 @@ impl PrintCraftApp {/// Merge the given data files and save the spreadsheet (asks where; `save_override` in tests).pub fn merge_data_files(&mut self, files: Vec<(String, Vec<u8>)>) {- let csv = match printcraft_engine::merge_data_files(&files) {+ let csv = match pdfcraft_engine::merge_data_files(&files) {Ok(c) => c,Err(e) => return self.notify(e),};@@ -494,7 +494,7 @@ impl PrintCraftApp {};let Some(path) = path else { return };let ext = path.extension().map(|e| e.to_string_lossy().into_owned()).unwrap_or_default();- let format = printcraft_engine::DataFormat::from_extension(&ext).unwrap_or(printcraft_engine::DataFormat::Xfdf);+ let format = pdfcraft_engine::DataFormat::from_extension(&ext).unwrap_or(pdfcraft_engine::DataFormat::Xfdf);match self.session.export_data(id, format, comments, fields) {Ok(bytes) => match crate::editing::write_atomically(&path.to_string_lossy(), &bytes) {Ok(()) => self.notify(format!("Exported to {}", path.display())),@@ -504,7 +504,7 @@ impl PrintCraftApp {}}#[cfg(target_arch = "wasm32")]- match self.session.export_data(id, printcraft_engine::DataFormat::Xfdf, comments, fields) {+ match self.session.export_data(id, pdfcraft_engine::DataFormat::Xfdf, comments, fields) {Ok(bytes) => {let _ = crate::editing::download(&format!("{stem}.xfdf"), &bytes);}diff --git a/crates/ui-egui/src/fill_sign.rs b/crates/ui-egui/src/fill_sign.rsindex 74c0a1a22..d569bc7f4 100644--- a/crates/ui-egui/src/fill_sign.rs+++ b/crates/ui-egui/src/fill_sign.rs@@ -1,11 +1,11 @@//! Fill & Sign (Acrobat's Fill & Sign tool, execution plan M5.7): type text onto the page, place//! ✓ ✕ ● ─ marks and today's date, and sign with a drawn signature. Everything is an annotation-//! (typewriter text, PrintCraft-drawn stamps, ink), so it can be moved, deleted and undone like+//! (typewriter text, PdfCraft-drawn stamps, ink), so it can be moved, deleted and undone like//! any comment.use egui::{Color32, CornerRadius, Pos2, Sense, Stroke, pos2, vec2};-use printcraft_engine::{Edit, FillMark, NewAnnotation, Shape, Style};-use printcraft_render::DocInfo;+use pdfcraft_engine::{Edit, FillMark, NewAnnotation, Shape, Style};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};use crate::theme::Tokens;@@ -161,7 +161,7 @@ pub fn signature_at(page: usize, at: [f64; 2], strokes: &[Vec<[f32; 2]>], author/// Place typed text in the script font with its left edge at `at`, `height` points tall.pub fn typed_signature_at(page: usize, at: [f64; 2], text: &str, height: f64, author: &str) -> Option<Edit> {- printcraft_engine::typed_signature_shape(at, text, height).map(|shape| new(page, shape, String::new(), author))+ pdfcraft_engine::typed_signature_shape(at, text, height).map(|shape| new(page, shape, String::new(), author))}/// Place a saved signature or initials.@@ -174,7 +174,7 @@ pub fn place(page: usize, at: [f64; 2], sig: &SavedSig, initials: bool, author:/// The text in the script font as a picture (`w`×`h` px, black on transparent), for previews.pub(crate) fn script_preview(text: &str, w: usize, h: usize) -> egui::ColorImage {- let o = printcraft_engine::script_outline(text);+ let o = pdfcraft_engine::script_outline(text);let mut img = egui::ColorImage::filled([w, h], Color32::TRANSPARENT);let span = (o.ascent - o.descent).max(0.1);if o.contours.is_empty() {diff --git a/crates/ui-egui/src/forms_ui.rs b/crates/ui-egui/src/forms_ui.rsindex 5ad40d1f5..e33e6029e 100644--- a/crates/ui-egui/src/forms_ui.rs+++ b/crates/ui-egui/src/forms_ui.rs@@ -5,8 +5,8 @@//! and list boxes open a list of their options. Every change is one undoable engine edit.use egui::{Color32, CornerRadius, Rect, Stroke, vec2};-use printcraft_engine::{Edit, FieldValue, FormField, FormFieldKind, field_flags};-use printcraft_render::DocInfo;+use pdfcraft_engine::{Edit, FieldValue, FormField, FormFieldKind, field_flags};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};use crate::theme::Tokens;@@ -37,7 +37,7 @@ pub struct FormView {/// A message for the app to show (e.g. "buttons run JavaScript").pub notice: Option<String>,/// A push button was clicked: (its field name, what it does).- pub button: Option<(String, printcraft_engine::form_scripts::ButtonAction)>,+ pub button: Option<(String, pdfcraft_engine::form_scripts::ButtonAction)>,}fn widget_rect(xf: &PageXform, info: &DocInfo, page: usize, r: [f64; 4]) -> Rect {@@ -140,7 +140,7 @@ const MONTHS: [&str; 12] = ["January", "February", "March", "April", "May", "Jun/// The date picker under a focused date field. Returns the picked date, formatted with the/// field's own format.fn calendar(ctx: &egui::Context, view: &mut DocView, field: egui::Rect, fmt: &str, today: (i64, u32, u32)) -> Option<String> {- use printcraft_engine::form_scripts::{DateTime, format_date, parse_date};+ use pdfcraft_engine::form_scripts::{DateTime, format_date, parse_date};let fx = view.forms.focus.as_mut()?;let (mut y, mut m) = fx.calendar.unwrap_or_else(|| match parse_date(&fx.text, fmt) {Some(d) => (d.y, d.m),@@ -290,7 +290,7 @@ pub(crate) fn overlay(ctx: &egui::Context, view: &mut DocView, info: &DocInfo, f}});// Date fields: a calendar under the field (Acrobat's date picker).- if let printcraft_engine::form_scripts::Format::Date(fmt) = &f.actions.format+ if let pdfcraft_engine::form_scripts::Format::Date(fmt) = &f.actions.format&& let Some(picked) = calendar(ctx, view, rect, fmt, today){if let Some(fx) = view.forms.focus.as_mut() {diff --git a/crates/ui-egui/src/home.rs b/crates/ui-egui/src/home.rsindex 1335e1985..c04139e53 100644--- a/crates/ui-egui/src/home.rs+++ b/crates/ui-egui/src/home.rs@@ -1,18 +1,18 @@//! Home tab: recommended tools, open card, recent files (local only, never another app's list).use egui::{Align2, CornerRadius, Rect, Sense, Stroke, vec2};-use printcraft_engine::catalog;+use pdfcraft_engine::catalog;use crate::theme::{self, Tokens};-use crate::{LeftPanel, PrintCraftApp, icons, panels::human_size, widgets};+use crate::{LeftPanel, PdfCraftApp, icons, panels::human_size, widgets};const RECOMMENDED: [&str; 5] = ["organize", "comment", "form", "edit", "protect"];-pub fn show(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+pub fn show(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {egui::Frame::NONE.inner_margin(egui::Margin { left: 36, right: 36, top: 28, bottom: 28 }).show(ui, |ui| {- ui.label(egui::RichText::new("Welcome to PrintCraft").font(theme::semibold(24.0)));+ ui.label(egui::RichText::new("Welcome to PdfCraft").font(theme::semibold(24.0)));ui.label(egui::RichText::new("An open-source PDF workbench — local, private, and scriptable.").color(t.text_muted).font(theme::regular(14.0)),);@@ -98,7 +98,7 @@ pub fn show(app: &mut PrintCraftApp, ui: &mut egui::Ui) {ui.label(egui::RichText::new("Recent").font(theme::semibold(17.0)));ui.add_space(8.0);if app.recent.is_empty() {- ui.label(egui::RichText::new("Files you open in PrintCraft appear here. Drop a PDF anywhere to open it.").color(t.text_muted));+ ui.label(egui::RichText::new("Files you open in PdfCraft appear here. Drop a PDF anywhere to open it.").color(t.text_muted));}let mut open = None;for r in &app.recent {@@ -138,7 +138,7 @@ pub fn show(app: &mut PrintCraftApp, ui: &mut egui::Ui) {ui.add_space(20.0);widgets::section_title(ui, "Privacy");ui.label(- egui::RichText::new("PrintCraft works offline. No telemetry, no account, and no cloud processing unless you add a provider.")+ egui::RichText::new("PdfCraft works offline. No telemetry, no account, and no cloud processing unless you add a provider.").color(t.text_muted),);});diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex 56fc4bb1b..0038e84bb 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -107,17 +107,17 @@ mod tests {#[test]fn language_persists_and_invalid_input_keeps_current_language() {- let mut app = crate::PrintCraftApp::default();+ let mut app = crate::PdfCraftApp::default();app.set_option("language", "ja").unwrap();assert_eq!(app.language, Language::Ja);assert!(app.set_option("language", "xx").is_err());assert_eq!(app.language, Language::Ja);- let mut restored = crate::PrintCraftApp::default();+ let mut restored = crate::PdfCraftApp::default();restored.restore(&app.persist());assert_eq!(restored.language, Language::Ja);restored.restore(r#"{"language":"xx"}"#);assert_eq!(restored.language, Language::Ja);- let mut legacy = crate::PrintCraftApp::default();+ let mut legacy = crate::PdfCraftApp::default();legacy.restore("{}");assert_eq!(legacy.language, Language::En);}diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rsindex 32c7bdb43..c3058b685 100644--- a/crates/ui-egui/src/icons.rs+++ b/crates/ui-egui/src/icons.rs@@ -61,7 +61,7 @@ pub fn button(ui: &mut egui::Ui, name: &str, box_size: f32, selected: bool, toolmod tests {#[test]fn every_catalog_icon_exists() {- for g in printcraft_engine::catalog::TOOL_GROUPS {+ for g in pdfcraft_engine::catalog::TOOL_GROUPS {assert!(super::exists(g.icon), "missing icon {}", g.icon);for s in g.sections {for i in s.items {diff --git a/crates/ui-egui/src/js_ui.rs b/crates/ui-egui/src/js_ui.rsindex 719df3e4b..1e0f1e27c 100644--- a/crates/ui-egui/src/js_ui.rs+++ b/crates/ui-egui/src/js_ui.rs@@ -2,11 +2,11 @@//! the JavaScript console (⌘J), Document JavaScripts, and Preferences ▸ JavaScript.use egui::{Align, Layout};-use printcraft_engine::js::{JsOutput, Request};-use printcraft_engine::{DocId, Edit};+use pdfcraft_engine::js::{JsOutput, Request};+use pdfcraft_engine::{DocId, Edit};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};/// The JavaScript console: the input and the output so far.#[derive(Clone, Debug, Default, PartialEq)]@@ -22,7 +22,7 @@ pub struct DocJsDraft {pub script: String,}-impl PrintCraftApp {+impl PdfCraftApp {/// Act on what scripts produced in document `id`: alerts are shown, console output goes to/// the console, and print / page / link requests are carried out (form submissions are/// reported, never sent).@@ -49,7 +49,7 @@ impl PrintCraftApp {}}Request::Submit(u) => self.notify(format!(- "The form asks to be submitted to {u}; PrintCraft doesn't send form data. Save the document to keep your entries."+ "The form asks to be submitted to {u}; PdfCraft doesn't send form data. Save the document to keep your entries.")),Request::Focus(_) | Request::Beep | Request::Reset(_) => {}}@@ -135,7 +135,7 @@ fn buttons(ui: &mut egui::Ui, primary: &str, others: &[&str]) -> Option<String>}/// The JavaScript console. Returns `true` to close.-pub(crate) fn console_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+pub(crate) fn console_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {ui.label(egui::RichText::new("JavaScript Console").font(theme::semibold(18.0)));ui.add_space(6.0);if !app.session.javascript() {@@ -176,7 +176,7 @@ pub(crate) fn console_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Token}/// Document JavaScripts: list, edit, add and delete. Returns `true` to close.-pub(crate) fn document_js_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+pub(crate) fn document_js_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {ui.label(egui::RichText::new("Document JavaScripts").font(theme::semibold(18.0)));ui.add_space(6.0);let scripts = app.active_ids().and_then(|(_, id)| app.session.get(id)).map(|d| d.document_scripts()).unwrap_or_default();@@ -224,7 +224,7 @@ pub(crate) fn document_js_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &T}/// Preferences: interface language, identity and JavaScript. Returns `true` to close.-pub(crate) fn preferences_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+pub(crate) fn preferences_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {ui.label(egui::RichText::new(app.language.tr("Preferences")).font(theme::semibold(18.0)));ui.horizontal(|ui| {ui.label(app.language.tr("Interface language"));diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex a1e3419a3..3d8c14de2 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -1,9 +1,9 @@-//! printcraft-ui-egui — the first PrintCraft shell (L7).+//! pdfcraft-ui-egui — the first PdfCraft shell (L7).//!//! Layout grammar follows plan/acrobat/02-ui-ux.md §1: tab strip, mode bar, left tool panel,//! floating quick-action bar, document area, right panel + right rail with page navigation.//! Everything here is presentation: documents, rendering and the tool catalogue live in-//! `printcraft-engine`.+//! `pdfcraft-engine`.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]@@ -67,7 +67,7 @@ pub mod theme;pub mod updates;mod widgets;-use printcraft_engine::{DocId, Session};+use pdfcraft_engine::{DocId, Session};pub use canvas::DocView;pub use editing::{CloseRequest, SaveTarget};@@ -130,7 +130,7 @@ pub enum QuickTool {/// Edit a PDF ▸ Edit text: click a line of existing text to edit it.EditText,/// Add a stamp: click to place this stamp.- Stamp(printcraft_engine::StampKind),+ Stamp(pdfcraft_engine::StampKind),/// A custom stamp from the library (its index).CustomStamp(usize),/// Edit a PDF ▸ Link: draw link areas, select and edit links.@@ -158,7 +158,7 @@ pub enum Dialog {/// Set Page Boxes (crop, trim, bleed, art, media).PageBoxes,/// Add / Update Header and Footer, Watermark, Background.- Marks(printcraft_engine::MarkKind),+ Marks(pdfcraft_engine::MarkKind),/// Export a PDF ▸ Image / Text.Export(export_ui::ExportKind),/// Fill & Sign ▸ Create signature (the drawing pad).@@ -282,7 +282,7 @@ pub struct RecentFile {pub size: usize,}-pub struct PrintCraftApp {+pub struct PdfCraftApp {pub session: Session,pub views: Vec<DocView>,/// `None` shows the Home tab.@@ -322,7 +322,7 @@ pub struct PrintCraftApp {/// Document Properties ▸ Description fields being edited: (document, Title/Author/Subject/Keywords).pub props_draft: Option<(DocId, [String; 4])>,/// Document Properties ▸ Initial View (and reading options) being edited.- pub view_draft: Option<(DocId, printcraft_engine::InitialView)>,+ pub view_draft: Option<(DocId, pdfcraft_engine::InitialView)>,/// Files picked asynchronously for combine / insert (web).pub requests: files::Requests,/// Write exported files (split) here instead of asking (tests and automation).@@ -332,7 +332,7 @@ pub struct PrintCraftApp {pub extract_draft: ExtractDraft,pub rotate_draft: RotateDraft,/// Summarize Comments: sort order.- pub summary_sort: printcraft_engine::SummarySort,+ pub summary_sort: pdfcraft_engine::SummarySort,/// The signing dialogs' state.pub sign_draft: Option<SignDraft>,/// Digital ID files the user has created or added.@@ -349,7 +349,7 @@ pub struct PrintCraftApp {pub run_inline: bool,/// Action Wizard: the user's actions, the dialog state, the running action and (tests) the/// files to use instead of a picker.- pub custom_actions: Vec<printcraft_engine::actions::Action>,+ pub custom_actions: Vec<pdfcraft_engine::actions::Action>,pub wizard: actions_ui::Wizard,pub action_run: Option<std::sync::Arc<std::sync::Mutex<actions_ui::RunProgress>>>,pub action_files_override: Option<Vec<String>>,@@ -362,13 +362,13 @@ pub struct PrintCraftApp {pub js_console: js_ui::JsConsole,pub doc_js: js_ui::DocJsDraft,pub a11y: a11y_ui::A11yState,- pub a11y_skipped: std::collections::BTreeSet<printcraft_engine::a11y::Rule>,+ pub a11y_skipped: std::collections::BTreeSet<pdfcraft_engine::a11y::Rule>,pub alt_draft: a11y_ui::AltDraft,/// List the macOS Keychain's signing identities among the digital IDs (the desktop app).pub keychain_ids: bool,pub cert_viewer: Option<sign_ui::CertViewer>,/// The last space audit.- pub space_audit: Vec<printcraft_engine::optimize::SpaceUse>,+ pub space_audit: Vec<pdfcraft_engine::optimize::SpaceUse>,/// Combine files: the files staged so far.pub combine_draft: Vec<combine_ui::CombineFile>,/// The custom stamp library, and the stamp being created.@@ -435,7 +435,7 @@ pub struct PrintCraftApp {pub print_draft: PrintDraft,pub link_draft: Option<LinkDraft>,/// The style new text gets (Edit a PDF ▸ Format text).- pub text_style: printcraft_engine::AddedText,+ pub text_style: pdfcraft_engine::AddedText,/// The Replace Pages dialog's state.pub replace_draft: Option<files::ReplaceDraft>,/// The last web link the app asked the system to open (tests and automation).@@ -447,18 +447,18 @@ pub struct PrintCraftApp {pub struct NumberDraft {pub from: usize,pub to: usize,- pub style: printcraft_engine::LabelStyle,+ pub style: pdfcraft_engine::LabelStyle,pub prefix: String,pub start: u32,}-impl Default for PrintCraftApp {+impl Default for PdfCraftApp {fn default() -> Self {Self::new()}}-impl PrintCraftApp {+impl PdfCraftApp {pub fn new() -> Self {Self {session: Session::new(),@@ -562,7 +562,7 @@ impl PrintCraftApp {link_draft: None,text_style: content_ui::default_style(),replace_draft: None,- number_draft: NumberDraft { from: 1, to: 1, style: printcraft_engine::LabelStyle::Decimal, prefix: String::new(), start: 1 },+ number_draft: NumberDraft { from: 1, to: 1, style: pdfcraft_engine::LabelStyle::Decimal, prefix: String::new(), start: 1 },}}@@ -574,8 +574,8 @@ impl PrintCraftApp {/// Open a document the way it asks to be opened: navigation panel, layout, magnification,/// page (Document Properties ▸ Initial View).- fn apply_initial_view(&mut self, index: usize, v: &printcraft_engine::InitialView) {- use printcraft_engine::{InitialLayout as L, Magnification as M, Navigation as N};+ fn apply_initial_view(&mut self, index: usize, v: &pdfcraft_engine::InitialView) {+ use pdfcraft_engine::{InitialLayout as L, Magnification as M, Navigation as N};let pages = self.session.get(self.views[index].id).map_or(0, |d| d.info.pages.len());match v.navigation {N::PageOnly => {}@@ -618,7 +618,7 @@ impl PrintCraftApp {}fn try_open(&mut self, name: &str, path: Option<String>, bytes: std::sync::Arc<Vec<u8>>, password: Option<&str>) -> Result<(), String> {- use printcraft_render::OpenError;+ use pdfcraft_render::OpenError;let size = bytes.len();let id = match self.session.open(name, path.clone(), bytes.clone(), password) {Ok(id) => id,@@ -692,7 +692,7 @@ impl PrintCraftApp {pub fn attachment_action(&mut self, doc: DocId, index: usize, open: bool) {let Some(d) = self.session.get(doc) else { return };let Some(att) = d.info.attachments.get(index).cloned() else { return };- let data = printcraft_render::attachment_data(&d.bytes, d.password.as_deref(), &att);+ let data = pdfcraft_render::attachment_data(&d.bytes, d.password.as_deref(), &att);match (data, open) {(Err(e), _) => self.notify(format!("Couldn't read {}: {e}", att.name)),(Ok(bytes), true) => {@@ -818,19 +818,19 @@ impl PrintCraftApp {/// Run a catalogue command. Commands that aren't implemented yet say which milestone ships them.pub fn run_command(&mut self, command: &str) {- if printcraft_engine::commands::command(command).is_some() {+ if pdfcraft_engine::commands::command(command).is_some() {self.execute(command);return;}// Not implemented yet: say which milestone ships it.- let when = printcraft_engine::catalog::TOOL_GROUPS+ let when = pdfcraft_engine::catalog::TOOL_GROUPS.iter().flat_map(|g| g.sections.iter().flat_map(|s| s.items.iter())).find(|i| i.command == command).map(|i| match i.availability {- printcraft_engine::catalog::Availability::Planned(m) => format!("ships in milestone {m}"),- printcraft_engine::catalog::Availability::Provider => "needs an AI provider (off by default)".to_string(),- printcraft_engine::catalog::Availability::Ready => "is available".to_string(),+ pdfcraft_engine::catalog::Availability::Planned(m) => format!("ships in milestone {m}"),+ pdfcraft_engine::catalog::Availability::Provider => "needs an AI provider (off by default)".to_string(),+ pdfcraft_engine::catalog::Availability::Ready => "is available".to_string(),}).unwrap_or_else(|| "is not available yet".into());self.notify(format!("`{command}` {when}"));@@ -838,7 +838,7 @@ impl PrintCraftApp {/// Serialize the user's persistent state (recent files, theme). Local only.pub fn persist(&self) -> String {- let trusted: Vec<String> = self.session.trusted_certificates().iter().map(printcraft_engine::sign::x509::to_pem).collect();+ let trusted: Vec<String> = self.session.trusted_certificates().iter().map(pdfcraft_engine::sign::x509::to_pem).collect();serde_json::json!({"recent": self.recent,"theme": self.theme,@@ -898,7 +898,7 @@ impl PrintCraftApp {self.session.set_javascript(on);}if let Ok(pems) = serde_json::from_value::<Vec<String>>(v["trusted"].clone()) {- let certs = pems.iter().filter_map(|p| printcraft_engine::sign::x509::load_certificates(p.as_bytes()).ok()).flatten().collect();+ let certs = pems.iter().filter_map(|p| pdfcraft_engine::sign::x509::load_certificates(p.as_bytes()).ok()).flatten().collect();self.session.set_trusted_certificates(certs);}}@@ -947,7 +947,7 @@ impl PrintCraftApp {}}("tool", _) => {- let g = printcraft_engine::catalog::group(value).ok_or_else(|| format!("unknown tool {value}"))?;+ let g = pdfcraft_engine::catalog::group(value).ok_or_else(|| format!("unknown tool {value}"))?;self.left = LeftPanel::Tool(g.id);self.left_open = true;}@@ -963,9 +963,9 @@ impl PrintCraftApp {"split" => Some(Dialog::Split),"protect" => Some(Dialog::Protect),"page-boxes" => Some(Dialog::PageBoxes),- "header-footer" => Some(Dialog::Marks(printcraft_engine::MarkKind::HeaderFooter)),- "watermark" => Some(Dialog::Marks(printcraft_engine::MarkKind::Watermark)),- "background" => Some(Dialog::Marks(printcraft_engine::MarkKind::Background)),+ "header-footer" => Some(Dialog::Marks(pdfcraft_engine::MarkKind::HeaderFooter)),+ "watermark" => Some(Dialog::Marks(pdfcraft_engine::MarkKind::Watermark)),+ "background" => Some(Dialog::Marks(pdfcraft_engine::MarkKind::Background)),"export-image" => Some(Dialog::Export(export_ui::ExportKind::Image)),"export-text" => Some(Dialog::Export(export_ui::ExportKind::Text)),"export-all-images" => Some(Dialog::Export(export_ui::ExportKind::AllImages)),@@ -1065,7 +1065,7 @@ impl PrintCraftApp {QuickTool::CustomStamp(i)}stamp if stamp.starts_with("stamp-") => QuickTool::Stamp(- printcraft_engine::StampKind::ALL+ pdfcraft_engine::StampKind::ALL.into_iter().find(|k| k.name().trim_start_matches("PC").eq_ignore_ascii_case(&stamp[6..])).ok_or_else(|| format!("unknown stamp {stamp}"))?,@@ -1121,9 +1121,9 @@ impl PrintCraftApp {}}-impl eframe::App for PrintCraftApp {+impl eframe::App for PdfCraftApp {fn save(&mut self, storage: &mut dyn eframe::Storage) {- storage.set_string("printcraft", self.persist());+ storage.set_string("pdfcraft", self.persist());}fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {@@ -1201,7 +1201,7 @@ impl eframe::App for PrintCraftApp {let title = self.active.and_then(|i| self.session.get(self.views[i].id))- .map_or_else(|| "PrintCraft".to_owned(), |d| format!("{} — PrintCraft", d.display_name()));+ .map_or_else(|| "PdfCraft".to_owned(), |d| format!("{} — PdfCraft", d.display_name()));if title != self.window_title {ctx.send_viewport_cmd(egui::ViewportCommand::Title(title.clone()));self.window_title = title;diff --git a/crates/ui-egui/src/link_ui.rs b/crates/ui-egui/src/link_ui.rsindex d91d2884d..07cd81e34 100644--- a/crates/ui-egui/src/link_ui.rs+++ b/crates/ui-egui/src/link_ui.rs@@ -3,12 +3,12 @@//! their outlines, a click selects one, a double-click edits it and Delete removes it.use egui::{Color32, CornerRadius, Pos2, Rect, Stroke};-use printcraft_engine::{Edit, LinkAction, LinkHighlight, LinkItem, LinkStyle};-use printcraft_render::DocInfo;+use pdfcraft_engine::{Edit, LinkAction, LinkHighlight, LinkItem, LinkStyle};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};const LINK_BLUE: Color32 = Color32::from_rgb(0x14, 0x73, 0xE6);@@ -132,7 +132,7 @@ pub(crate) fn keys(ctx: &egui::Context, view: &mut DocView) {}}-impl PrintCraftApp {+impl PdfCraftApp {/// Open Link Properties for a new link area or an existing link.pub(crate) fn open_link_props(&mut self, page: usize, rect: Option<[f64; 4]>, index: Option<usize>) {let Some((_, id)) = self.active_ids() else { return };diff --git a/crates/ui-egui/src/marks_ui.rs b/crates/ui-egui/src/marks_ui.rsindex 850ad26a2..a4c602e6b 100644--- a/crates/ui-egui/src/marks_ui.rs+++ b/crates/ui-egui/src/marks_ui.rs@@ -3,10 +3,10 @@//! preview of the current page. "Update" opens the same dialog in replace mode.use egui::{Align, Color32, CornerRadius, Layout, Rect, Stroke, pos2, vec2};-use printcraft_engine::{Background, Edit, HeaderFooter, MarkKind, Watermark};+use pdfcraft_engine::{Background, Edit, HeaderFooter, MarkKind, Watermark};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum Subset {@@ -138,7 +138,7 @@ fn rgb32(c: [f64; 3]) -> Color32 {}/// The dialog for `kind`; returns (apply, cancel).-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens, kind: MarkKind) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens, kind: MarkKind) -> (bool, bool) {let Some((i, id)) = app.active_ids() else { return (false, true) };let current = app.views[i].current;let Some(doc) = app.session.get(id) else { return (false, true) };@@ -392,9 +392,9 @@ pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens, kind:(apply, cancel)}-fn mark_file(d: &MarksDraft) -> Option<printcraft_engine::MarkFile> {+fn mark_file(d: &MarksDraft) -> Option<pdfcraft_engine::MarkFile> {let (name, bytes) = d.file.clone().filter(|_| d.use_file)?;- Some(printcraft_engine::MarkFile { name, bytes, page: d.file_page.max(1) - 1 })+ Some(pdfcraft_engine::MarkFile { name, bytes, page: d.file_page.max(1) - 1 })}/// Source ▸ File: Browse…, the page of a PDF, and the size relative to the page.diff --git a/crates/ui-egui/src/ocr_ui.rs b/crates/ui-egui/src/ocr_ui.rsindex 0e0286a48..e85749f8f 100644--- a/crates/ui-egui/src/ocr_ui.rs+++ b/crates/ui-egui/src/ocr_ui.rs@@ -5,11 +5,11 @@use std::sync::{Arc, Mutex};use egui::{Align, Layout};-use printcraft_engine::DocId;-use printcraft_engine::ocr::{LANGUAGES, OcrPage, OcrSettings};+use pdfcraft_engine::DocId;+use pdfcraft_engine::ocr::{LANGUAGES, OcrPage, OcrSettings};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};/// Which pages to read.#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -58,9 +58,9 @@ pub struct OcrRun {pub progress: Arc<Mutex<OcrProgress>>,}-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {let pages = app.active_ids().and_then(|(_, id)| app.session.get(id)).map_or(1, |d| d.info.pages.len().max(1));- let available = printcraft_engine::ocr::available();+ let available = pdfcraft_engine::ocr::available();let d = &mut app.ocr_draft;d.to = d.to.clamp(1, pages);d.from = d.from.clamp(1, d.to);@@ -113,7 +113,7 @@ pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (b});if !available {ui.label(- egui::RichText::new("Text recognition isn't installed: its models are missing (run `cargo xtask models`, or set PRINTCRAFT_MODELS).")+ egui::RichText::new("Text recognition isn't installed: its models are missing (run `cargo xtask models`, or set PDFCRAFT_MODELS).").small().color(t.text_muted),);@@ -134,7 +134,7 @@ pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (b(go, cancel)}-impl PrintCraftApp {+impl PdfCraftApp {/// Recognize text on the pages chosen in the dialog, in the background.pub fn start_ocr(&mut self) {let Some((vi, id)) = self.active_ids() else { return };@@ -157,7 +157,7 @@ impl PrintCraftApp {let progress = Arc::new(Mutex::new(OcrProgress { total: job.pages.len(), ..Default::default() }));let p = progress.clone();let work = move || {- let result = printcraft_engine::ocr::engine().map(|ocr| {+ let result = pdfcraft_engine::ocr::engine().map(|ocr| {job.run(&ocr, |done, total| {let Ok(mut s) = p.lock() else { return false };s.done = done;@@ -173,7 +173,7 @@ impl PrintCraftApp {if self.run_inline {work();} else {- std::thread::Builder::new().name("printcraft-ocr".into()).spawn(work).ok();+ std::thread::Builder::new().name("pdfcraft-ocr".into()).spawn(work).ok();}#[cfg(target_arch = "wasm32")]work();@@ -200,14 +200,14 @@ impl PrintCraftApp {let p = progress.clone();let work = move || {let (mut ok, mut words, mut failed) = (0, 0, Vec::new());- match printcraft_engine::ocr::engine() {+ match pdfcraft_engine::ocr::engine() {Err(e) => failed.push(e),Ok(ocr) => {for (i, (name, bytes)) in files.into_iter().enumerate() {if let Ok(mut s) = p.lock() {s.done = i;}- let r = printcraft_engine::ocr::recognize_file(&name, Arc::new(bytes), None, settings.clone(), &ocr, |_, _| true);+ let r = pdfcraft_engine::ocr::recognize_file(&name, Arc::new(bytes), None, settings.clone(), &ocr, |_, _| true);let saved = r.and_then(|r| {#[cfg(not(target_arch = "wasm32"))]crate::editing::write_atomically(&dir.join(&name).to_string_lossy(), &r.bytes).map_err(|e| e.to_string())?;@@ -238,7 +238,7 @@ impl PrintCraftApp {if self.run_inline {work();} else {- std::thread::Builder::new().name("printcraft-ocr-files".into()).spawn(work).ok();+ std::thread::Builder::new().name("pdfcraft-ocr-files".into()).spawn(work).ok();}#[cfg(target_arch = "wasm32")]work();diff --git a/crates/ui-egui/src/optimize_ui.rs b/crates/ui-egui/src/optimize_ui.rsindex ffbf25377..339fbaaef 100644--- a/crates/ui-egui/src/optimize_ui.rs+++ b/crates/ui-egui/src/optimize_ui.rs@@ -2,11 +2,11 @@//! Discard User Data and Clean Up panels. The result is saved as a copy, like Reduce File Size.use egui::{Align, Layout};-use printcraft_engine::Hidden;-use printcraft_engine::optimize::{Compression, ImageSettings, QUALITIES, Settings};+use pdfcraft_engine::Hidden;+use pdfcraft_engine::optimize::{Compression, ImageSettings, QUALITIES, Settings};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum OptimizeTab {@@ -154,7 +154,7 @@ pub(crate) fn body(ui: &mut egui::Ui, d: &mut OptimizeDraft, t: &Tokens) -> (boo}/// Audit Space Usage: bytes and share of the file per kind of content.-pub(crate) fn audit_body(ui: &mut egui::Ui, rows: &[printcraft_engine::optimize::SpaceUse], t: &Tokens) -> bool {+pub(crate) fn audit_body(ui: &mut egui::Ui, rows: &[pdfcraft_engine::optimize::SpaceUse], t: &Tokens) -> bool {ui.label(egui::RichText::new("Space Audit").font(crate::theme::semibold(18.0)));ui.add_space(8.0);egui::Grid::new("space-audit").num_columns(3).striped(true).spacing([24.0, 4.0]).show(ui, |ui| {@@ -180,7 +180,7 @@ pub(crate) fn audit_body(ui: &mut egui::Ui, rows: &[printcraft_engine::optimize:ok}-impl PrintCraftApp {+impl PdfCraftApp {/// Optimize PDF with the dialog's choices and save the copy.pub fn optimize_with_draft(&mut self) {let Some((_, id)) = self.active_ids() else { return };diff --git a/crates/ui-egui/src/pageboxes.rs b/crates/ui-egui/src/pageboxes.rsindex b28002821..05c7d9a26 100644--- a/crates/ui-egui/src/pageboxes.rs+++ b/crates/ui-egui/src/pageboxes.rs@@ -4,10 +4,10 @@//! millimetres, and the pages. A preview shows the current page's media box and the new box.use egui::{Align, Color32, CornerRadius, Layout, Rect, Stroke, pos2, vec2};-use printcraft_engine::{BoxSpec, Edit, PageBox};+use pdfcraft_engine::{BoxSpec, Edit, PageBox};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum Unit {@@ -87,7 +87,7 @@ fn box_index(b: PageBox) -> usize {}/// Draw the dialog body; returns (apply, cancel).-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {let Some((i, id)) = app.active_ids() else { return (false, true) };let current = app.views[i].current;let Some(doc) = app.session.get(id) else { return (false, true) };diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rsindex f307f54d4..5f1a3877c 100644--- a/crates/ui-egui/src/palette.rs+++ b/crates/ui-egui/src/palette.rs@@ -2,10 +2,10 @@//! catalogue, with a fuzzy-ish substring match.use egui::{Align2, CornerRadius, Rect, Sense, Stroke, vec2};-use printcraft_engine::catalog::{Availability, TOOL_GROUPS};+use pdfcraft_engine::catalog::{Availability, TOOL_GROUPS};use crate::theme::{self, Tokens};-use crate::{LeftPanel, PrintCraftApp, icons};+use crate::{LeftPanel, PdfCraftApp, icons};struct Hit {/// The tool panel to open (tools and catalogue items); `None` for plain commands.@@ -30,7 +30,7 @@ fn score(hay: &str, needle: &str) -> Option<usize> {needle.chars().all(|c| it.any(|x| x == c)).then_some(100)}-pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {+pub fn show(app: &mut PdfCraftApp, ctx: &egui::Context) {if !app.palette_open {return;}@@ -43,8 +43,8 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {let mut hits: Vec<(usize, Hit)> = Vec::new();let mac = cfg!(target_os = "macos") || cfg!(target_arch = "wasm32");let active = app.active_ids().map(|(_, id)| id);- for spec in printcraft_engine::commands::COMMANDS {- let label = printcraft_engine::commands::current_label(spec, &app.session, active);+ for spec in pdfcraft_engine::commands::COMMANDS {+ let label = pdfcraft_engine::commands::current_label(spec, &app.session, active);if let Some(s) = score(&label, &q).or_else(|| score(spec.id, &q).map(|s| s + 50)) {hits.push((s,@@ -75,7 +75,7 @@ pub fn show(app: &mut PrintCraftApp, ctx: &egui::Context) {}for sec in g.sections {for i in sec.items {- if printcraft_engine::commands::command(i.command).is_some() {+ if pdfcraft_engine::commands::command(i.command).is_some() {continue; // listed above as a command}if let Some(s) = score(i.label, &q).or_else(|| score(i.command, &q).map(|s| s + 50)) {diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rsindex ba6fab45c..8f05b4133 100644--- a/crates/ui-egui/src/panels.rs+++ b/crates/ui-egui/src/panels.rs@@ -2,11 +2,11 @@//! right-hand panels (Comments, Bookmarks, Pages, Fields, Layers, Attachments).use egui::{Align, Align2, Color32, CornerRadius, Layout, Rect, Sense, Stroke, pos2, vec2};-use printcraft_engine::catalog::{self, Availability, TOOL_GROUPS, ToolGroup};-use printcraft_render::{DocInfo, FieldKind, OutlineItem};+use pdfcraft_engine::catalog::{self, Availability, TOOL_GROUPS, ToolGroup};+use pdfcraft_render::{DocInfo, FieldKind, OutlineItem};use crate::theme::{self, Tokens};-use crate::{LeftPanel, PrintCraftApp, RightPanel, icons, widgets};+use crate::{LeftPanel, PdfCraftApp, RightPanel, icons, widgets};const COLLAPSED_TOOLS: usize = 14;@@ -14,7 +14,7 @@ fn hue(g: &ToolGroup) -> Color32 {Color32::from_rgb(g.hue[0], g.hue[1], g.hue[2])}-pub fn left_panel(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+pub fn left_panel(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());egui::Panel::left("tool_panel").resizable(false)@@ -52,7 +52,7 @@ fn panel_header(ui: &mut egui::Ui, t: &Tokens, title: &str, back: bool) -> (bool(go_back, close)}-fn all_tools(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {+fn all_tools(app: &mut PdfCraftApp, ui: &mut egui::Ui, t: &Tokens) {let (_, close) = panel_header(ui, t, "All tools", false);if close {app.left_open = false;@@ -108,7 +108,7 @@ fn tool_row(ui: &mut egui::Ui, t: &Tokens, g: &ToolGroup) -> egui::Response {resp.on_hover_text(tip)}-fn tool_detail(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens, g: &'static ToolGroup) {+fn tool_detail(app: &mut PdfCraftApp, ui: &mut egui::Ui, t: &Tokens, g: &'static ToolGroup) {let (back, close) = panel_header(ui, t, g.label, true);if back {app.left = LeftPanel::AllTools;@@ -210,8 +210,8 @@ fn tool_detail(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens, g: &'stat/// Add a stamp: Dynamic, Sign Here and Standard Business stamps; click one, then click on the/// page to place it.-fn stamp_palette(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {- use printcraft_engine::{StampGroup, StampKind};+fn stamp_palette(app: &mut PdfCraftApp, ui: &mut egui::Ui, t: &Tokens) {+ use pdfcraft_engine::{StampGroup, StampKind};ui.label(egui::RichText::new("Choose a stamp, then click on the page to place it.").small().color(t.text_faint));egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {for (group, title) in@@ -272,7 +272,7 @@ fn stamp_palette(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {/// Edit a PDF ▸ Format text: for the selected added text (one undoable change), or the style/// new text gets.-fn format_section(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {+fn format_section(app: &mut PdfCraftApp, ui: &mut egui::Ui, t: &Tokens) {// Editing a paragraph of existing text: its formatting, applied as it changes.if let Some((i, _)) = app.active_ids()&& let Some(ed) = app.views[i].line_editor.clone()@@ -285,7 +285,7 @@ fn format_section(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {}changed |= crate::edit_text_ui::extras_panel(ui, &mut ed.extras);if changed {- let edit = printcraft_engine::Edit::EditTextBlock { page: ed.page, block: ed.block, text: ed.text.clone(), style: ed.style() };+ let edit = pdfcraft_engine::Edit::EditTextBlock { page: ed.page, block: ed.block, text: ed.text.clone(), style: ed.style() };if app.apply_edit(edit) {ed.applied();if let Some(doc) = app.session.get(app.views[i].id)@@ -304,14 +304,14 @@ fn format_section(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {let (page, index) = app.views[i].content.selected?;let doc = app.session.get(id)?;match &doc.added.iter().filter(|a| a.page == page).nth(index)?.content {- printcraft_engine::AddedContent::Image(img) => Some((page, index, img.clone())),+ pdfcraft_engine::AddedContent::Image(img) => Some((page, index, img.clone())),_ => None,}});if let Some((page, index, img)) = image {match crate::content_ui::image_panel(ui, t, &img) {Some(crate::content_ui::ImageAction::Update(content)) => {- app.apply_edit(printcraft_engine::Edit::UpdateContent { page, index, content });+ app.apply_edit(pdfcraft_engine::Edit::UpdateContent { page, index, content });}Some(crate::content_ui::ImageAction::Replace) => app.replace_image_dialog(page, index),None => {}@@ -325,15 +325,15 @@ fn format_section(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {let doc = app.session.get(id)?;let a = doc.added.iter().filter(|a| a.page == page).nth(index)?;match &a.content {- printcraft_engine::AddedContent::Text(text) => Some((page, index, text.clone())),+ pdfcraft_engine::AddedContent::Text(text) => Some((page, index, text.clone())),_ => None,}});match selected {Some((page, index, text)) => {if let Some(style) = crate::content_ui::format_panel(ui, t, &text) {- app.text_style = printcraft_engine::AddedText { text: String::new(), rect: [0.0; 4], ..style.clone() };- app.apply_edit(printcraft_engine::Edit::UpdateContent { page, index, content: printcraft_engine::AddedContent::Text(style) });+ app.text_style = pdfcraft_engine::AddedText { text: String::new(), rect: [0.0; 4], ..style.clone() };+ app.apply_edit(pdfcraft_engine::Edit::UpdateContent { page, index, content: pdfcraft_engine::AddedContent::Text(style) });}}None if app.quick_tool == crate::QuickTool::AddText => {@@ -355,7 +355,7 @@ pub(crate) enum Nav {Flash(usize, [f32; 4]),}-pub fn right_panel(app: &mut PrintCraftApp, ui: &mut egui::Ui) {+pub fn right_panel(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());let Some((index, id)) = app.active_ids() else { return };let Some(panel) = app.right else { return };@@ -365,7 +365,7 @@ pub fn right_panel(app: &mut PrintCraftApp, ui: &mut egui::Ui) {let mut attachment_action: Option<(usize, bool)> = None; // (index, open instead of save)let mut bm_action: Option<BmAction> = None;let mut bm_expand: Option<usize> = None;- let mut panel_edit: Option<printcraft_engine::Edit> = None;+ let mut panel_edit: Option<pdfcraft_engine::Edit> = None;let mut panel_command: Option<&'static str> = None;let mut sig_action: Option<crate::sign_ui::PanelAction> = None;let mut a11y_action: Option<crate::a11y_ui::PanelAction> = None;@@ -519,7 +519,7 @@ pub fn right_panel(app: &mut PrintCraftApp, ui: &mut egui::Ui) {ui.set_width(ui.available_width() - 70.0);ui.add(egui::Label::new(egui::RichText::new(&a.name).font(theme::medium(13.0))).truncate());let mut meta = a.size.map(human_size).unwrap_or_default();- if let printcraft_render::AttachmentSource::Annotation { page, .. } = a.source {+ if let pdfcraft_render::AttachmentSource::Annotation { page, .. } = a.source {meta = format!("{meta} · on page {}", info.pages.get(page).map(|p| p.label.as_str()).unwrap_or("?"));}if let Some(d) = &a.description {@@ -783,10 +783,10 @@ fn fields(ui: &mut egui::Ui,t: &Tokens,info: &DocInfo,- form: &[printcraft_engine::FormField],+ form: &[pdfcraft_engine::FormField],preparing: bool,nav: &mut Option<Nav>,- edit: &mut Option<printcraft_engine::Edit>,+ edit: &mut Option<pdfcraft_engine::Edit>,) {if info.fields.is_empty() {empty(ui, t, "text-cursor-input", "This document has no form fields.");@@ -846,7 +846,7 @@ fn fields(}icons::paint(ui, r.shrink(3.0), icon, 15.0, t.icon);if b.on_hover_text(tip).clicked() {- *edit = Some(printcraft_engine::Edit::MoveInTabOrder { name: f.name.clone(), earlier });+ *edit = Some(pdfcraft_engine::Edit::MoveInTabOrder { name: f.name.clone(), earlier });}}}diff --git a/crates/ui-egui/src/prepare.rs b/crates/ui-egui/src/prepare.rsindex e8c6dc277..d370ebfeb 100644--- a/crates/ui-egui/src/prepare.rs+++ b/crates/ui-egui/src/prepare.rs@@ -6,9 +6,9 @@//! its name; clicks select fields instead of filling them in, as in Acrobat.use egui::{Color32, CornerRadius, Pos2, Rect, Stroke, vec2};-use printcraft_engine::form_scripts::{CalcOp, Calculate, DATE_PRESETS, Format, TIME_PRESETS, Validate, format_value};-use printcraft_engine::{BorderStyle, Edit, FieldFont, FieldLook, FieldProps, FormField, FormFieldKind, NewField};-use printcraft_render::DocInfo;+use pdfcraft_engine::form_scripts::{CalcOp, Calculate, DATE_PRESETS, Format, TIME_PRESETS, Validate, format_value};+use pdfcraft_engine::{BorderStyle, Edit, FieldFont, FieldLook, FieldProps, FormField, FormFieldKind, NewField};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};use crate::theme;@@ -552,7 +552,7 @@ pub(crate) fn after_refresh(view: &mut DocView, form: &[FormField]) {// ───────────────────────────────────────────────────────────────────────── Field Properties-impl crate::PrintCraftApp {+impl crate::PdfCraftApp {/// Open Field Properties for a field of the active document.pub fn open_field_props(&mut self, name: &str, widget: usize) {let Some((_, id)) = self.active_ids() else { return };@@ -604,7 +604,7 @@ pub const ACTION_KINDS: [&str; 8] = [/// Actions tab: the action being added.#[derive(Clone, Debug, PartialEq)]pub struct ActionDraft {- pub trigger: printcraft_engine::FieldTrigger,+ pub trigger: pdfcraft_engine::FieldTrigger,pub kind: usize,/// The script, URL, field names (comma-separated), menu item or page number.pub text: String,@@ -612,13 +612,13 @@ pub struct ActionDraft {impl Default for ActionDraft {fn default() -> Self {- ActionDraft { trigger: printcraft_engine::FieldTrigger::MouseUp, kind: 0, text: String::new() }+ ActionDraft { trigger: pdfcraft_engine::FieldTrigger::MouseUp, kind: 0, text: String::new() }}}impl ActionDraft {- pub fn action(&self) -> Result<printcraft_engine::FieldAction, String> {- use printcraft_engine::FieldAction as A;+ pub fn action(&self) -> Result<pdfcraft_engine::FieldAction, String> {+ use pdfcraft_engine::FieldAction as A;let t = self.text.trim();let names = || t.split(',').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect::<Vec<_>>();Ok(match self.kind {@@ -668,14 +668,14 @@ pub struct FieldDraft {pub position: [f64; 4],pub look: Option<FieldLook>,/// Check boxes and radio buttons: the mark when on (Options tab).- pub check_style: Option<printcraft_engine::CheckStyle>,+ pub check_style: Option<pdfcraft_engine::CheckStyle>,pub format: Format,pub validate: Validate,pub calculate: Calculate,/// Every other field's name (the Calculate tab picks from them).pub others: Vec<String>,/// Actions tab: each trigger's action, and the one being added.- pub actions: Vec<(printcraft_engine::FieldTrigger, printcraft_engine::FieldAction)>,+ pub actions: Vec<(pdfcraft_engine::FieldTrigger, pdfcraft_engine::FieldAction)>,pub new_action: ActionDraft,original: Box<Option<FieldDraft>>,}@@ -696,8 +696,8 @@ impl FieldDraft {name: f.name.rsplit('.').next().unwrap_or(&f.name).to_string(),tooltip: f.tooltip.clone().unwrap_or_default(),read_only: f.read_only(),- required: f.has(printcraft_engine::field_flags::REQUIRED),- multiline: f.has(printcraft_engine::field_flags::MULTILINE),+ required: f.has(pdfcraft_engine::field_flags::REQUIRED),+ multiline: f.has(pdfcraft_engine::field_flags::MULTILINE),limit: f.max_len.is_some(),max_len: f.max_len.unwrap_or(0),options: f.options.iter().map(|(_, d)| d.clone()).collect(),@@ -781,7 +781,7 @@ impl FieldDraft {/// The `/Ff` bits the Options tab edits.const OPTION_FLAGS: [u32; 10] = {- use printcraft_engine::field_flags as ff;+ use pdfcraft_engine::field_flags as ff;[ff::DO_NOT_SCROLL,ff::RICH_TEXT,@@ -936,7 +936,7 @@ pub(crate) fn body(ui: &mut egui::Ui, d: &mut FieldDraft, t: &crate::theme::TokeFieldTab::Actions => actions_tab(ui, d, t),FieldTab::Options => match d.kind {FormFieldKind::Text => {- use printcraft_engine::field_flags as ff;+ use pdfcraft_engine::field_flags as ff;egui::Grid::new("text-options").num_columns(2).spacing([12.0, 8.0]).show(ui, |ui| {ui.label("Alignment:");egui::ComboBox::from_id_salt("quadding").selected_text(["Left", "Center", "Right"][d.quadding.clamp(0, 2) as usize]).show_ui(@@ -979,7 +979,7 @@ pub(crate) fn body(ui: &mut egui::Ui, d: &mut FieldDraft, t: &crate::theme::Toke});}FormFieldKind::CheckBox | FormFieldKind::Radio => {- use printcraft_engine::field_flags as ff;+ use pdfcraft_engine::field_flags as ff;let on = d.on_state.clone();ui.label(format!("Export Value: {on}"));let mut checked = !d.default.is_empty() && d.default == on;@@ -993,7 +993,7 @@ pub(crate) fn body(ui: &mut egui::Ui, d: &mut FieldDraft, t: &crate::theme::Tokeegui::ComboBox::from_id_salt("check-style").selected_text(style.label()).show_ui(ui, |ui| {- for s in printcraft_engine::CheckStyle::ALL {+ for s in pdfcraft_engine::CheckStyle::ALL {ui.selectable_value(style, s, s.label());}})@@ -1043,7 +1043,7 @@ pub(crate) fn body(ui: &mut egui::Ui, d: &mut FieldDraft, t: &crate::theme::Tokeif d.options.is_empty() {ui.label(egui::RichText::new("Add the choices people pick from.").color(t.text_muted));}- use printcraft_engine::field_flags as ff;+ use pdfcraft_engine::field_flags as ff;ui.add_space(6.0);ui.horizontal(|ui| {ui.label("Default:");@@ -1288,7 +1288,7 @@ fn validate_tab(ui: &mut egui::Ui, d: &mut FieldDraft) {}fn actions_tab(ui: &mut egui::Ui, d: &mut FieldDraft, t: &crate::theme::Tokens) {- use printcraft_engine::FieldTrigger as T;+ use pdfcraft_engine::FieldTrigger as T;ui.label(egui::RichText::new("Add an Action").font(theme::semibold(13.0)));let a = &mut d.new_action;egui::Grid::new("field-actions-add").num_columns(2).spacing([12.0, 8.0]).show(ui, |ui| {diff --git a/crates/ui-egui/src/print_ui.rs b/crates/ui-egui/src/print_ui.rsindex 9d5a06824..abea25716 100644--- a/crates/ui-egui/src/print_ui.rs+++ b/crates/ui-egui/src/print_ui.rs@@ -4,10 +4,10 @@//! sheets. Printing sends the print-ready PDF to the system spooler; "Save as PDF" writes it.use egui::{Color32, Pos2, Rect, Stroke, pos2, vec2};-use printcraft_engine::print::{self, Binding, BookletSubset, Content, Layout, Orientation, PAPERS, PageOrder, SizeMode, Subset, spool};+use pdfcraft_engine::print::{self, Binding, BookletSubset, Content, Layout, Orientation, PAPERS, PageOrder, SizeMode, Subset, spool};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum Which {@@ -129,7 +129,7 @@ impl PrintDraft {}}-impl PrintCraftApp {+impl PdfCraftApp {pub fn open_print(&mut self) {let Some((i, _)) = self.active_ids() else { return };let printers = spool::printers();diff --git a/crates/ui-egui/src/protect.rs b/crates/ui-egui/src/protect.rsindex 9af4363cf..d386ca300 100644--- a/crates/ui-egui/src/protect.rs+++ b/crates/ui-egui/src/protect.rs@@ -3,10 +3,10 @@//! printing, changes, copying, screen readers). Execution plan M8.1.use egui::{Align, Color32, Layout};-use printcraft_engine::{Changes, Edit, Printing, Protection};+use pdfcraft_engine::{Changes, Edit, Printing, Protection};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};/// The dialog's state while it is open.#[derive(Clone, Debug, PartialEq)]@@ -32,7 +32,7 @@ impl ProtectDraft {Some("Type a password.")} else if self.password != self.confirm {Some("The passwords don't match.")- } else if self.protection.algorithm != printcraft_engine::Algorithm::Aes256 && !self.password.chars().all(|c| (' '..='~').contains(&c)) {+ } else if self.protection.algorithm != pdfcraft_engine::Algorithm::Aes256 && !self.password.chars().all(|c| (' '..='~').contains(&c)) {Some("This compatibility level supports only plain ASCII passwords.")} else {None@@ -90,8 +90,8 @@ fn radio(ui: &mut egui::Ui, t: &Tokens, on: bool, label: &str) -> egui::Response}/// Draw the dialog body; returns (apply, cancel).-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {- use printcraft_engine::Algorithm as A;+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {+ use pdfcraft_engine::Algorithm as A;let d = &mut app.protect_draft;ui.label(egui::RichText::new("Protect Using Password").font(theme::semibold(18.0)));ui.add_space(4.0);diff --git a/crates/ui-egui/src/recovery.rs b/crates/ui-egui/src/recovery.rsindex 1a4a172f5..cc4d6974a 100644--- a/crates/ui-egui/src/recovery.rs+++ b/crates/ui-egui/src/recovery.rs@@ -11,7 +11,7 @@use std::path::{Path, PathBuf};-use crate::PrintCraftApp;+use crate::PdfCraftApp;/// How often unsaved changes are written to the recovery folder.pub const AUTOSAVE_SECS: f64 = 60.0;@@ -40,17 +40,17 @@ impl RecoveryStore {Self { dir: dir.into() }}- /// The platform's per-user data folder: `~/Library/Application Support/PrintCraft/Recovery`- /// (macOS), `%LOCALAPPDATA%\PrintCraft\Recovery` (Windows), or- /// `$XDG_DATA_HOME/printcraft/recovery` / `~/.local/share/printcraft/recovery` (others).+ /// The platform's per-user data folder: `~/Library/Application Support/PdfCraft/Recovery`+ /// (macOS), `%LOCALAPPDATA%\PdfCraft\Recovery` (Windows), or+ /// `$XDG_DATA_HOME/pdfcraft/recovery` / `~/.local/share/pdfcraft/recovery` (others).pub fn default_dir() -> Option<PathBuf> {let env = |k: &str| std::env::var_os(k).filter(|v| !v.is_empty()).map(PathBuf::from);if cfg!(target_os = "macos") {- env("HOME").map(|h| h.join("Library/Application Support/PrintCraft/Recovery"))+ env("HOME").map(|h| h.join("Library/Application Support/PdfCraft/Recovery"))} else if cfg!(windows) {- env("LOCALAPPDATA").map(|d| d.join("PrintCraft").join("Recovery"))+ env("LOCALAPPDATA").map(|d| d.join("PdfCraft").join("Recovery"))} else {- env("XDG_DATA_HOME").or_else(|| env("HOME").map(|h| h.join(".local/share"))).map(|d| d.join("printcraft/recovery"))+ env("XDG_DATA_HOME").or_else(|| env("HOME").map(|h| h.join(".local/share"))).map(|d| d.join("pdfcraft/recovery"))}}@@ -114,7 +114,7 @@ fn now_secs() -> u64 {std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0)}-impl PrintCraftApp {+impl PdfCraftApp {/// Turn on autosave into `store`, and look for documents a previous session left behind.pub fn enable_recovery(&mut self, store: RecoveryStore) {self.recoverable = store.list();@@ -137,7 +137,7 @@ impl PrintCraftApp {}/// Drop a document's recovery entry (it was saved, discarded or closed).- pub(crate) fn forget_recovery(&mut self, doc: printcraft_engine::DocId) {+ pub(crate) fn forget_recovery(&mut self, doc: pdfcraft_engine::DocId) {if let (Some(store), Some(key)) = (&self.recovery, self.recovery_keys.remove(&doc)) {store.remove(&key);}diff --git a/crates/ui-egui/src/redact_ui.rs b/crates/ui-egui/src/redact_ui.rsindex c405049e8..9e6d7bbec 100644--- a/crates/ui-egui/src/redact_ui.rs+++ b/crates/ui-egui/src/redact_ui.rs@@ -4,12 +4,12 @@//! confirmation, as Acrobat asks) or clear them.use egui::{Color32, CornerRadius, Pos2, Rect, Stroke};-use printcraft_engine::{Edit, NewAnnotation, REDACT_PATTERNS, RedactPattern, Rgb, Shape, Style, rect_quad};-use printcraft_render::DocInfo;+use pdfcraft_engine::{Edit, NewAnnotation, REDACT_PATTERNS, RedactPattern, Rgb, Shape, Style, rect_quad};+use pdfcraft_render::DocInfo;use crate::canvas::{DocView, PageXform};use crate::theme::Tokens;-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};const MARK_RED: Color32 = Color32::from_rgb(0xE3, 0x22, 0x22);@@ -21,7 +21,7 @@ pub struct RedactPrefs {pub use_overlay: bool,pub overlay: String,/// Overlay text font, size (0 = auto), colour, alignment and repetition.- pub look: printcraft_engine::OverlayLook,+ pub look: pdfcraft_engine::OverlayLook,}impl Default for RedactPrefs {@@ -141,7 +141,7 @@ pub(crate) fn paint(ui: &egui::Ui, painter: &egui::Painter, page: usize, view: &}}-impl PrintCraftApp {+impl PdfCraftApp {/// Mark every match of the search draft on every page; returns how many were marked.pub fn redact_search(&mut self) -> usize {let Some((_, id)) = self.active_ids() else { return 0 };@@ -150,15 +150,14 @@ impl PrintCraftApp {if !d.patterns && d.text.trim().is_empty() {return 0;}- let config = printcraft_render::RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..Default::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let config = pdfcraft_render::RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..Default::default() };+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);let mut edits = Vec::new();let author = self.comment_prefs.author.clone();for page in 0..doc.info.pages.len() {- let out =- r.render(printcraft_render::RenderRequest { page, kind: printcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });+ let out = r.render(pdfcraft_render::RenderRequest { page, kind: pdfcraft_render::RequestKind::Text, scale: 1.0, ..Default::default() });let Some(text) = out.text else { continue };- let hits = if d.patterns { text.find_with(|c| printcraft_engine::find_pattern(d.pattern, c)) } else { text.find(&d.text) };+ let hits = if d.patterns { text.find_with(|c| pdfcraft_engine::find_pattern(d.pattern, c)) } else { text.find(&d.text) };for h in hits {let quads: Vec<[f64; 8]> = text.line_rects(h).into_iter().map(|r| doc.info.pages[page].view_rect_to_quad(r)).collect();if !quads.is_empty() {@@ -279,7 +278,7 @@ pub(crate) fn props_body(ui: &mut egui::Ui, d: &mut RedactPrefs, _t: &Tokens) ->ui.label("Font:");ui.add_enabled_ui(on, |ui| {egui::ComboBox::from_id_salt("overlay-font").selected_text(look.font.name()).show_ui(ui, |ui| {- for f in printcraft_engine::OverlayFont::ALL {+ for f in pdfcraft_engine::OverlayFont::ALL {ui.selectable_value(&mut look.font, f, f.name());}});@@ -358,10 +357,10 @@ fn buttons(ui: &mut egui::Ui, ok: &str, primary: bool) -> (bool, bool) {/// something was.#[derive(Clone, Debug, Default, PartialEq)]pub struct HiddenDraft {- pub found: Vec<(printcraft_engine::Hidden, usize, bool)>,+ pub found: Vec<(pdfcraft_engine::Hidden, usize, bool)>,}-impl PrintCraftApp {+impl PdfCraftApp {pub fn open_remove_hidden(&mut self) {let Some((_, id)) = self.active_ids() else { return };let Some(doc) = self.session.get(id) else { return };diff --git a/crates/ui-egui/src/sign_ui.rs b/crates/ui-egui/src/sign_ui.rsindex 7966f318e..2ec998775 100644--- a/crates/ui-egui/src/sign_ui.rs+++ b/crates/ui-egui/src/sign_ui.rs@@ -5,12 +5,12 @@use std::path::PathBuf;use egui::{Align, Color32, CornerRadius, Layout, Pos2, Rect, Stroke, vec2};-use printcraft_engine::sign::{self, Appearance, Certificate, DigitalId, Modification, Name, PrivateKey};-use printcraft_engine::{SignOptions, SignatureInfo, SignatureStatus};+use pdfcraft_engine::sign::{self, Appearance, Certificate, DigitalId, Modification, Name, PrivateKey};+use pdfcraft_engine::{SignOptions, SignatureInfo, SignatureStatus};use crate::canvas::{DocView, PageXform};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, icons, widgets};+use crate::{PdfCraftApp, icons, widgets};/// A digital ID the app knows about (Acrobat: Digital ID files). The file stays where it is;/// its password is asked for at each signing.@@ -123,7 +123,7 @@ pub struct SignView {}/// Drag a signature rectangle on one page (Digitally sign, Certify (visible signature)).-pub(crate) fn page_input(ui: &egui::Ui, resp: &egui::Response, xf: &PageXform, page: usize, info: &printcraft_render::DocInfo, view: &mut DocView) {+pub(crate) fn page_input(ui: &egui::Ui, resp: &egui::Response, xf: &PageXform, page: usize, info: &pdfcraft_render::DocInfo, view: &mut DocView) {let pointer = ui.input(|i| i.pointer.hover_pos());let origin = ui.input(|i| i.pointer.press_origin());if pointer.is_some_and(|p| xf.rect.contains(p)) {@@ -157,7 +157,7 @@ pub(crate) fn page_input(ui: &egui::Ui, resp: &egui::Response, xf: &PageXform, p}}-/// Where new digital IDs are saved: next to the recovery folder (`…/PrintCraft/Digital IDs`).+/// Where new digital IDs are saved: next to the recovery folder (`…/PdfCraft/Digital IDs`).fn id_dir() -> Option<PathBuf> {crate::recovery::RecoveryStore::default_dir().and_then(|d| d.parent().map(|p| p.join("Digital IDs")))}@@ -180,7 +180,7 @@ pub fn entry_for(path: &str, c: &Certificate) -> DigitalIdEntry {}}-impl PrintCraftApp {+impl PdfCraftApp {/// Start signing: the rectangle (or field) is known; show Sign with a Digital ID.pub fn start_signing(&mut self, page: usize, rect: Option<[f64; 4]>, field: Option<String>, certify: Option<u8>) {self.refresh_keychain_ids();@@ -353,7 +353,7 @@ impl PrintCraftApp {}/// Draw the signing dialogs; returns `true` when the dialog should close.-pub(crate) fn dialog(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+pub(crate) fn dialog(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {let Some(step) = app.sign_draft.as_ref().map(|d| d.step) else { return true };match step {SignStep::Choose => choose(ui, app, t),@@ -376,7 +376,7 @@ fn error(ui: &mut egui::Ui, err: &Option<String>) {}}-fn choose(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+fn choose(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {title(ui, "Sign with a Digital ID");ui.label("Choose the digital ID that you want to use for signing:");ui.add_space(6.0);@@ -436,7 +436,7 @@ fn choose(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {close}-fn configure(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+fn configure(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {title(ui, "Configure a Digital ID for Signing");let Some(d) = app.sign_draft.as_mut() else { return true };let mut close = false;@@ -560,7 +560,7 @@ fn preview(ui: &mut egui::Ui, t: &Tokens, name: &str, d: &SignDraft) {ui.painter().galley(egui::pos2(x, inner.center().y - galley.size().y / 2.0), galley, Color32::BLACK);}-fn sign_as(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+fn sign_as(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {let ids = app.digital_ids.clone();let Some(d) = app.sign_draft.as_mut() else { return true };let Some(entry) = d.selected.and_then(|i| ids.get(i)).cloned() else {@@ -612,9 +612,7 @@ fn sign_as(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {ui.end_row();if in_keychain {ui.label("");- ui.label(- egui::RichText::new("The key is in the macOS Keychain, which may ask to allow PrintCraft to use it.").small().color(t.text_muted),- );+ ui.label(egui::RichText::new("The key is in the macOS Keychain, which may ask to allow PdfCraft to use it.").small().color(t.text_muted));} else {let l = ui.label("Digital ID password");let r = ui.add(egui::TextEdit::singleline(&mut d.password).password(true).desired_width(200.0)).labelled_by(l.id);diff --git a/crates/ui-egui/src/stamps_ui.rs b/crates/ui-egui/src/stamps_ui.rsindex 08ea9df4f..99db47af8 100644--- a/crates/ui-egui/src/stamps_ui.rs+++ b/crates/ui-egui/src/stamps_ui.rs@@ -7,7 +7,7 @@ use egui::{Align, Layout};use serde::{Deserialize, Serialize};use crate::theme::{self, Tokens};-use crate::{Dialog, PrintCraftApp, QuickTool, widgets};+use crate::{Dialog, PdfCraftApp, QuickTool, widgets};/// Stamp files larger than this aren't kept in the library (it lives in the app's settings).pub const MAX_STAMP_BYTES: usize = 4 << 20;@@ -50,7 +50,7 @@ pub struct StampDraft {pub name: String,}-pub(crate) fn create_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> (bool, bool) {+pub(crate) fn create_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> (bool, bool) {let categories: Vec<String> = {let mut c: Vec<String> = app.custom_stamps.iter().map(|s| s.category.clone()).collect();c.sort();@@ -96,7 +96,7 @@ pub(crate) fn create_body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens}/// The Custom stamps section of the stamps palette.-pub(crate) fn palette_section(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &Tokens) {+pub(crate) fn palette_section(app: &mut PdfCraftApp, ui: &mut egui::Ui, t: &Tokens) {widgets::section_title(ui, "Custom");let mut remove = None;let mut categories: Vec<String> = app.custom_stamps.iter().map(|s| s.category.clone()).collect();@@ -128,7 +128,7 @@ pub(crate) fn palette_section(app: &mut PrintCraftApp, ui: &mut egui::Ui, t: &To}}-impl PrintCraftApp {+impl PdfCraftApp {/// Create ▸ choose a PDF or an image for a new custom stamp.pub(crate) fn pick_stamp_file(&mut self) {#[cfg(not(target_arch = "wasm32"))]diff --git a/crates/ui-egui/src/standards_ui.rs b/crates/ui-egui/src/standards_ui.rsindex 3bd5fa7c9..69a8e74ed 100644--- a/crates/ui-egui/src/standards_ui.rs+++ b/crates/ui-egui/src/standards_ui.rs@@ -2,10 +2,10 @@//! fixing what can be fixed (Save as PDF/A).use egui::{Align, Layout};-use printcraft_engine::pdfa::{Issue, Level};+use pdfcraft_engine::pdfa::{Issue, Level};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, widgets};+use crate::{PdfCraftApp, widgets};/// The dialog's state: the chosen level and the last result.#[derive(Clone, Debug, PartialEq)]@@ -21,7 +21,7 @@ impl Default for PdfaState {}}-impl PrintCraftApp {+impl PdfCraftApp {pub fn pdfa_verify(&mut self) {let Some((_, id)) = self.active_ids() else { return };let level = self.pdfa.level;@@ -31,7 +31,7 @@ impl PrintCraftApp {pub fn pdfa_convert(&mut self) {let level = self.pdfa.level;- if self.apply_edit(printcraft_engine::Edit::ConvertPdfA { level }) {+ if self.apply_edit(pdfcraft_engine::Edit::ConvertPdfA { level }) {self.pdfa_verify();let left = self.pdfa.issues.as_ref().map_or(0, Vec::len);self.notify(if left == 0 {@@ -44,7 +44,7 @@ impl PrintCraftApp {}/// Returns `true` to close.-pub(crate) fn body(ui: &mut egui::Ui, app: &mut PrintCraftApp, t: &Tokens) -> bool {+pub(crate) fn body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tokens) -> bool {ui.label(egui::RichText::new("PDF/A").font(theme::semibold(18.0)));ui.add_space(6.0);let declared = app.active_ids().and_then(|(_, id)| app.session.get(id)).map(|d| d.standards()).unwrap_or_default();diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rsindex f8c908244..581245f65 100644--- a/crates/ui-egui/src/theme.rs+++ b/crates/ui-egui/src/theme.rs@@ -96,7 +96,7 @@ impl Tokens {}pub fn get(ctx: &egui::Context) -> Self {- ctx.data(|d| d.get_temp::<Tokens>(egui::Id::new("printcraft-theme"))).unwrap_or_else(|| Self::for_kind(ThemeKind::Light))+ ctx.data(|d| d.get_temp::<Tokens>(egui::Id::new("pdfcraft-theme"))).unwrap_or_else(|| Self::for_kind(ThemeKind::Light))}pub fn dark(&self) -> bool {@@ -122,8 +122,8 @@ pub fn font_definitions() -> FontDefinitions {add(&mut fonts, "JetBrainsMono", include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf"));fonts.families.entry(FontFamily::Proportional).or_default().insert(0, "Inter".to_owned());fonts.families.entry(FontFamily::Monospace).or_default().insert(0, "JetBrainsMono".to_owned());- // The same static bytes printcraft-fonts uses for Japanese text in PDFs: one copy, not two.- for face in printcraft_fonts::ui_japanese_fonts() {+ // The same static bytes pdfcraft-fonts uses for Japanese text in PDFs: one copy, not two.+ for face in pdfcraft_fonts::ui_japanese_fonts() {let name = face.name();add(&mut fonts, &name, face.bytes);for family in [FontFamily::Proportional, FontFamily::Monospace] {@@ -151,7 +151,7 @@ pub fn semibold(size: f32) -> FontId {pub fn apply(ctx: &egui::Context, kind: ThemeKind) {let t = Tokens::for_kind(kind);- ctx.data_mut(|d| d.insert_temp(egui::Id::new("printcraft-theme"), t));+ ctx.data_mut(|d| d.insert_temp(egui::Id::new("pdfcraft-theme"), t));let mut v = if t.dark() { Visuals::dark() } else { Visuals::light() };v.panel_fill = t.panel;v.window_fill = t.card;diff --git a/crates/ui-egui/src/updates.rs b/crates/ui-egui/src/updates.rsindex e19a2487e..adeb28574 100644--- a/crates/ui-egui/src/updates.rs+++ b/crates/ui-egui/src/updates.rs@@ -1,18 +1,18 @@//! Help ▸ Check for updates (issue #28): ask for the latest release and offer its download page.//!-//! The desktop app supplies how to ask ([`PrintCraftApp::update_source`]), so this crate has no+//! The desktop app supplies how to ask ([`PdfCraftApp::update_source`]), so this crate has no//! network code; without a source (the web build, tests) the command opens the releases page.-//! PrintCraft never downloads or installs anything itself: the user downloads the new version.+//! PdfCraft never downloads or installs anything itself: the user downloads the new version.//! It asks only when the user does: there is no check at start (the owner's decision).use std::sync::Arc;use egui::{Align, Layout};-use crate::{PrintCraftApp, theme, widgets};+use crate::{PdfCraftApp, theme, widgets};-/// Where every PrintCraft release is listed.-pub const RELEASES_PAGE: &str = "https://github.com/storytold/printcraft/releases";+/// Where every PdfCraft release is listed.+pub const RELEASES_PAGE: &str = "https://github.com/storytold/pdfcraft/releases";/// The latest published release.#[derive(Clone, Debug, PartialEq, Eq)]@@ -62,7 +62,7 @@ pub(crate) struct Updates {pub(crate) open: bool,}-impl PrintCraftApp {+impl PdfCraftApp {/// Help ▸ Check for updates: ask for the latest release and show the outcome.pub fn check_for_updates(&mut self) {let Some(source) = self.update_source.clone() else {@@ -108,7 +108,7 @@ impl PrintCraftApp {}/// The Updates dialog.-pub(crate) fn dialog(app: &mut PrintCraftApp, ctx: &egui::Context) {+pub(crate) fn dialog(app: &mut PdfCraftApp, ctx: &egui::Context) {if !app.updates.open {return;}@@ -136,14 +136,14 @@ pub(crate) fn dialog(app: &mut PrintCraftApp, ctx: &egui::Context) {}Check::Done(Ok(r)) if is_newer(&r.version, current) => {let version = r.version.trim_start_matches(['v', 'V']);- ui.label(egui::RichText::new(format!("PrintCraft {version} is available.")).strong());+ ui.label(egui::RichText::new(format!("PdfCraft {version} is available.")).strong());ui.label(egui::RichText::new(format!("You have version {current}. Download the new version from its release page.")).color(t.text_muted),);download = Some(r.url.clone());}Check::Done(Ok(_)) => {- ui.label(format!("PrintCraft {current} is up to date."));+ ui.label(format!("PdfCraft {current} is up to date."));}Check::Done(Err(e)) => {ui.label(format!("Couldn't check for updates: {e}"));diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rsindex 9121a18b8..ea204925a 100644--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@ -3,7 +3,7 @@use egui::{Align2, Color32, CornerRadius, Rect, Response, Sense, Stroke, vec2};use crate::theme::{self, Tokens};-use crate::{PrintCraftApp, icons};+use crate::{PdfCraftApp, icons};/// A mode-bar tab: text with an underline when active.pub fn mode_tab(ui: &mut egui::Ui, label: &str, active: bool) -> Response {@@ -80,7 +80,7 @@ pub fn section_title(ui: &mut egui::Ui, text: &str) {}/// Transient message at the bottom centre.-pub fn toast(app: &mut PrintCraftApp, ctx: &egui::Context) {+pub fn toast(app: &mut PdfCraftApp, ctx: &egui::Context) {let Some((msg, start)) = app.toast.clone() else { return };let now = ctx.input(|i| i.time);let start = if start == 0.0 { now } else { start };@@ -127,13 +127,13 @@ pub fn artcraft_mark(ui: &mut egui::Ui, size: f32) -> Response {)}-/// Buttons for every community link (`printcraft_engine::links`), Discord first and prominent.+/// Buttons for every community link (`pdfcraft_engine::links`), Discord first and prominent./// Returns the registry command of the one clicked.pub fn community_links(ui: &mut egui::Ui) -> Option<&'static str> {let mut clicked = None;ui.horizontal_wrapped(|ui| {ui.spacing_mut().item_spacing = vec2(8.0, 8.0);- for (i, l) in printcraft_engine::links::LINKS.iter().enumerate() {+ for (i, l) in pdfcraft_engine::links::LINKS.iter().enumerate() {let resp = if i == 0 { icon_pill(ui, l.icon, "Join our Discord", true) } else { icon_pill(ui, l.icon, l.label, false) };if resp.on_hover_text(l.url).clicked() {clicked = Some(l.command);diff --git a/crates/ui-egui/src/zoom_snap.rs b/crates/ui-egui/src/zoom_snap.rsindex 0a4c1e4c5..ad9b9fa66 100644--- a/crates/ui-egui/src/zoom_snap.rs+++ b/crates/ui-egui/src/zoom_snap.rs@@ -2,10 +2,10 @@//! and Edit ▸ Take a Snapshot (drag a rectangle to copy that area as an image).use egui::{Color32, CornerRadius, Pos2, Rect, Stroke};-use printcraft_render::{RenderConfig, RenderRequest, RequestKind, Tile};+use pdfcraft_render::{RenderConfig, RenderRequest, RequestKind, Tile};use crate::canvas::{DocView, PageXform};-use crate::{PrintCraftApp, QuickTool};+use crate::{PdfCraftApp, QuickTool};/// A finished gesture: (page, the rectangle on screen, the same in page view points/// [x0, y0, x1, y1]); a plain click has an empty rectangle.@@ -44,7 +44,7 @@ pub(crate) fn page_input(ui: &egui::Ui, resp: &egui::Response, xf: &PageXform, p}}-impl PrintCraftApp {+impl PdfCraftApp {/// Finish a marquee gesture for the current tool.pub(crate) fn finish_marquee(&mut self, index: usize, done: Marquee) {let (page, rect, view_rect) = done;@@ -80,7 +80,7 @@ impl PrintCraftApp {let page = view.current;let doc = self.session.get(view.id).ok_or("no document")?;let config = RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..RenderConfig::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);// About 800 px along the longer side is plenty to find the margins.let size = doc.info.pages.get(page).map_or(792.0, |p| p.width.max(p.height));let out = r.render(RenderRequest { page, kind: RequestKind::Pixels, tile: None, scale: (800.0 / size).clamp(0.1, 4.0), tag: 0 });@@ -125,7 +125,7 @@ impl PrintCraftApp {return Err("the area is too large at this zoom".into());}let config = RenderConfig { password: doc.password.as_deref().map(std::sync::Arc::from), ..RenderConfig::default() };- let mut r = printcraft_render::PageRenderer::new(doc.bytes.clone(), config);+ let mut r = pdfcraft_render::PageRenderer::new(doc.bytes.clone(), config);let out = r.render(RenderRequest { page, kind: RequestKind::Pixels, tile: Some(tile), scale, tag: 0 });if let Some(e) = out.error {return Err(e);diff --git a/crates/ui-egui/tests/accessibility.rs b/crates/ui-egui/tests/accessibility.rsindex 0eb07a872..93074a973 100644--- a/crates/ui-egui/tests/accessibility.rs+++ b/crates/ui-egui/tests/accessibility.rs@@ -3,8 +3,8 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::a11y::{Rule, Status};-use printcraft_ui_egui::{Dialog, PrintCraftApp, RightPanel};+use pdfcraft_engine::a11y::{Rule, Status};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp, RightPanel};const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -17,11 +17,11 @@ endstream endobjtrailer << /Root 1 0 R >>%%EOF";-fn status(h: &Harness<'static, PrintCraftApp>, rule: Rule) -> Status {+fn status(h: &Harness<'static, PdfCraftApp>, rule: Rule) -> Status {h.state().a11y.report.as_ref().unwrap().1.result(rule).unwrap().status}-fn right_click(h: &mut Harness<'static, PrintCraftApp>, label: &str) {+fn right_click(h: &mut Harness<'static, PdfCraftApp>, label: &str) {let at = h.get_by_label(label).rect().center();h.hover_at(at);h.run_steps(1);@@ -32,12 +32,12 @@ fn right_click(h: &mut Harness<'static, PrintCraftApp>, label: &str) {#[test]fn checking_fixing_skipping_and_reporting() {- let dir = std::env::temp_dir().join(format!("printcraft-a11y-ui-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-a11y-ui-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);std::fs::create_dir_all(&dir).unwrap();let d = dir.clone();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("notes.pdf", None, FIXTURE.to_vec()).unwrap();app.export_dir_override = Some(d.to_string_lossy().into_owned());app@@ -61,7 +61,7 @@ fn checking_fixing_skipping_and_reporting() {h.run_steps(3);assert_eq!(status(&h, Rule::Title), Status::Passed);assert!(matches!(h.state().dialog, Some(Dialog::Properties(_))));- assert_eq!(h.state().window_title, "notes — PrintCraft");+ assert_eq!(h.state().window_title, "notes — PdfCraft");h.state_mut().dialog = None;h.run_steps(2);// Skip a rule; it stays skipped when checking again.@@ -109,7 +109,7 @@ trailer << /Root 1 0 R >>#[test]fn setting_alternate_text_figure_by_figure() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("figures.pdf", None, FIGURES.to_vec()).unwrap();app});diff --git a/crates/ui-egui/tests/actions.rs b/crates/ui-egui/tests/actions.rsindex ae30235d2..a1ed7ed2e 100644--- a/crates/ui-egui/tests/actions.rs+++ b/crates/ui-egui/tests/actions.rs@@ -3,20 +3,20 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::Session;-use printcraft_engine::actions::Step;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_engine::Session;+use pdfcraft_engine::actions::Step;+use pdfcraft_ui_egui::PdfCraftApp;#[test]fn run_and_create_actions() {- let dir = std::env::temp_dir().join(format!("printcraft-actions-ui-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-actions-ui-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);std::fs::create_dir_all(dir.join("out")).unwrap();let src = Session::new().create_from_text("t", "Draft report").unwrap();std::fs::write(dir.join("r.pdf"), &*src).unwrap();let d = dir.clone();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.run_inline = true;app.export_dir_override = Some(d.join("out").to_string_lossy().into_owned());app.action_files_override = Some(vec![d.join("r.pdf").to_string_lossy().into_owned()]);@@ -48,7 +48,7 @@ fn run_and_create_actions() {assert_eq!(h.state().custom_actions.len(), 1);h.get_by_label("1. Add watermark: DRAFT");let saved = h.state().persist();- let mut fresh = PrintCraftApp::new();+ let mut fresh = PdfCraftApp::new();fresh.restore(&saved);assert_eq!(fresh.custom_actions, h.state().custom_actions);h.get_by_label("Start").click();diff --git a/crates/ui-egui/tests/bookmarks.rs b/crates/ui-egui/tests/bookmarks.rsindex 5477ff8b7..ea93ad356 100644--- a/crates/ui-egui/tests/bookmarks.rs+++ b/crates/ui-egui/tests/bookmarks.rs@@ -3,7 +3,7 @@use egui::{Key, Modifiers};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;const PAGES: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -14,9 +14,9 @@ const PAGES: &[u8] = b"%PDF-1.7trailer << /Root 1 0 R >>%%EOF";-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("pages.pdf", None, PAGES.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();app.set_option("panel", "bookmarks").unwrap();@@ -26,9 +26,9 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn outline(h: &Harness<'static, PrintCraftApp>) -> Vec<(String, Option<usize>, usize)> {+fn outline(h: &Harness<'static, PdfCraftApp>) -> Vec<(String, Option<usize>, usize)> {let id = h.state().views[0].id;- fn flat(items: &[printcraft_render::OutlineItem], depth: usize, out: &mut Vec<(String, Option<usize>, usize)>) {+ fn flat(items: &[pdfcraft_render::OutlineItem], depth: usize, out: &mut Vec<(String, Option<usize>, usize)>) {for i in items {out.push((i.title.clone(), i.page, depth));flat(&i.children, depth + 1, out);@@ -40,12 +40,12 @@ fn outline(h: &Harness<'static, PrintCraftApp>) -> Vec<(String, Option<usize>, u}/// The inline rename editor (the text field, not its inner text run).-fn field<'a>(h: &'a Harness<'static, PrintCraftApp>, value: &'a str) -> egui_kittest::Node<'a> {+fn field<'a>(h: &'a Harness<'static, PdfCraftApp>, value: &'a str) -> egui_kittest::Node<'a> {h.query_all_by_value(value).next().unwrap_or_else(|| panic!("no editor showing {value:?}"))}/// Add a bookmark with ⌘B at the current page and name it by typing.-fn add(h: &mut Harness<'static, PrintCraftApp>, title: &str) {+fn add(h: &mut Harness<'static, PdfCraftApp>, title: &str) {h.key_press_modifiers(Modifiers::COMMAND, Key::B);h.run_steps(3);field(h, "Untitled"); // the inline editor is open and focused@@ -57,7 +57,7 @@ fn add(h: &mut Harness<'static, PrintCraftApp>, title: &str) {h.run_steps(3);}-fn menu(h: &mut Harness<'static, PrintCraftApp>, bookmark: &str, item: &str) {+fn menu(h: &mut Harness<'static, PdfCraftApp>, bookmark: &str, item: &str) {h.get_by_label(bookmark).click_secondary();h.run_steps(2);h.get_by_label(item).click();@@ -130,13 +130,13 @@ fn number_pages_dialog_labels_the_selected_pages() {#[test]fn expanding_and_collapsing_all_bookmarks() {- use printcraft_engine::Edit;+ use pdfcraft_engine::Edit;let mut h = harness();for (parent, title) in [(vec![], "Part"), (vec![0], "Chapter"), (vec![0, 0], "Section")] {h.state_mut().apply_edit(Edit::AddBookmark { parent, index: 0, title: title.into(), page: 0 });}h.run_steps(3);- let shown = |h: &Harness<'static, PrintCraftApp>, t: &str| h.query_by_label(t).is_some();+ let shown = |h: &Harness<'static, PdfCraftApp>, t: &str| h.query_by_label(t).is_some();h.get_by_label("Bookmark options").click();h.run_steps(2);h.get_by_label("Expand all bookmarks").click();diff --git a/crates/ui-egui/tests/buttons.rs b/crates/ui-egui/tests/buttons.rsindex a2df9a06b..718aee08a 100644--- a/crates/ui-egui/tests/buttons.rs+++ b/crates/ui-egui/tests/buttons.rs@@ -1,7 +1,7 @@//! Push buttons run their actions (Reset form, Named, …) without a JavaScript engine.use egui_kittest::Harness;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};/// Two pages; page 1 has a text field "name" (filled), a Reset button, a Next page button and a/// Print button (a JavaScript one-liner).@@ -31,12 +31,12 @@ fn fixture() -> Vec<u8> {out}-fn click_field(h: &mut Harness<'static, PrintCraftApp>, name: &str) {+fn click_field(h: &mut Harness<'static, PdfCraftApp>, name: &str) {let p = {let s = h.state();let doc = s.session.get(s.views[0].id).unwrap();let f = doc.form.iter().find(|f| f.name == name).unwrap();- printcraft_ui_egui::forms_ui::field_screen_rect(&s.views[0], &doc.info, f, 0).expect("on screen").center()+ pdfcraft_ui_egui::forms_ui::field_screen_rect(&s.views[0], &doc.info, f, 0).expect("on screen").center()};h.hover_at(p);h.run_steps(1);@@ -49,7 +49,7 @@ fn click_field(h: &mut Harness<'static, PrintCraftApp>, name: &str) {#[test]fn buttons_reset_navigate_and_print() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("buttons.pdf", None, fixture()).unwrap();app.set_option("zoom", "150").unwrap();appdiff --git a/crates/ui-egui/tests/commands.rs b/crates/ui-egui/tests/commands.rsindex 899bc02d6..0fea0bfdf 100644--- a/crates/ui-egui/tests/commands.rs+++ b/crates/ui-egui/tests/commands.rs@@ -4,8 +4,8 @@use egui::{Key, Modifiers};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::commands::COMMANDS;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_engine::commands::COMMANDS;+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};fn fixture(n: usize) -> Vec<u8> {let mut objs: Vec<String> = vec!["<< /Type /Catalog /Pages 2 0 R >>".into()];@@ -32,9 +32,9 @@ fn fixture(n: usize) -> Vec<u8> {out}-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, fixture(3)).unwrap();app});@@ -67,19 +67,19 @@ fn every_registered_command_is_implemented() {if PICKERS.contains(&spec.id) {continue;}- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();if spec.id.starts_with("form.") || spec.id == "comment.flatten" {app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();} else {app.open_bytes("doc.pdf", None, fixture(3)).unwrap();}// Give undo/redo something to do.- app.apply_edit(printcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });+ app.apply_edit(pdfcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });if spec.id == "edit.redo" {app.undo();}if spec.id.starts_with("edit.") && (spec.id.ends_with(".update") || spec.id.ends_with(".remove")) {- use printcraft_engine::{Background, Edit, HeaderFooter, Watermark};+ use pdfcraft_engine::{Background, Edit, HeaderFooter, Watermark};let mut hf = HeaderFooter::default();hf.text[1] = "x".into();app.apply_edit(Edit::AddHeaderFooter { pages: vec![0], settings: hf, replace: false });@@ -97,7 +97,7 @@ fn every_registered_command_is_implemented() {});}if matches!(spec.id, "comment.flatten" | "comment.export" | "comment.summarize") {- use printcraft_engine::{Edit, NewAnnotation, Shape, Style};+ use pdfcraft_engine::{Edit, NewAnnotation, Shape, Style};let shape = Shape::Rectangle { rect: [10.0, 10.0, 50.0, 50.0] };app.apply_edit(Edit::AddAnnotation(NewAnnotation {page: 0,@@ -108,12 +108,9 @@ fn every_registered_command_is_implemented() {}));}if spec.id.starts_with("redact.") {- use printcraft_engine::{Edit, NewAnnotation, Shape, Style};- let shape = Shape::Redact {- quads: vec![printcraft_engine::rect_quad([10.0, 10.0, 50.0, 50.0])],- overlay: String::new(),- look: Default::default(),- };+ use pdfcraft_engine::{Edit, NewAnnotation, Shape, Style};+ let shape =+ Shape::Redact { quads: vec![pdfcraft_engine::rect_quad([10.0, 10.0, 50.0, 50.0])], overlay: String::new(), look: Default::default() };app.apply_edit(Edit::AddAnnotation(NewAnnotation {page: 0,style: Style::default_for(&shape),@@ -123,10 +120,10 @@ fn every_registered_command_is_implemented() {}));}if spec.id == "protect.remove" {- let p = printcraft_engine::Protection { open_password: Some("pw".into()), ..Default::default() };- app.apply_edit(printcraft_engine::Edit::Protect(p));+ let p = pdfcraft_engine::Protection { open_password: Some("pw".into()), ..Default::default() };+ app.apply_edit(pdfcraft_engine::Edit::Protect(p));}- let dir = std::env::temp_dir().join(format!("printcraft-cmd-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-cmd-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();app.save_override = Some(dir.join("out.pdf").to_string_lossy().into_owned());assert!(app.execute(spec.id), "{} is registered but not implemented (or wrongly disabled)", spec.id);@@ -135,7 +132,7 @@ fn every_registered_command_is_implemented() {#[test]fn disabled_commands_explain_themselves() {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();assert!(!app.execute("file.save"));assert_eq!(app.toast.as_ref().map(|t| t.0.as_str()), Some("Open a document first"));app.open_bytes("doc.pdf", None, fixture(2)).unwrap();@@ -158,7 +155,7 @@ fn shortcuts_run_registered_commands() {h.run_steps(2);h.key_press_modifiers(Modifiers::COMMAND | Modifiers::CTRL, Key::H);h.run_steps(2);- assert_eq!(h.state().mode, printcraft_ui_egui::Mode::Read);+ assert_eq!(h.state().mode, pdfcraft_ui_egui::Mode::Read);}#[test]diff --git a/crates/ui-egui/tests/comments.rs b/crates/ui-egui/tests/comments.rsindex f58216f54..51ae14d72 100644--- a/crates/ui-egui/tests/comments.rs+++ b/crates/ui-egui/tests/comments.rs@@ -4,8 +4,8 @@use egui::{Pos2, pos2};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_render::Annotation;-use printcraft_ui_egui::{PrintCraftApp, QuickTool};+use pdfcraft_render::Annotation;+use pdfcraft_ui_egui::{PdfCraftApp, QuickTool};/// Two 300×200 pages of Helvetica text.const TEXT_FIXTURE: &[u8] = b"%PDF-1.7@@ -23,9 +23,9 @@ endstream endobjtrailer << /Root 1 0 R >>%%EOF";-fn harness(setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Harness<'static, PrintCraftApp> {+fn harness(setup: impl FnOnce(&mut PdfCraftApp) + 'static) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("text.pdf", None, TEXT_FIXTURE.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();app.set_option("author", "Tester").unwrap();@@ -37,7 +37,7 @@ fn harness(setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Harness<'static,h}-fn settle(h: &mut Harness<'static, PrintCraftApp>) {+fn settle(h: &mut Harness<'static, PdfCraftApp>) {for _ in 0..200 {h.run_steps(2);if !h.state().render_pending() {@@ -48,12 +48,12 @@ fn settle(h: &mut Harness<'static, PrintCraftApp>) {}/// A point on page 1 in PDF user space → screen (no rotation; MediaBox 300×200).-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).expect("page 1 on screen");pos2(r.left() + x / 300.0 * r.width(), r.top() + (200.0 - y) / 200.0 * r.height())}-fn drag(h: &mut Harness<'static, PrintCraftApp>, from: Pos2, to: Pos2) {+fn drag(h: &mut Harness<'static, PdfCraftApp>, from: Pos2, to: Pos2) {h.hover_at(from);h.run_steps(1);h.drag_at(from);@@ -66,7 +66,7 @@ fn drag(h: &mut Harness<'static, PrintCraftApp>, from: Pos2, to: Pos2) {h.run_steps(3);}-fn click(h: &mut Harness<'static, PrintCraftApp>, p: Pos2) {+fn click(h: &mut Harness<'static, PdfCraftApp>, p: Pos2) {h.hover_at(p);h.run_steps(1);h.drag_at(p);@@ -76,23 +76,23 @@ fn click(h: &mut Harness<'static, PrintCraftApp>, p: Pos2) {}/// Drag between two page points (user space).-fn drag_pt(h: &mut Harness<'static, PrintCraftApp>, a: (f32, f32), b: (f32, f32)) {+fn drag_pt(h: &mut Harness<'static, PdfCraftApp>, a: (f32, f32), b: (f32, f32)) {let (a, b) = (at(h, a.0, a.1), at(h, b.0, b.1));drag(h, a, b);}/// Click a page point (user space).-fn click_pt(h: &mut Harness<'static, PrintCraftApp>, p: (f32, f32)) {+fn click_pt(h: &mut Harness<'static, PdfCraftApp>, p: (f32, f32)) {let p = at(h, p.0, p.1);click(h, p);}/// A text field by its placeholder ("Add a comment", "Add a reply").-fn field<'a>(h: &'a Harness<'static, PrintCraftApp>, placeholder: &'a str) -> egui_kittest::Node<'a> {+fn field<'a>(h: &'a Harness<'static, PdfCraftApp>, placeholder: &'a str) -> egui_kittest::Node<'a> {h.query_all_by(|n| n.placeholder() == Some(placeholder)).next().unwrap_or_else(|| panic!("no field {placeholder:?}"))}-fn comments(h: &Harness<'static, PrintCraftApp>) -> Vec<Annotation> {+fn comments(h: &Harness<'static, PdfCraftApp>) -> Vec<Annotation> {let s = h.state();s.session.get(s.views[0].id).unwrap().info.annotations.clone()}@@ -109,7 +109,7 @@ fn dragging_over_text_with_the_highlighter_highlights_it() {assert_eq!(c.len(), 1, "{c:?}");assert_eq!((c[0].subtype.as_str(), c[0].author.as_deref(), c[0].quads.len()), ("Highlight", Some("Tester"), 1));assert_eq!(h.state().views[0].comments.selected, Some((0, 0)), "the new comment is selected");- assert_eq!(h.state().quick_tool, QuickTool::Comment(printcraft_ui_egui::comments::CommentTool::Highlight), "the highlighter stays on");+ assert_eq!(h.state().quick_tool, QuickTool::Comment(pdfcraft_ui_egui::comments::CommentTool::Highlight), "the highlighter stays on");// The Comments panel opened with the tool and lists it.h.get_by_label_contains("Comments");assert_eq!(h.state().session.get(h.state().views[0].id).unwrap().can_undo(), Some("Add highlight"));@@ -260,7 +260,7 @@ fn the_panel_filters_and_sorts() {assert_eq!(h.query_all_by_label("Oval").count(), ovals - 1, "the oval's card is filtered out");assert!(h.query_all_by_label("Rectangle").count() >= 1);h.state_mut().views[0].comments.hidden_types.clear();- h.state_mut().views[0].comments.sort = printcraft_ui_egui::comments::SortBy::Type;+ h.state_mut().views[0].comments.sort = pdfcraft_ui_egui::comments::SortBy::Type;h.run_steps(2);// Grouped by type: a group header names each type.assert_eq!(h.query_all_by_label("Oval").count(), ovals + 1, "a group header was added");@@ -283,7 +283,7 @@ fn comments_take_checkmarks_lock_hide_and_summarize() {h.get_by_label("Remove checkmark");// "…" ▸ Copy text puts the comment's text on the clipboard.- h.state_mut().apply_edit(printcraft_engine::Edit::SetAnnotationContents { page: 0, index: 0, text: "Copy me".into() });+ h.state_mut().apply_edit(pdfcraft_engine::Edit::SetAnnotationContents { page: 0, index: 0, text: "Copy me".into() });h.run_steps(2);h.get_by_label("More").click();h.run_steps(2);@@ -399,16 +399,16 @@ fn the_panel_filters_by_colour_and_checkmark() {h.state_mut().set_option("quick", "circle").unwrap();drag_pt(&mut h, (160.0, 100.0), (260.0, 40.0));h.state_mut().set_option("quick", "select").unwrap();- h.state_mut().apply_edit(printcraft_engine::Edit::StyleAnnotation {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::StyleAnnotation {page: 0,index: 1,color: Some([0.0, 0.47, 0.84]),opacity: None,width: None,});- h.state_mut().apply_edit(printcraft_engine::Edit::MarkAnnotation { page: 0, index: 0, marked: true, author: "Tester".into() });+ h.state_mut().apply_edit(pdfcraft_engine::Edit::MarkAnnotation { page: 0, index: 0, marked: true, author: "Tester".into() });h.run_steps(2);- let cards = |h: &Harness<'static, PrintCraftApp>| (h.query_all_by_label("Rectangle").count(), h.query_all_by_label("Oval").count());+ let cards = |h: &Harness<'static, PdfCraftApp>| (h.query_all_by_label("Rectangle").count(), h.query_all_by_label("Oval").count());// The filter menu lists the colours by name (counted with it open: it names the types too).h.get_by_label("Filter comments").click();h.run_steps(2);@@ -433,7 +433,7 @@ fn make_current_properties_default() {});drag_pt(&mut h, (40.0, 100.0), (140.0, 40.0));h.state_mut().set_option("quick", "select").unwrap();- h.state_mut().apply_edit(printcraft_engine::Edit::StyleAnnotation {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::StyleAnnotation {page: 0,index: 0,color: Some([0.0, 0.47, 0.84]),@@ -445,7 +445,7 @@ fn make_current_properties_default() {h.run_steps(2);h.get_by_label("Make Current Properties Default").click();h.run_steps(3);- let st = h.state().comment_prefs.style(printcraft_ui_egui::comments::CommentTool::Rectangle);+ let st = h.state().comment_prefs.style(pdfcraft_ui_egui::comments::CommentTool::Rectangle);assert_eq!((st.color, st.opacity, st.width), ([0.0, 0.47, 0.84], 0.5, 5.0));// The next rectangle takes it.h.state_mut().set_option("quick", "square").unwrap();@@ -538,7 +538,7 @@ fn hovering_a_comment_shows_its_author_and_text() {"8 0 obj << /Type /Annot /Subtype /Square /Rect [50 50 150 120] /C [1 0 0] /T (Ada) /Contents (Check this figure) >> endobj\ntrailer",);let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("hover.pdf", None, pdf.into_bytes()).expect("opens");app.set_option("left", "closed").unwrap();// No Comments panel: the comment's text should only appear in the hover popup.@@ -565,13 +565,13 @@ fn the_squiggly_tool_marks_selected_text() {assert_eq!(c.len(), 1, "{c:?}");assert_eq!((c[0].subtype.as_str(), c[0].quads.len()), ("Squiggly", 1));// It sits with the other text markup in the Highlight ▸ flyout, and edits as itself.- assert!(printcraft_ui_egui::comments::GROUPS[1].contains(&printcraft_ui_egui::comments::CommentTool::Squiggly));- assert_eq!(printcraft_ui_egui::comments::tool_for(&c[0]), Some(printcraft_ui_egui::comments::CommentTool::Squiggly));+ assert!(pdfcraft_ui_egui::comments::GROUPS[1].contains(&pdfcraft_ui_egui::comments::CommentTool::Squiggly));+ assert_eq!(pdfcraft_ui_egui::comments::tool_for(&c[0]), Some(pdfcraft_ui_egui::comments::CommentTool::Squiggly));}#[test]fn the_opacity_set_for_a_tool_goes_into_its_new_comments() {- use printcraft_ui_egui::comments::CommentTool;+ use pdfcraft_ui_egui::comments::CommentTool;let mut h = harness(|app| app.comment_prefs.set_opacity(CommentTool::StrikeOut, 0.5));// Clamped: an invisible comment can't be found again.h.state_mut().comment_prefs.set_opacity(CommentTool::Underline, 0.0);@@ -583,7 +583,7 @@ fn the_opacity_set_for_a_tool_goes_into_its_new_comments() {assert_eq!(c.len(), 1, "{c:?}");// The new comment carries /CA 0.5 (read back from the document's bytes).let bytes = h.state().session.get(h.state().views[0].id).unwrap().bytes.as_ref().clone();- let doc = printcraft_cos::Document::open(std::sync::Arc::new(bytes)).unwrap();+ let doc = pdfcraft_cos::Document::open(std::sync::Arc::new(bytes)).unwrap();let opacities: Vec<f64> = doc.object_numbers().into_iter()diff --git a/crates/ui-egui/tests/compare.rs b/crates/ui-egui/tests/compare.rsindex e6ad62452..2264f57f4 100644--- a/crates/ui-egui/tests/compare.rs+++ b/crates/ui-egui/tests/compare.rs@@ -3,8 +3,8 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::Session;-use printcraft_ui_egui::{PrintCraftApp, RightPanel};+use pdfcraft_engine::Session;+use pdfcraft_ui_egui::{PdfCraftApp, RightPanel};#[test]fn compare_two_versions() {@@ -12,7 +12,7 @@ fn compare_two_versions() {let v1 = s.create_from_text("t", "Delivery within five days. Returns accepted.").unwrap().to_vec();let v2 = s.create_from_text("t", "Delivery within three days. Returns accepted for a week.").unwrap().to_vec();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("v1.pdf", None, v1.clone()).unwrap();app.open_bytes("v2.pdf", None, v2.clone()).unwrap();app@@ -40,15 +40,15 @@ fn compare_two_versions() {assert_eq!(h.state().session.get(h.state().active_ids().unwrap().1).unwrap().name, "Compare Report.pdf");}-/// Writes a screenshot of the Compare panel when PRINTCRAFT_SHOT is set (for review).+/// Writes a screenshot of the Compare panel when PDFCRAFT_SHOT is set (for review).#[test]fn compare_panel_screenshot() {- let Ok(out) = std::env::var("PRINTCRAFT_SHOT") else { return };+ let Ok(out) = std::env::var("PDFCRAFT_SHOT") else { return };let s = Session::new();let v1 = s.create_from_text("t", "Delivery within five days. Returns accepted.").unwrap().to_vec();let v2 = s.create_from_text("t", "Delivery within three days. Returns accepted for a week.").unwrap().to_vec();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("v1.pdf", None, v1.clone()).unwrap();app.open_bytes("v2.pdf", None, v2.clone()).unwrap();app@@ -67,7 +67,7 @@ fn compare_panel_screenshot() {fn pdfa_dialog_verifies_and_converts() {let doc = Session::new().create_from_text("t", "Keep forever").unwrap().to_vec();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("keep.pdf", None, doc.clone()).unwrap();app});@@ -90,9 +90,9 @@ fn pdfa_dialog_verifies_and_converts() {#[test]fn export_to_word_html_and_rtf() {let doc = Session::new().create_from_text("t", "Exported words").unwrap().to_vec();- let dir = std::env::temp_dir().join(format!("printcraft-office-ui-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-office-ui-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("e.pdf", None, doc).unwrap();for ext in ["docx", "html", "rtf"] {let out = dir.join(format!("e.{ext}"));diff --git a/crates/ui-egui/tests/content.rs b/crates/ui-egui/tests/content.rsindex 21fdea619..aec390015 100644--- a/crates/ui-egui/tests/content.rs+++ b/crates/ui-egui/tests/content.rs@@ -4,11 +4,11 @@use egui::Pos2;use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{PrintCraftApp, QuickTool};+use pdfcraft_ui_egui::{PdfCraftApp, QuickTool};-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("zoom", "150").unwrap();app@@ -23,13 +23,13 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).expect("on screen");let k = r.width() / 300.0;r.min + egui::vec2(x * k, y * k)}-fn click(h: &mut Harness<'static, PrintCraftApp>, p: Pos2) {+fn click(h: &mut Harness<'static, PdfCraftApp>, p: Pos2) {h.hover_at(p);h.run_steps(1);h.drag_at(p);@@ -38,13 +38,13 @@ fn click(h: &mut Harness<'static, PrintCraftApp>, p: Pos2) {h.run_steps(3);}-fn added(h: &Harness<'static, PrintCraftApp>) -> Vec<printcraft_engine::Added> {+fn added(h: &Harness<'static, PdfCraftApp>) -> Vec<pdfcraft_engine::Added> {let s = h.state();s.session.get(s.views[0].id).unwrap().added.clone()}/// A click whose press and release arrive in the same frame, as a quick real mouse click does.-fn quick_click(h: &mut Harness<'static, PrintCraftApp>, p: Pos2) {+fn quick_click(h: &mut Harness<'static, PdfCraftApp>, p: Pos2) {h.hover_at(p);h.run_steps(1);for pressed in [true, false] {@@ -53,11 +53,11 @@ fn quick_click(h: &mut Harness<'static, PrintCraftApp>, p: Pos2) {h.run_steps(3);}-fn texts(h: &Harness<'static, PrintCraftApp>) -> Vec<String> {+fn texts(h: &Harness<'static, PdfCraftApp>) -> Vec<String> {added(h).into_iter().filter_map(|a| match a.content {- printcraft_engine::AddedContent::Text(t) => Some(t.text),+ pdfcraft_engine::AddedContent::Text(t) => Some(t.text),_ => None,}).collect()@@ -110,7 +110,7 @@ fn typing_moving_styling_and_deleting_added_content() {h.run_steps(3);let a = added(&h);assert_eq!(a.len(), 1);- let printcraft_engine::AddedContent::Text(t) = &a[0].content else { panic!() };+ let pdfcraft_engine::AddedContent::Text(t) = &a[0].content else { panic!() };assert_eq!(t.text, "Reviewed");assert_eq!(h.state().quick_tool, QuickTool::Select);h.run_steps(2);@@ -119,7 +119,7 @@ fn typing_moving_styling_and_deleting_added_content() {h.get_by_label("B").click();h.run_steps(3);- let printcraft_engine::AddedContent::Text(t) = &added(&h)[0].content else { panic!() };+ let pdfcraft_engine::AddedContent::Text(t) = &added(&h)[0].content else { panic!() };assert!(t.bold);{let s = h.state();@@ -147,10 +147,10 @@ fn typing_moving_styling_and_deleting_added_content() {h.get_by_label("Rotate clockwise").click();h.run_steps(3);let a = added(&h);- let printcraft_engine::AddedContent::Image(img) = &a[0].content else { panic!() };+ let pdfcraft_engine::AddedContent::Image(img) = &a[0].content else { panic!() };assert_eq!((img.rotation, img.rect), (3, [140.0, 185.0, 160.0, 215.0]));h.get_by_label("Flip horizontal").click();h.run_steps(3);- let printcraft_engine::AddedContent::Image(img) = &added(&h)[0].content else { panic!() };+ let pdfcraft_engine::AddedContent::Image(img) = &added(&h)[0].content else { panic!() };assert!(img.flip_h);}diff --git a/crates/ui-egui/tests/control.rs b/crates/ui-egui/tests/control.rsindex 7a23484d7..e3dde9061 100644--- a/crates/ui-egui/tests/control.rs+++ b/crates/ui-egui/tests/control.rs@@ -4,8 +4,8 @@use std::sync::{Arc, Mutex};use egui_kittest::Harness;-use printcraft_ui_egui::PrintCraftApp;-use printcraft_ui_egui::control::{ControlClient, Reply};+use pdfcraft_ui_egui::PdfCraftApp;+use pdfcraft_ui_egui::control::{ControlClient, Reply};use serde_json::{Value, json};fn fixture(n: usize) -> Vec<u8> {@@ -33,11 +33,11 @@ fn fixture(n: usize) -> Vec<u8> {out}-fn harness() -> (Harness<'static, PrintCraftApp>, ControlClient) {+fn harness() -> (Harness<'static, PdfCraftApp>, ControlClient) {let slot: Arc<Mutex<Option<ControlClient>>> = Arc::default();let s = slot.clone();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();*s.lock().unwrap() = Some(app.attach_control(&cc.egui_ctx));app.open_bytes("doc.pdf", None, fixture(5)).unwrap();app@@ -48,7 +48,7 @@ fn harness() -> (Harness<'static, PrintCraftApp>, ControlClient) {}/// Send a request and run frames until it is answered.-fn call(h: &mut Harness<'static, PrintCraftApp>, c: &ControlClient, method: &str, params: Value) -> Reply {+fn call(h: &mut Harness<'static, PdfCraftApp>, c: &ControlClient, method: &str, params: Value) -> Reply {let rx = c.send(method, params);for _ in 0..30 {h.step();@@ -59,7 +59,7 @@ fn call(h: &mut Harness<'static, PrintCraftApp>, c: &ControlClient, method: &strpanic!("{method}: no reply after 30 frames");}-fn ok(h: &mut Harness<'static, PrintCraftApp>, c: &ControlClient, method: &str, params: Value) -> Value {+fn ok(h: &mut Harness<'static, PdfCraftApp>, c: &ControlClient, method: &str, params: Value) -> Value {call(h, c, method, params).unwrap_or_else(|e| panic!("{method}: {e}"))}@@ -171,7 +171,7 @@ fn screenshots_of_window_and_region() {fn loopback_transport_requires_the_token() {use std::io::{BufRead, BufReader, Write};let (mut h, c) = harness();- let ep = printcraft_ui_egui::control::serve(c).unwrap();+ let ep = pdfcraft_ui_egui::control::serve(c).unwrap();let talk = |lines: Vec<Value>| {let port = ep.port;std::thread::spawn(move || {@@ -192,7 +192,7 @@ fn loopback_transport_requires_the_token() {out})};- let pump = |h: &mut Harness<'static, PrintCraftApp>, t: std::thread::JoinHandle<Vec<Value>>| {+ let pump = |h: &mut Harness<'static, PdfCraftApp>, t: std::thread::JoinHandle<Vec<Value>>| {while !t.is_finished() {h.step();}diff --git a/crates/ui-egui/tests/create.rs b/crates/ui-egui/tests/create.rsindex 0958c512a..ec0ca664e 100644--- a/crates/ui-egui/tests/create.rs+++ b/crates/ui-egui/tests/create.rs@@ -1,6 +1,6 @@//! Create a PDF and Reduce File Size in the real shell.-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;fn png() -> Vec<u8> {let mut out = Vec::new();@@ -16,7 +16,7 @@ fn png() -> Vec<u8> {#[test]fn opening_images_and_text_converts_them_to_new_pdfs() {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("photo.png", Some("/tmp/photo.png".into()), png()).unwrap();app.open_bytes("notes.txt", None, b"first line\nsecond line".to_vec()).unwrap();app.create_from_images(vec![("a.png".into(), png()), ("b.png".into(), png())]);@@ -33,10 +33,10 @@ fn opening_images_and_text_converts_them_to_new_pdfs() {#[test]fn reduce_file_size_writes_a_compact_copy() {- let dir = std::env::temp_dir().join(format!("printcraft-reduce-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-reduce-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();let out = dir.join("reduced.pdf");- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("notes.txt", None, "lorem ipsum ".repeat(500).into_bytes()).unwrap();app.save_override = Some(out.to_string_lossy().into_owned());assert!(app.execute("optimize.reduce"));@@ -47,8 +47,8 @@ fn reduce_file_size_writes_a_compact_copy() {#[test]fn clipboard_images_and_text_become_new_pdfs() {- use printcraft_ui_egui::Clip;- let mut app = PrintCraftApp::new();+ use pdfcraft_ui_egui::Clip;+ let mut app = PdfCraftApp::new();app.create_from_clip(Clip::Image { width: 40, height: 20, rgba: [10u8, 20, 30, 255].repeat(40 * 20) }).unwrap();app.create_from_clip(Clip::Text("Pasted\nlines".into())).unwrap();let docs = app.session.docs();@@ -64,12 +64,12 @@ fn clipboard_images_and_text_become_new_pdfs() {fn the_pdf_optimizer_dialog_saves_an_optimized_copy() {use egui_kittest::Harness;use egui_kittest::kittest::Queryable;- let dir = std::env::temp_dir().join(format!("printcraft-optimizer-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-optimizer-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();let out = dir.join("optimized.pdf");let out2 = out.clone();let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("notes.txt", None, "lorem ipsum ".repeat(500).into_bytes()).unwrap();app.save_override = Some(out2.to_string_lossy().into_owned());app@@ -88,7 +88,7 @@ fn the_pdf_optimizer_dialog_saves_an_optimized_copy() {h.run_steps(1);{let d = &h.state().optimize_draft;- assert!(d.settings.discard_tags && d.discard == vec![printcraft_engine::Hidden::Metadata]);+ assert!(d.settings.discard_tags && d.discard == vec![pdfcraft_engine::Hidden::Metadata]);}h.get_by_label("OK").click();h.run_steps(3);diff --git a/crates/ui-egui/tests/editing.rs b/crates/ui-egui/tests/editing.rsindex 37c9588cf..479d55659 100644--- a/crates/ui-egui/tests/editing.rs+++ b/crates/ui-egui/tests/editing.rs@@ -5,8 +5,8 @@ use egui::accesskit::Role;use egui::{Key, Modifiers};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_render::{PageRenderer, RenderRequest, RequestKind};-use printcraft_ui_egui::{CloseRequest, PrintCraftApp};+use pdfcraft_render::{PageRenderer, RenderRequest, RequestKind};+use pdfcraft_ui_egui::{CloseRequest, PdfCraftApp};/// An `n`-page document with a proper xref table; page `i` shows "Page i+1".fn fixture(n: usize) -> Vec<u8> {@@ -34,9 +34,9 @@ fn fixture(n: usize) -> Vec<u8> {out}-fn harness(pages: usize, setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Harness<'static, PrintCraftApp> {+fn harness(pages: usize, setup: impl FnOnce(&mut PdfCraftApp) + 'static) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, fixture(pages)).expect("fixture opens");setup(&mut app);app@@ -45,12 +45,12 @@ fn harness(pages: usize, setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Hah}-fn organize(pages: usize) -> Harness<'static, PrintCraftApp> {+fn organize(pages: usize) -> Harness<'static, PdfCraftApp> {harness(pages, |app| app.set_option("organize", "on").unwrap())}/// Page labels of the active document, read back from its current bytes.-fn page_texts(app: &PrintCraftApp) -> Vec<String> {+fn page_texts(app: &PdfCraftApp) -> Vec<String> {let doc = app.session.get(app.views[0].id).unwrap();let mut r = PageRenderer::new(doc.bytes.clone(), Default::default());(0..r.page_count())@@ -61,13 +61,13 @@ fn page_texts(app: &PrintCraftApp) -> Vec<String> {.collect()}-fn dirty(h: &Harness<'static, PrintCraftApp>) -> bool {+fn dirty(h: &Harness<'static, PdfCraftApp>) -> bool {let app = h.state();app.session.get(app.views[0].id).is_some_and(|d| d.dirty)}fn temp_path(name: &str) -> std::path::PathBuf {- let dir = std::env::temp_dir().join(format!("printcraft-ui-tests-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-ui-tests-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();dir.join(name)}@@ -169,7 +169,7 @@ fn save_writes_an_incremental_update_and_clears_dirty() {h.get_by_label("saved.pdf"); // the tab takes the new name, no edited marker// What was written is what the app now shows.assert_eq!(h.state().session.get(h.state().views[0].id).unwrap().bytes.as_slice(), saved.as_slice());- let reopened = printcraft_render::inspect(std::sync::Arc::new(saved), None).unwrap();+ let reopened = pdfcraft_render::inspect(std::sync::Arc::new(saved), None).unwrap();assert_eq!(reopened.pages[2].rotation, 270);let _ = std::fs::remove_file(out);}@@ -207,7 +207,7 @@ fn closing_a_dirty_tab_can_save_first() {h.get_by_label("Save").click();h.run_steps(3);assert!(h.state().views.is_empty());- let saved = printcraft_render::inspect(std::sync::Arc::new(std::fs::read(&out).unwrap()), None).unwrap();+ let saved = pdfcraft_render::inspect(std::sync::Arc::new(std::fs::read(&out).unwrap()), None).unwrap();assert_eq!(saved.pages[0].rotation, 90);let _ = std::fs::remove_file(out);}@@ -245,7 +245,7 @@ fn the_save_prompt_answers_to_the_keyboard() {h.key_press(Key::Enter);h.run_steps(3);assert!(h.state().views.is_empty(), "Enter saves and closes");- let saved = printcraft_render::inspect(std::sync::Arc::new(std::fs::read(&out).unwrap()), None).unwrap();+ let saved = pdfcraft_render::inspect(std::sync::Arc::new(std::fs::read(&out).unwrap()), None).unwrap();assert_eq!(saved.pages[0].rotation, 90);let _ = std::fs::remove_file(out);}@@ -268,7 +268,7 @@ fn quitting_with_unsaved_changes_asks_for_each_document() {for tab in 0..2 {h.state_mut().active = Some(tab);h.state_mut().views[tab].select_pages(&[0]);- h.state_mut().apply_edit(printcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });+ h.state_mut().apply_edit(pdfcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });}h.state_mut().close_request = Some(CloseRequest::Quit);h.run_steps(3);@@ -326,7 +326,7 @@ fn cancelling_properties_discards_the_draft() {#[test]fn edit_menu_names_the_step_to_undo() {let mut h = harness(2, |app| {- app.apply_edit(printcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });+ app.apply_edit(pdfcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });});h.get_by_label("Menu").click();h.run_steps(2);@@ -342,7 +342,7 @@ fn edit_menu_names_the_step_to_undo() {// ── Combine / insert from file / extract / split ──────────────────────────────────────────────-fn texts_of(app: &PrintCraftApp, tab: usize) -> Vec<String> {+fn texts_of(app: &PdfCraftApp, tab: usize) -> Vec<String> {let doc = app.session.get(app.views[tab].id).unwrap();let mut r = PageRenderer::new(doc.bytes.clone(), Default::default());(0..r.page_count())@@ -356,7 +356,7 @@ fn texts_of(app: &PrintCraftApp, tab: usize) -> Vec<String> {#[test]fn combining_files_opens_a_new_unsaved_tab() {let mut h = harness(1, |app| {- app.use_files(printcraft_ui_egui::FilePurpose::Combine, vec![("one.pdf".into(), fixture(2)), ("two.pdf".into(), fixture(1))]);+ app.use_files(pdfcraft_ui_egui::FilePurpose::Combine, vec![("one.pdf".into(), fixture(2)), ("two.pdf".into(), fixture(1))]);});h.run_steps(3);h.get_by_label("Combine").click();@@ -375,7 +375,7 @@ fn combining_files_opens_a_new_unsaved_tab() {#[test]fn combine_files_takes_chosen_pages_in_the_order_listed() {let mut h = harness(1, |app| {- app.use_files(printcraft_ui_egui::FilePurpose::Combine, vec![("one.pdf".into(), fixture(3)), ("two.pdf".into(), fixture(2))]);+ app.use_files(pdfcraft_ui_egui::FilePurpose::Combine, vec![("one.pdf".into(), fixture(3)), ("two.pdf".into(), fixture(2))]);});h.run_steps(3);h.get_by_label_contains("Files are combined in this order");@@ -418,7 +418,7 @@ fn inserting_a_file_goes_after_the_selection_and_undoes() {let mut h = organize(2);h.get_by_label("Page 1").click();h.run_steps(2);- h.state_mut().use_files(printcraft_ui_egui::FilePurpose::InsertPages, vec![("extra.pdf".into(), fixture(2))]);+ h.state_mut().use_files(pdfcraft_ui_egui::FilePurpose::InsertPages, vec![("extra.pdf".into(), fixture(2))]);h.run_steps(3);assert_eq!(texts_of(h.state(), 0), ["Page 1", "Page 1", "Page 2", "Page 2"]);h.key_press_modifiers(Modifiers::COMMAND, Key::Z);@@ -443,7 +443,7 @@ fn split_dialog_writes_one_file_per_part() {names.sort();assert_eq!(names, ["doc (page 1).pdf", "doc (page 2).pdf", "doc (page 3).pdf"]);for name in names {- let info = printcraft_render::inspect(std::sync::Arc::new(std::fs::read(dir.join(name)).unwrap()), None).unwrap();+ let info = pdfcraft_render::inspect(std::sync::Arc::new(std::fs::read(dir.join(name)).unwrap()), None).unwrap();assert_eq!(info.pages.len(), 1);}let _ = std::fs::remove_dir_all(dir);@@ -457,7 +457,7 @@ fn split_before_selected_pages() {let mut h = organize(4);h.state_mut().export_dir_override = Some(dir.to_string_lossy().into_owned());h.state_mut().views[0].select_pages(&[2]);- h.state_mut().split_draft.mode = printcraft_ui_egui::SplitMode::Selection;+ h.state_mut().split_draft.mode = pdfcraft_ui_egui::SplitMode::Selection;h.state_mut().run_command("page.split");h.run_steps(3);h.get_by_label_contains("Creates 2 files from 4 pages");@@ -472,9 +472,9 @@ fn split_before_selected_pages() {// ── Encrypted documents ───────────────────────────────────────────────────────────────────────fn protected(user: &str, owner: &str, permissions: i32) -> Vec<u8> {- let mut doc = printcraft_cos::Document::open(std::sync::Arc::new(fixture(2))).unwrap();- doc.set_encryption(&printcraft_cos::NewEncryption {- algorithm: printcraft_cos::Algorithm::Aes256,+ let mut doc = pdfcraft_cos::Document::open(std::sync::Arc::new(fixture(2))).unwrap();+ doc.set_encryption(&pdfcraft_cos::NewEncryption {+ algorithm: pdfcraft_cos::Algorithm::Aes256,user_password: user,owner_password: owner,permissions,@@ -482,13 +482,13 @@ fn protected(user: &str, owner: &str, permissions: i32) -> Vec<u8> {seed: [4; 32],}).unwrap();- printcraft_cos::write_full(&doc, &Default::default()).unwrap()+ pdfcraft_cos::write_full(&doc, &Default::default()).unwrap()}#[test]fn password_prompt_opens_and_security_tab_reports_the_details() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("secret.pdf", None, protected("pw", "owner", -1)).unwrap();app});@@ -512,7 +512,7 @@ fn password_prompt_opens_and_security_tab_reports_the_details() {#[test]fn restricted_documents_show_a_notice_and_block_page_changes() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("locked.pdf", None, protected("", "owner", 0b0100)).unwrap(); // opens without a passwordapp.set_option("organize", "on").unwrap();app@@ -533,7 +533,7 @@ fn restricted_documents_show_a_notice_and_block_page_changes() {#[test]fn replace_pages_dialog_swaps_page_content() {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, fixture(3)).unwrap();app.views[0].select_pages(&[1]);app.start_replace("other.pdf".into(), fixture(5));@@ -560,7 +560,7 @@ fn extract_options_and_rotate_pages_dialog() {h.state_mut().views[0].select_pages(&[1, 2]);h.state_mut().run_command("page.extract");h.run_steps(2);- h.state_mut().extract_draft = printcraft_ui_egui::ExtractDraft { separate: true, delete: true };+ h.state_mut().extract_draft = pdfcraft_ui_egui::ExtractDraft { separate: true, delete: true };h.get_all_by_label("Extract").last().unwrap().click();h.run_steps(3);let mut names: Vec<String> = std::fs::read_dir(&dir).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().into_owned()).collect();@@ -572,7 +572,7 @@ fn extract_options_and_rotate_pages_dialog() {h.state_mut().run_command("page.rotate_dialog");h.run_steps(2);h.state_mut().rotate_draft.which = 0;- h.state_mut().rotate_draft.parity = printcraft_engine::PageParity::Odd;+ h.state_mut().rotate_draft.parity = pdfcraft_engine::PageParity::Odd;h.get_by_label("OK").click();h.run_steps(3);let s = h.state();@@ -584,7 +584,7 @@ fn extract_options_and_rotate_pages_dialog() {fn dragging_thumbnails_reorders_pages() {let mut h = organize(4);let before = page_texts(h.state());- let grab = |h: &Harness<'static, PrintCraftApp>, label: &str| h.get_by_label(label).rect();+ let grab = |h: &Harness<'static, PdfCraftApp>, label: &str| h.get_by_label(label).rect();let (from, to) = (grab(&h, "Page 1").center(), grab(&h, "Page 3").right_center() - egui::vec2(10.0, 0.0));h.hover_at(from);h.run_steps(1);@@ -638,7 +638,7 @@ fn source_font_fixture() -> Vec<u8> {"<< /Type /Font /Subtype /Type1 /BaseFont /Times-BoldItalic >>".into(),"<< /Type /Page /Parent 2 0 R /Contents 7 0 R /Resources << /Font << /F1 3 0 R /F2 5 0 R >> >> >>".into(),"<< /Type /Font /Subtype /Type1 /BaseFont /Courier-Oblique >>".into(),- "<< /Producer (PrintCraft) >>".into(),+ "<< /Producer (PdfCraft) >>".into(),format!("<< /Length {} >>\nstream\n{body}\nendstream", body.len()),];let mut out = b"%PDF-1.7\n".to_vec();@@ -656,9 +656,9 @@ fn source_font_fixture() -> Vec<u8> {out}-fn open_source_font_fixture() -> Harness<'static, PrintCraftApp> {+fn open_source_font_fixture() -> Harness<'static, PdfCraftApp> {Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("fonts.pdf", None, source_font_fixture()).expect("font fixture opens");app})@@ -681,7 +681,7 @@ fn clicking_existing_text_selects_its_source_font_style() {h.drop_at(serif);h.run_steps(3);let ed = h.state().views[0].line_editor.clone().expect("serif editor opens");- assert_eq!(ed.look.family, printcraft_engine::FontFamily::Times);+ assert_eq!(ed.look.family, pdfcraft_engine::FontFamily::Times);assert!(ed.look.bold && ed.look.italic, "source style: {:?}", ed.look);h.key_press(egui::Key::Escape);@@ -694,7 +694,7 @@ fn clicking_existing_text_selects_its_source_font_style() {h.drop_at(mono);h.run_steps(3);let ed = h.state().views[0].line_editor.clone().expect("mono editor opens");- assert_eq!(ed.look.family, printcraft_engine::FontFamily::Courier);+ assert_eq!(ed.look.family, pdfcraft_engine::FontFamily::Courier);assert!(!ed.look.bold && ed.look.italic, "source style: {:?}", ed.look);}@@ -758,7 +758,7 @@ fn double_drawn() -> Vec<u8> {#[test]fn editing_a_double_drawn_line_replaces_every_copy() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("bold.pdf", None, double_drawn()).expect("opens");app});@@ -790,7 +790,7 @@ fn editing_existing_images_on_the_page() {let mut png = Vec::new();image::RgbImage::from_pixel(80, 40, image::Rgb([200, 40, 40])).write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png).unwrap();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("picture.png", None, png.clone()).expect("opens");app});@@ -864,7 +864,7 @@ fn the_format_panel_restyles_the_paragraph_being_edited() {}/// Drag with the pointer from `from` to `to` in a few steps.-fn drag(h: &mut Harness<'static, PrintCraftApp>, from: egui::Pos2, to: egui::Pos2) {+fn drag(h: &mut Harness<'static, PdfCraftApp>, from: egui::Pos2, to: egui::Pos2) {h.hover_at(from);h.run_steps(1);h.drag_at(from);@@ -882,7 +882,7 @@ fn dragging_a_paragraph_moves_it_and_its_edge_rewraps_it() {let mut h = harness(1, |_| {});assert!(h.state_mut().execute("edit.edit_text"));h.run_steps(2);- let block = |h: &Harness<'static, PrintCraftApp>| {+ let block = |h: &Harness<'static, PdfCraftApp>| {let s = h.state();s.session.get(s.views[0].id).unwrap().text_blocks(0)[0].clone()};diff --git a/crates/ui-egui/tests/export.rs b/crates/ui-egui/tests/export.rsindex 1f98d28af..f90c00970 100644--- a/crates/ui-egui/tests/export.rs+++ b/crates/ui-egui/tests/export.rs@@ -2,7 +2,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -14,12 +14,12 @@ trailer << /Root 1 0 R >>#[test]fn export_dialogs_write_images_and_text() {- let dir = std::env::temp_dir().join(format!("printcraft-export-ui-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-export-ui-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);std::fs::create_dir_all(&dir).unwrap();let d = dir.clone();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, FIXTURE.to_vec()).unwrap();app.export_dir_override = Some(d.to_string_lossy().into_owned());appdiff --git a/crates/ui-egui/tests/fill_sign.rs b/crates/ui-egui/tests/fill_sign.rsindex 19613bb6b..187bea3af 100644--- a/crates/ui-egui/tests/fill_sign.rs+++ b/crates/ui-egui/tests/fill_sign.rs@@ -3,7 +3,7 @@use egui::{Pos2, pos2};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp, QuickTool};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp, QuickTool};const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -12,9 +12,9 @@ const FIXTURE: &[u8] = b"%PDF-1.7trailer << /Root 1 0 R >>%%EOF";-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, FIXTURE.to_vec()).unwrap();app.set_option("left", "closed").unwrap();app.set_option("zoom", "150").unwrap();@@ -25,12 +25,12 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).expect("on screen");pos2(r.left() + x / 300.0 * r.width(), r.top() + (400.0 - y) / 400.0 * r.height())}-fn click(h: &mut Harness<'static, PrintCraftApp>, x: f32, y: f32) {+fn click(h: &mut Harness<'static, PdfCraftApp>, x: f32, y: f32) {let p = at(h, x, y);h.hover_at(p);h.run_steps(1);@@ -40,7 +40,7 @@ fn click(h: &mut Harness<'static, PrintCraftApp>, x: f32, y: f32) {h.run_steps(3);}-fn items(h: &Harness<'static, PrintCraftApp>) -> Vec<(String, Option<String>)> {+fn items(h: &Harness<'static, PdfCraftApp>) -> Vec<(String, Option<String>)> {let s = h.state();let mut v: Vec<_> = s.session.get(s.views[0].id).unwrap().info.annotations.iter().map(|a| (a.subtype.clone(), a.contents.clone())).collect();v.sort();@@ -96,7 +96,7 @@ fn signing_draws_a_signature_once_and_places_it() {assert!(items(&h).iter().any(|(t, _)| t == "Ink"));// The signature is remembered (persisted with the app's settings).let saved = h.state().persist();- let mut again = PrintCraftApp::new();+ let mut again = PdfCraftApp::new();again.restore(&saved);assert!(again.signature.is_some());}@@ -112,7 +112,7 @@ fn typed_signatures_and_initials() {assert_eq!(h.state().signature_draft.text, "Grace Hopper");h.get_by_label("Apply").click();h.run_steps(3);- assert_eq!(h.state().signature, Some(printcraft_ui_egui::fill_sign::SavedSig::Typed("Grace Hopper".into())));+ assert_eq!(h.state().signature, Some(pdfcraft_ui_egui::fill_sign::SavedSig::Typed("Grace Hopper".into())));click(&mut h, 60.0, 100.0);assert!(items(&h).iter().any(|(t, _)| t == "Stamp"), "typed signatures are filled outlines");// Initials: their own pad (GH), then placed.@@ -126,8 +126,8 @@ fn typed_signatures_and_initials() {assert_eq!(items(&h).iter().filter(|(t, _)| t == "Stamp").count(), 2);// Both are remembered.let saved = h.state().persist();- let mut again = PrintCraftApp::new();+ let mut again = PdfCraftApp::new();again.restore(&saved);assert_eq!(again.signature, h.state().signature);- assert_eq!(again.initials, Some(printcraft_ui_egui::fill_sign::SavedSig::Typed("GH".into())));+ assert_eq!(again.initials, Some(pdfcraft_ui_egui::fill_sign::SavedSig::Typed("GH".into())));}diff --git a/crates/ui-egui/tests/fonts.rs b/crates/ui-egui/tests/fonts.rsindex 534f7ecc6..807ce95ce 100644--- a/crates/ui-egui/tests/fonts.rs+++ b/crates/ui-egui/tests/fonts.rs@@ -2,7 +2,7 @@use egui::epaint::text::{Fonts, TextOptions};use egui::{Color32, FontFamily, FontId};-use printcraft_ui_egui::theme;+use pdfcraft_ui_egui::theme;const JAPANESE: &str = "日本語の文字";@@ -20,7 +20,7 @@ fn layout_widths(fonts: &mut Fonts, text: &str) -> Vec<f32> {/// from a craft-fonts face placed after the app's own fonts.#[test]fn japanese_ui_text_uses_craft_fonts() {- if printcraft_fonts::ui_japanese_fonts().is_empty() {+ if pdfcraft_fonts::ui_japanese_fonts().is_empty() {eprintln!("skipping japanese_ui_text_uses_craft_fonts: built without craft-fonts (set CRAFT_FONTS_DIR to run it)");return;}@@ -30,7 +30,7 @@ fn japanese_ui_text_uses_craft_fonts() {let first_jp = stack.iter().position(|n| n.starts_with("BIZ UDPGothic")).expect("BIZ UDPGothic is a fallback");let own = stack.iter().position(|n| n == "Inter" || n == "JetBrainsMono").expect("the app's own font");assert!(own < first_jp, "{family:?}: {stack:?}");- assert!(stack[first_jp..].iter().all(|n| printcraft_fonts::CRAFT_FONTS.iter().any(|f| f.name() == *n)), "{stack:?}");+ assert!(stack[first_jp..].iter().all(|n| pdfcraft_fonts::CRAFT_FONTS.iter().any(|f| f.name() == *n)), "{stack:?}");}let mut fonts = Fonts::new(TextOptions::default(), defs);for id in families() {@@ -48,11 +48,11 @@ fn japanese_ui_text_uses_craft_fonts() {fn ui_fonts_work_without_craft_fonts() {let mut fonts = Fonts::new(TextOptions::default(), theme::font_definitions());for id in families() {- assert!(fonts.has_glyphs(&id, "PrintCraft"), "{id:?}");- assert_eq!(fonts.has_glyphs(&id, JAPANESE), !printcraft_fonts::ui_japanese_fonts().is_empty(), "{id:?}");+ assert!(fonts.has_glyphs(&id, "PdfCraft"), "{id:?}");+ assert_eq!(fonts.has_glyphs(&id, JAPANESE), !pdfcraft_fonts::ui_japanese_fonts().is_empty(), "{id:?}");}assert!(layout_widths(&mut fonts, JAPANESE).iter().all(|w| w.is_finite() && *w > 0.0));- assert!(layout_widths(&mut fonts, "PrintCraft").iter().all(|w| *w > 20.0));+ assert!(layout_widths(&mut fonts, "PdfCraft").iter().all(|w| *w > 20.0));let ctx = egui::Context::default();theme::install_fonts(&ctx);}diff --git a/crates/ui-egui/tests/forms.rs b/crates/ui-egui/tests/forms.rsindex 9dcc53885..8b004dd12 100644--- a/crates/ui-egui/tests/forms.rs+++ b/crates/ui-egui/tests/forms.rs@@ -1,11 +1,11 @@//! Filling in a form in the real shell (egui_kittest): typing, Tab, check boxes, radios, choices.use egui_kittest::Harness;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("left", "closed").unwrap();// The whole 300×400 pt page on screen.@@ -22,18 +22,18 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn value(h: &Harness<'static, PrintCraftApp>, name: &str) -> Vec<String> {+fn value(h: &Harness<'static, PdfCraftApp>, name: &str) -> Vec<String> {let s = h.state();s.session.get(s.views[0].id).unwrap().form.iter().find(|f| f.name == name).unwrap().value.clone()}/// Click the centre of a field's widget.-fn click_field(h: &mut Harness<'static, PrintCraftApp>, name: &str, widget: usize) {+fn click_field(h: &mut Harness<'static, PdfCraftApp>, name: &str, widget: usize) {let p = {let s = h.state();let doc = s.session.get(s.views[0].id).unwrap();let f = doc.form.iter().find(|f| f.name == name).unwrap();- printcraft_ui_egui::forms_ui::field_screen_rect(&s.views[0], &doc.info, f, widget).expect("on screen").center()+ pdfcraft_ui_egui::forms_ui::field_screen_rect(&s.views[0], &doc.info, f, widget).expect("on screen").center()};h.hover_at(p);h.run_steps(1);@@ -125,10 +125,10 @@ fn tabbing_into_a_filled_field_selects_it_so_typing_replaces() {fn date_fields_offer_a_calendar() {use egui_kittest::kittest::Queryable;let mut h = harness();- h.state_mut().apply_edit(printcraft_engine::Edit::AddField {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::AddField {page: 0,rect: [50.0, 40.0, 200.0, 60.0],- kind: printcraft_engine::NewField::Date,+ kind: pdfcraft_engine::NewField::Date,name: Some("due".into()),});h.run_steps(4);diff --git a/crates/ui-egui/tests/identity.rs b/crates/ui-egui/tests/identity.rsindex d9bf535dc..87e6a1a79 100644--- a/crates/ui-egui/tests/identity.rs+++ b/crates/ui-egui/tests/identity.rs@@ -4,7 +4,7 @@ use egui::accesskit::Role;use egui::{Key, Modifiers};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;const PDF: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -20,7 +20,7 @@ trailer << /Root 1 0 R >>#[test]fn the_identity_name_signs_new_comments_and_is_remembered() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, PDF.to_vec()).expect("opens");app.set_option("author", "Tester").unwrap();app.set_option("dialog", "preferences").unwrap();@@ -48,7 +48,7 @@ fn the_identity_name_signs_new_comments_and_is_remembered() {h.state_mut().views[0].select_text(0, 4, 8);assert!(h.state_mut().execute("comment.highlight"));// Wait for the edit to land in the document (it applies on a later frame).- let author = |h: &Harness<'static, PrintCraftApp>| {+ let author = |h: &Harness<'static, PdfCraftApp>| {let doc = h.state().session.get(h.state().views[0].id).unwrap();doc.info.annotations.first().and_then(|a| a.author.clone())};@@ -61,7 +61,7 @@ fn the_identity_name_signs_new_comments_and_is_remembered() {}assert_eq!(author(&h).as_deref(), Some("Grace Hopper"));// It survives a restart; an empty or missing name keeps the default, and a huge one is cut.- let mut restored = PrintCraftApp::new();+ let mut restored = PdfCraftApp::new();restored.restore(&h.state().persist());assert_eq!(restored.comment_prefs.author, "Grace Hopper");restored.restore(r#"{"author": " "}"#);diff --git a/crates/ui-egui/tests/javascript.rs b/crates/ui-egui/tests/javascript.rsindex 30f43dec7..19ad05a54 100644--- a/crates/ui-egui/tests/javascript.rs+++ b/crates/ui-egui/tests/javascript.rs@@ -3,7 +3,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};/// A form with a text field and a push button whose Mouse Up script fills it in.fn form() -> Vec<u8> {@@ -30,9 +30,9 @@ fn form() -> Vec<u8> {out}-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, form()).unwrap();app});@@ -40,7 +40,7 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn value(h: &Harness<'static, PrintCraftApp>, name: &str) -> Vec<String> {+fn value(h: &Harness<'static, PdfCraftApp>, name: &str) -> Vec<String> {let app = h.state();let id = app.active_ids().unwrap().1;app.session.get(id).unwrap().form.iter().find(|f| f.name == name).unwrap().value.clone()@@ -97,17 +97,17 @@ fn document_scripts_and_preferences() {h.run_steps(2);assert!(!h.state().session.javascript());let saved = h.state().persist();- let mut fresh = PrintCraftApp::new();+ let mut fresh = PdfCraftApp::new();fresh.restore(&saved);assert!(!fresh.session.javascript(), "the preference is remembered");}#[test]fn merge_data_files_into_a_spreadsheet() {- let dir = std::env::temp_dir().join(format!("printcraft-merge-ui-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-merge-ui-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();let out = dir.join("report.csv");- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.save_override = Some(out.to_string_lossy().into_owned());app.merge_data_files(vec![("form.pdf".into(), form())]);assert_eq!(std::fs::read_to_string(&out).unwrap(), "greeting\n\n");@@ -118,10 +118,9 @@ fn merge_data_files_into_a_spreadsheet() {#[test]fn prepare_a_form_detects_fields_on_a_paper_form() {- let paper =- printcraft_engine::Session::new().create_from_text("t", "Name: ____________________\n\nPhone: ____________________").unwrap().to_vec();+ let paper = pdfcraft_engine::Session::new().create_from_text("t", "Name: ____________________\n\nPhone: ____________________").unwrap().to_vec();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("paper.pdf", None, paper.clone()).unwrap();app});diff --git a/crates/ui-egui/tests/links.rs b/crates/ui-egui/tests/links.rsindex 6f6c149ee..072d25093 100644--- a/crates/ui-egui/tests/links.rs+++ b/crates/ui-egui/tests/links.rs@@ -1,14 +1,14 @@//! Community links: the Discord button is one click away everywhere; Help menu, About dialog and-//! home screen open the ArtCraft and PrintCraft pages.+//! home screen open the ArtCraft and PdfCraft pages.use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::links;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_engine::links;+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};-fn harness(setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Harness<'static, PrintCraftApp> {+fn harness(setup: impl FnOnce(&mut PdfCraftApp) + 'static) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();setup(&mut app);app});@@ -29,8 +29,8 @@ fn discord_button_in_the_top_bar_opens_discord() {fn home_screen_links() {for (label, url) in [("Join our Discord", links::DISCORD),- ("PrintCraft web page", "https://getartcraft.com/apps/printcraft"),- ("PrintCraft on GitHub", "https://github.com/storytold/printcraft"),+ ("PdfCraft web page", "https://getartcraft.com/apps/pdfcraft"),+ ("PdfCraft on GitHub", "https://github.com/storytold/pdfcraft"),("ArtCraft website", "https://getartcraft.com"),] {let mut h = harness(|_| {});@@ -61,6 +61,6 @@ fn help_commands_open_each_link() {let mut h = harness(|_| {});assert!(h.state_mut().execute(l.command), "{}", l.command);assert_eq!(h.state().last_opened_url.as_deref(), Some(l.url));- assert_eq!(printcraft_engine::commands::command(l.command).unwrap().menu, Some("Help"));+ assert_eq!(pdfcraft_engine::commands::command(l.command).unwrap().menu, Some("Help"));}}diff --git a/crates/ui-egui/tests/marks.rs b/crates/ui-egui/tests/marks.rsindex 151a816f8..b19607c40 100644--- a/crates/ui-egui/tests/marks.rs+++ b/crates/ui-egui/tests/marks.rs@@ -2,8 +2,8 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::MarkKind;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_engine::MarkKind;+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -14,9 +14,9 @@ const FIXTURE: &[u8] = b"%PDF-1.7trailer << /Root 1 0 R >>%%EOF";-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, FIXTURE.to_vec()).unwrap();app});@@ -24,7 +24,7 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn marks(h: &Harness<'static, PrintCraftApp>) -> Vec<MarkKind> {+fn marks(h: &Harness<'static, PdfCraftApp>) -> Vec<MarkKind> {let s = h.state();s.session.get(s.views[0].id).unwrap().marks.clone()}@@ -41,7 +41,7 @@ fn header_and_footer_dialog_inserts_tokens_and_applies_to_a_subset() {h.get_by_label("Insert Page Number").click();h.run_steps(2);assert_eq!(h.state().marks_draft.hf.text[4], "<<1>>");- h.state_mut().marks_draft.range.subset = printcraft_ui_egui::marks::Subset::Odd;+ h.state_mut().marks_draft.range.subset = pdfcraft_ui_egui::marks::Subset::Odd;h.run_steps(2);h.get_by_label("OK").click();h.run_steps(4);diff --git a/crates/ui-egui/tests/ocr.rs b/crates/ui-egui/tests/ocr.rsindex 62d251eed..8e9e97744 100644--- a/crates/ui-egui/tests/ocr.rs+++ b/crates/ui-egui/tests/ocr.rs@@ -3,8 +3,8 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::{Session, export};-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_engine::{Session, export};+use pdfcraft_ui_egui::PdfCraftApp;/// A one-page PDF that is only a picture of a sentence.fn scan() -> Vec<u8> {@@ -18,7 +18,7 @@ fn scan() -> Vec<u8> {#[test]fn recognize_text_dialog_adds_searchable_text() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("scan.pdf", None, scan()).unwrap();app.run_inline = true;app@@ -28,7 +28,7 @@ fn recognize_text_dialog_adds_searchable_text() {h.run_steps(2);h.get_by_label("Document language");h.get_by_label("Output");- if !printcraft_engine::ocr::available() {+ if !pdfcraft_engine::ocr::available() {eprintln!("skipped: OCR models not installed");return;}@@ -44,17 +44,17 @@ fn recognize_text_dialog_adds_searchable_text() {#[test]fn recognize_text_in_multiple_files_writes_searchable_copies() {- if !printcraft_engine::ocr::available() {+ if !pdfcraft_engine::ocr::available() {eprintln!("skipped: OCR models not installed");return;}- let dir = std::env::temp_dir().join(format!("printcraft-ocr-ui-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-ocr-ui-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);std::fs::create_dir_all(&dir).unwrap();- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.run_inline = true;app.export_dir_override = Some(dir.to_string_lossy().into_owned());- app.use_files(printcraft_ui_egui::FilePurpose::Ocr, vec![("one.pdf".into(), scan()), ("two.pdf".into(), scan())]);+ app.use_files(pdfcraft_ui_egui::FilePurpose::Ocr, vec![("one.pdf".into(), scan()), ("two.pdf".into(), scan())]);assert!(app.ocr_batch.is_none(), "finished");let toast = app.toast.clone().unwrap().0;assert!(toast.starts_with("Recognized ") && toast.ends_with("in 2 files"), "{toast}");diff --git a/crates/ui-egui/tests/pageboxes.rs b/crates/ui-egui/tests/pageboxes.rsindex 8c0c72376..6ad018b7e 100644--- a/crates/ui-egui/tests/pageboxes.rs+++ b/crates/ui-egui/tests/pageboxes.rs@@ -2,7 +2,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp, QuickTool};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp, QuickTool};const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -12,9 +12,9 @@ const FIXTURE: &[u8] = b"%PDF-1.7trailer << /Root 1 0 R >>%%EOF";-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, FIXTURE.to_vec()).unwrap();app.set_option("left", "closed").unwrap();app.set_option("zoom", "150").unwrap();@@ -24,7 +24,7 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn size(h: &Harness<'static, PrintCraftApp>, page: usize) -> (f32, f32) {+fn size(h: &Harness<'static, PdfCraftApp>, page: usize) -> (f32, f32) {let s = h.state();let p = &s.session.get(s.views[0].id).unwrap().info.pages[page];(p.width, p.height)diff --git a/crates/ui-egui/tests/pdf_links.rs b/crates/ui-egui/tests/pdf_links.rsindex 27f0f2905..8095ec10c 100644--- a/crates/ui-egui/tests/pdf_links.rs+++ b/crates/ui-egui/tests/pdf_links.rs@@ -3,13 +3,13 @@use egui::Pos2;use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::LinkAction;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_engine::LinkAction;+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {// 60 fps steps, so two clicks fall inside egui's double-click window.let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("zoom", "150").unwrap();app@@ -18,13 +18,13 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).unwrap();let k = r.width() / 300.0;r.min + egui::vec2(x * k, y * k)}-fn drag(h: &mut Harness<'static, PrintCraftApp>, a: Pos2, b: Pos2) {+fn drag(h: &mut Harness<'static, PdfCraftApp>, a: Pos2, b: Pos2) {h.hover_at(a);h.run_steps(1);h.drag_at(a);@@ -37,7 +37,7 @@ fn drag(h: &mut Harness<'static, PrintCraftApp>, a: Pos2, b: Pos2) {h.run_steps(3);}-fn links(h: &Harness<'static, PrintCraftApp>) -> Vec<printcraft_engine::LinkItem> {+fn links(h: &Harness<'static, PdfCraftApp>) -> Vec<pdfcraft_engine::LinkItem> {let s = h.state();s.session.get(s.views[0].id).unwrap().links.clone()}diff --git a/crates/ui-egui/tests/perf.rs b/crates/ui-egui/tests/perf.rsindex 8baf12e59..b4a8e45d8 100644--- a/crates/ui-egui/tests/perf.rs+++ b/crates/ui-egui/tests/perf.rs@@ -3,7 +3,7 @@//! worker threads and is not part of the measurement.use egui_kittest::Harness;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;/// The one-minute load average, where the OS reports it (macOS `vm.loadavg`, Linux/// `/proc/loadavg`).@@ -99,7 +99,7 @@ fn scrolling_a_500_page_document_stays_within_the_frame_budget() {let bytes = big(500);let t0 = std::time::Instant::now();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("big.pdf", None, bytes).expect("opens");app});@@ -123,7 +123,7 @@ fn panels_with_hundreds_of_items_stay_within_the_frame_budget() {for panel in ["comments", "pages", "fields"] {let b = bytes.clone();let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("big.pdf", None, b).expect("opens");app.set_option("panel", panel).unwrap();appdiff --git a/crates/ui-egui/tests/prepare.rs b/crates/ui-egui/tests/prepare.rsindex a15e5af46..3b1a5dc3d 100644--- a/crates/ui-egui/tests/prepare.rs+++ b/crates/ui-egui/tests/prepare.rs@@ -4,11 +4,11 @@use egui::Pos2;use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{PrintCraftApp, QuickTool};+use pdfcraft_ui_egui::{PdfCraftApp, QuickTool};-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("zoom", "150").unwrap();app@@ -24,13 +24,13 @@ fn harness() -> Harness<'static, PrintCraftApp> {}/// A point on page 1 at (x, y) points from its top-left.-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).expect("on screen");let k = r.width() / 300.0;r.min + egui::vec2(x * k, y * k)}-fn drag(h: &mut Harness<'static, PrintCraftApp>, a: Pos2, b: Pos2) {+fn drag(h: &mut Harness<'static, PdfCraftApp>, a: Pos2, b: Pos2) {h.hover_at(a);h.run_steps(1);h.drag_at(a);@@ -43,12 +43,12 @@ fn drag(h: &mut Harness<'static, PrintCraftApp>, a: Pos2, b: Pos2) {h.run_steps(4);}-fn names(h: &Harness<'static, PrintCraftApp>) -> Vec<String> {+fn names(h: &Harness<'static, PdfCraftApp>) -> Vec<String> {let s = h.state();s.session.get(s.views[0].id).unwrap().form.iter().map(|f| f.name.clone()).collect()}-fn rect_of(h: &Harness<'static, PrintCraftApp>, name: &str) -> [f64; 4] {+fn rect_of(h: &Harness<'static, PdfCraftApp>, name: &str) -> [f64; 4] {let s = h.state();s.session.get(s.views[0].id).unwrap().form.iter().find(|f| f.name == name).unwrap().widgets[0].rect}@@ -93,7 +93,7 @@ fn placing_moving_editing_and_deleting_a_field() {let s = h.state();let doc = s.session.get(s.views[0].id).unwrap();assert_eq!(doc.can_undo(), Some("Change field properties"));- assert!(doc.form.iter().find(|f| f.name == "email").unwrap().has(printcraft_engine::field_flags::REQUIRED));+ assert!(doc.form.iter().find(|f| f.name == "email").unwrap().has(pdfcraft_engine::field_flags::REQUIRED));assert_eq!(s.views[0].prepare.selected.as_ref().map(|s| s.0.as_str()), Some("email"));}// Delete removes the selected field.@@ -116,7 +116,7 @@ fn placing_moving_editing_and_deleting_a_field() {#[test]fn format_validate_and_calculate_tabs() {- use printcraft_engine::form_scripts::{Calculate, Format, Validate};+ use pdfcraft_engine::form_scripts::{Calculate, Format, Validate};let mut h = harness();h.state_mut().execute("form.prepare");h.run_steps(2);@@ -147,7 +147,7 @@ fn format_validate_and_calculate_tabs() {#[test]fn appearance_tab_restyles_the_field() {- use printcraft_engine::{BorderStyle, FieldFont};+ use pdfcraft_engine::{BorderStyle, FieldFont};let mut h = harness();h.state_mut().execute("form.prepare");h.run_steps(2);@@ -173,12 +173,12 @@ fn appearance_tab_restyles_the_field() {#[test]fn options_tab_sets_the_check_box_style() {// #94: Check Box Style on the Options tab.- use printcraft_engine::CheckStyle;+ use pdfcraft_engine::CheckStyle;let mut h = harness();- h.state_mut().apply_edit(printcraft_engine::Edit::AddField {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::AddField {page: 0,rect: [40.0, 300.0, 56.0, 316.0],- kind: printcraft_engine::NewField::CheckBox,+ kind: pdfcraft_engine::NewField::CheckBox,name: Some("agree".into()),});h.state_mut().open_field_props("agree", 0);@@ -196,7 +196,7 @@ fn options_tab_sets_the_check_box_style() {#[test]fn options_tab_sets_flags_alignment_and_defaults() {- use printcraft_engine::field_flags as ff;+ use pdfcraft_engine::field_flags as ff;let mut h = harness();h.state_mut().open_field_props("city", 0);h.run_steps(2);@@ -225,7 +225,7 @@ fn the_fields_panel_orders_tabs_manually() {h.state_mut().execute("form.prepare");h.state_mut().set_option("panel", "fields").unwrap();h.run_steps(3);- let order = |h: &Harness<'static, PrintCraftApp>| -> Vec<String> {+ let order = |h: &Harness<'static, PdfCraftApp>| -> Vec<String> {let s = h.state();let form = &s.session.get(s.views[0].id).unwrap().form;let mut v: Vec<(usize, String)> = form.iter().filter_map(|f| f.widgets.iter().map(|w| w.tab).min().map(|t| (t, f.name.clone()))).collect();@@ -245,14 +245,14 @@ fn the_fields_panel_orders_tabs_manually() {#[test]fn duplicating_a_field_onto_every_page() {let mut h = harness();- h.state_mut().apply_edit(printcraft_engine::Edit::InsertBlankPage { at: 1, width: 300.0, height: 400.0 });+ h.state_mut().apply_edit(pdfcraft_engine::Edit::InsertBlankPage { at: 1, width: 300.0, height: 400.0 });h.state_mut().execute("form.prepare");h.run_steps(3);let (n, p) = {let s = h.state();let doc = s.session.get(s.views[0].id).unwrap();let f = doc.form.iter().find(|f| f.name == "city").unwrap();- (doc.info.pages.len(), printcraft_ui_egui::forms_ui::field_screen_rect(&s.views[0], &doc.info, f, 0).expect("on screen").center())+ (doc.info.pages.len(), pdfcraft_ui_egui::forms_ui::field_screen_rect(&s.views[0], &doc.info, f, 0).expect("on screen").center())};assert!(n >= 2, "the fixture has {n} pages");h.hover_at(p);@@ -276,19 +276,19 @@ fn duplicating_a_field_onto_every_page() {#[test]fn aligning_distributing_and_sizing_several_fields() {- use printcraft_ui_egui::prepare::{Arrange, arrange};+ use pdfcraft_ui_egui::prepare::{Arrange, arrange};let mut h = harness();for (name, x, y, w) in [("a", 20.0, 300.0, 60.0), ("b", 120.0, 280.0, 80.0), ("c", 260.0, 260.0, 30.0)] {- h.state_mut().apply_edit(printcraft_engine::Edit::AddField {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::AddField {page: 0,rect: [x, y, x + w, y + 20.0],- kind: printcraft_engine::NewField::Text { multiline: false },+ kind: pdfcraft_engine::NewField::Text { multiline: false },name: Some(name.into()),});}h.run_steps(2);- let form = |h: &Harness<'static, PrintCraftApp>| h.state().session.get(h.state().views[0].id).unwrap().form.as_ref().clone();- let rect = |h: &Harness<'static, PrintCraftApp>, n: &str| form(h).iter().find(|f| f.name == n).unwrap().widgets[0].rect;+ let form = |h: &Harness<'static, PdfCraftApp>| h.state().session.get(h.state().views[0].id).unwrap().form.as_ref().clone();+ let rect = |h: &Harness<'static, PdfCraftApp>, n: &str| form(h).iter().find(|f| f.name == n).unwrap().widgets[0].rect;let a = ("a".to_string(), 0);let others = vec![("b".to_string(), 0), ("c".to_string(), 0)];// Align tops with a.@@ -313,10 +313,10 @@ fn aligning_distributing_and_sizing_several_fields() {fn deleting_several_selected_fields_and_detecting_fields_from_the_panel() {let mut h = harness();for (name, x) in [("a", 20.0), ("b", 120.0), ("c", 220.0)] {- h.state_mut().apply_edit(printcraft_engine::Edit::AddField {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::AddField {page: 0,rect: [x, 300.0, x + 60.0, 320.0],- kind: printcraft_engine::NewField::Text { multiline: false },+ kind: pdfcraft_engine::NewField::Text { multiline: false },name: Some(name.into()),});}@@ -357,7 +357,7 @@ fn preview_fills_the_form_and_locked_fields_keep_their_properties() {h.run_steps(1);h.get_by_label("OK").click();h.run_steps(3);- let locked = |h: &Harness<'static, PrintCraftApp>| {+ let locked = |h: &Harness<'static, PdfCraftApp>| {let s = h.state();s.session.get(s.views[0].id).unwrap().form.iter().find(|f| f.name == "city").unwrap().locked()};@@ -381,7 +381,7 @@ fn image_fields_take_a_picture_when_clicked() {drag(&mut h, a, b);assert_eq!(names(&h).last().map(String::as_str), Some("Image1"));// A picture to choose (the picker is bypassed in tests).- let path = std::env::temp_dir().join(format!("printcraft-image-field-{}.png", std::process::id()));+ let path = std::env::temp_dir().join(format!("pdfcraft-image-field-{}.png", std::process::id()));image::RgbImage::from_pixel(8, 4, image::Rgb([200, 30, 30])).save(&path).unwrap();h.state_mut().save_override = Some(path.to_string_lossy().into_owned());// Fill it in as a reader would.@@ -400,7 +400,7 @@ fn image_fields_take_a_picture_when_clicked() {#[test]fn actions_tab_adds_and_removes_actions() {- use printcraft_engine::{FieldAction, FieldTrigger};+ use pdfcraft_engine::{FieldAction, FieldTrigger};let mut h = harness();h.state_mut().execute("form.prepare");h.run_steps(2);diff --git a/crates/ui-egui/tests/print.rs b/crates/ui-egui/tests/print.rsindex b578e282a..31d881027 100644--- a/crates/ui-egui/tests/print.rs+++ b/crates/ui-egui/tests/print.rs@@ -2,11 +2,11 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app});@@ -27,7 +27,7 @@ fn print_dialog_lays_out_sheets_and_saves_a_pdf() {h.run_steps(2);h.get_by_label("Sheet 1 of 1");// No printer on a test machine: Save as PDF.- let out = std::env::temp_dir().join(format!("printcraft-print-test-{}.pdf", std::process::id()));+ let out = std::env::temp_dir().join(format!("pdfcraft-print-test-{}.pdf", std::process::id()));h.state_mut().save_override = Some(out.to_string_lossy().into_owned());h.state_mut().print_draft.printer = None;h.run_steps(1);@@ -35,8 +35,8 @@ fn print_dialog_lays_out_sheets_and_saves_a_pdf() {h.run_steps(3);assert_eq!(h.state().dialog, None);let bytes = std::fs::read(&out).expect("saved");- let doc = printcraft_cos::Document::open(std::sync::Arc::new(bytes)).unwrap();- assert_eq!(printcraft_model::pages(&doc).len(), 1);+ let doc = pdfcraft_cos::Document::open(std::sync::Arc::new(bytes)).unwrap();+ assert_eq!(pdfcraft_model::pages(&doc).len(), 1);let _ = std::fs::remove_file(out);}@@ -45,7 +45,7 @@ fn invalid_ranges_are_explained_in_the_preview() {let mut h = harness();h.state_mut().execute("print.dialog");h.run_steps(2);- h.state_mut().print_draft.which = printcraft_ui_egui::PrintWhich::Range;+ h.state_mut().print_draft.which = pdfcraft_ui_egui::PrintWhich::Range;h.state_mut().print_draft.range = "7".into();h.run_steps(2);h.get_by_label_contains("out of range");diff --git a/crates/ui-egui/tests/protect.rs b/crates/ui-egui/tests/protect.rsindex c38c6ebf8..714d50955 100644--- a/crates/ui-egui/tests/protect.rs+++ b/crates/ui-egui/tests/protect.rs@@ -2,7 +2,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -11,9 +11,9 @@ const FIXTURE: &[u8] = b"%PDF-1.7trailer << /Root 1 0 R >>%%EOF";-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("doc.pdf", None, FIXTURE.to_vec()).unwrap();app});@@ -21,7 +21,7 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn type_into(h: &mut Harness<'static, PrintCraftApp>, label: &str, text: &str) {+fn type_into(h: &mut Harness<'static, PdfCraftApp>, label: &str, text: &str) {h.get_by_label(label).click();h.run_steps(2);h.get_by_label(label).type_text(text);@@ -50,7 +50,7 @@ fn protecting_for_viewing_requires_matching_passwords_and_saves_encrypted() {assert!(doc.security_summary().unwrap().pending);// What Save writes needs the password.let bytes = h.state().session.save_bytes(id).unwrap();- let mut s = printcraft_engine::Session::new();+ let mut s = pdfcraft_engine::Session::new();assert!(s.open("p.pdf", None, bytes.clone(), None).is_err());assert!(s.open("p.pdf", None, bytes, Some("Open-Sesame-42")).is_ok());// Remove security is now offered, and undo also takes the protection back.diff --git a/crates/ui-egui/tests/recovery.rs b/crates/ui-egui/tests/recovery.rsindex 2148bbfba..6f59bb168 100644--- a/crates/ui-egui/tests/recovery.rs+++ b/crates/ui-egui/tests/recovery.rs@@ -5,8 +5,8 @@ use egui::accesskit::Role;use egui::{Key, Modifiers};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::Edit;-use printcraft_ui_egui::{PrintCraftApp, RecoveryStore};+use pdfcraft_engine::Edit;+use pdfcraft_ui_egui::{PdfCraftApp, RecoveryStore};fn fixture(n: usize) -> Vec<u8> {let mut objs: Vec<String> = vec!["<< /Type /Catalog /Pages 2 0 R >>".into()];@@ -34,7 +34,7 @@ fn fixture(n: usize) -> Vec<u8> {}fn store(tag: &str) -> RecoveryStore {- let dir = std::env::temp_dir().join(format!("printcraft-recovery-{tag}-{}", std::process::id()));+ let dir = std::env::temp_dir().join(format!("pdfcraft-recovery-{tag}-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);RecoveryStore::new(dir)}@@ -45,7 +45,7 @@ fn files_in(s: &RecoveryStore) -> usize {/// A session that edits a document, autosaves, and then "crashes" (is dropped).fn crashed_session(s: &RecoveryStore, bytes: Vec<u8>, password: Option<&str>, path: Option<&str>) {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.enable_recovery(s.clone());match password {Some(pw) => {@@ -59,9 +59,9 @@ fn crashed_session(s: &RecoveryStore, bytes: Vec<u8>, password: Option<&str>, pa// Dropped without a clean quit: the recovery entry stays.}-fn harness(s: RecoveryStore) -> Harness<'static, PrintCraftApp> {+fn harness(s: RecoveryStore) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.enable_recovery(s);app});@@ -102,7 +102,7 @@ fn discarding_removes_the_autosaves() {#[test]fn saving_or_closing_clears_the_entry_and_nothing_is_written_for_clean_documents() {let s = store("save");- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.enable_recovery(s.clone());app.open_bytes("a.pdf", None, fixture(2)).unwrap();app.autosave_now();@@ -110,9 +110,9 @@ fn saving_or_closing_clears_the_entry_and_nothing_is_written_for_clean_documentsapp.apply_edit(Edit::RotatePages { pages: vec![0], degrees: 90 });app.autosave_now();assert_eq!(s.list().len(), 1);- let out = std::env::temp_dir().join(format!("printcraft-recovery-saved-{}.pdf", std::process::id()));+ let out = std::env::temp_dir().join(format!("pdfcraft-recovery-saved-{}.pdf", std::process::id()));app.save_override = Some(out.to_string_lossy().into_owned());- assert!(app.save_active(printcraft_ui_egui::SaveTarget::InPlace));+ assert!(app.save_active(pdfcraft_ui_egui::SaveTarget::InPlace));assert_eq!(files_in(&s), 0, "saved: nothing to recover");// Edit again, autosave, then close and discard.app.apply_edit(Edit::RotatePages { pages: vec![0], degrees: 90 });@@ -129,7 +129,7 @@ fn quitting_cleanly_leaves_nothing_behind() {let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe({let s = s.clone();move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.enable_recovery(s);app.open_bytes("q.pdf", None, fixture(2)).unwrap();app@@ -140,7 +140,7 @@ fn quitting_cleanly_leaves_nothing_behind() {h.state_mut().autosave_now();assert_eq!(s.list().len(), 1);// Quit → "Don't save" → the app closes and the autosave is removed.- h.state_mut().close_request = Some(printcraft_ui_egui::CloseRequest::Quit);+ h.state_mut().close_request = Some(pdfcraft_ui_egui::CloseRequest::Quit);h.run_steps(2);h.get_by_label("Don't save").click();h.run_steps(4);@@ -151,9 +151,9 @@ fn quitting_cleanly_leaves_nothing_behind() {#[test]fn encrypted_documents_are_autosaved_encrypted_and_recovered_with_the_password() {- let mut doc = printcraft_cos::Document::open(std::sync::Arc::new(fixture(2))).unwrap();- doc.set_encryption(&printcraft_cos::NewEncryption {- algorithm: printcraft_cos::Algorithm::Aes256,+ let mut doc = pdfcraft_cos::Document::open(std::sync::Arc::new(fixture(2))).unwrap();+ doc.set_encryption(&pdfcraft_cos::NewEncryption {+ algorithm: pdfcraft_cos::Algorithm::Aes256,user_password: "pw",owner_password: "owner",permissions: -1,@@ -161,7 +161,7 @@ fn encrypted_documents_are_autosaved_encrypted_and_recovered_with_the_password()seed: [2; 32],}).unwrap();- let bytes = printcraft_cos::write_full(&doc, &Default::default()).unwrap();+ let bytes = pdfcraft_cos::write_full(&doc, &Default::default()).unwrap();let s = store("encrypted");crashed_session(&s, bytes, Some("pw"), None);let meta = s.list().remove(0);@@ -202,17 +202,17 @@ fn incomplete_entries_are_ignored_and_cleaned_up() {fn control_click_effects_are_visible_when_the_reply_arrives() {let s = store("control");crashed_session(&s, fixture(2), None, None);- let slot: std::sync::Arc<std::sync::Mutex<Option<printcraft_ui_egui::control::ControlClient>>> = Default::default();+ let slot: std::sync::Arc<std::sync::Mutex<Option<pdfcraft_ui_egui::control::ControlClient>>> = Default::default();let (slot2, s2) = (slot.clone(), s.clone());let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();*slot2.lock().unwrap() = Some(app.attach_control(&cc.egui_ctx));app.enable_recovery(s2);app});h.run_steps(4);let c = slot.lock().unwrap().take().unwrap();- let call = |h: &mut Harness<'static, PrintCraftApp>, m: &str, p: serde_json::Value| {+ let call = |h: &mut Harness<'static, PdfCraftApp>, m: &str, p: serde_json::Value| {let rx = c.send(m, p);for _ in 0..30 {h.step();diff --git a/crates/ui-egui/tests/redact.rs b/crates/ui-egui/tests/redact.rsindex 9c162eb15..b2037788f 100644--- a/crates/ui-egui/tests/redact.rs+++ b/crates/ui-egui/tests/redact.rs@@ -4,11 +4,11 @@use egui::Pos2;use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("zoom", "150").unwrap();app@@ -23,13 +23,13 @@ fn harness() -> Harness<'static, PrintCraftApp> {h}-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).expect("on screen");let k = r.width() / 300.0;r.min + egui::vec2(x * k, y * k)}-fn marks(h: &Harness<'static, PrintCraftApp>) -> usize {+fn marks(h: &Harness<'static, PdfCraftApp>) -> usize {let s = h.state();s.session.get(s.views[0].id).unwrap().redaction_marks()}@@ -87,7 +87,7 @@ fn removing_hidden_information_and_sanitizing() {h.get_by_label("Remove hidden information");{let d = &h.state().hidden_draft;- let fields = d.found.iter().find(|f| f.0 == printcraft_engine::Hidden::FormFields).unwrap();+ let fields = d.found.iter().find(|f| f.0 == pdfcraft_engine::Hidden::FormFields).unwrap();assert_eq!((fields.1, fields.2), (5, true), "five fields, checked");}h.get_by_label("Remove").click();diff --git a/crates/ui-egui/tests/signing.rs b/crates/ui-egui/tests/signing.rsindex 661a9b155..18a387b0d 100644--- a/crates/ui-egui/tests/signing.rs+++ b/crates/ui-egui/tests/signing.rs@@ -3,8 +3,8 @@use egui::{Pos2, pos2};use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_engine::SignatureStatus;-use printcraft_ui_egui::{Dialog, PrintCraftApp, QuickTool, RightPanel, SignStep};+use pdfcraft_engine::SignatureStatus;+use pdfcraft_ui_egui::{Dialog, PdfCraftApp, QuickTool, RightPanel, SignStep};const FIXTURE: &[u8] = b"%PDF-1.71 0 obj << /Type /Catalog /Pages 2 0 R >> endobj@@ -21,15 +21,15 @@ trailer << /Root 1 0 R >>fn dir() -> std::path::PathBuf {static NEXT: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);let n = NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);- let d = std::env::temp_dir().join(format!("printcraft-signing-ui-{}-{n}", std::process::id()));+ let d = std::env::temp_dir().join(format!("pdfcraft-signing-ui-{}-{n}", std::process::id()));let _ = std::fs::remove_dir_all(&d);std::fs::create_dir_all(&d).unwrap();d}-fn harness(dir: std::path::PathBuf) -> Harness<'static, PrintCraftApp> {+fn harness(dir: std::path::PathBuf) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("contract.pdf", None, FIXTURE.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();app.export_dir_override = Some(dir.to_string_lossy().into_owned());@@ -40,12 +40,12 @@ fn harness(dir: std::path::PathBuf) -> Harness<'static, PrintCraftApp> {h}-fn at(h: &Harness<'static, PrintCraftApp>, x: f32, y: f32) -> Pos2 {+fn at(h: &Harness<'static, PdfCraftApp>, x: f32, y: f32) -> Pos2 {let r = h.state().views[0].page_screen_rect(0).expect("page 1 on screen");pos2(r.left() + x / 300.0 * r.width(), r.top() + (200.0 - y) / 200.0 * r.height())}-fn drag(h: &mut Harness<'static, PrintCraftApp>, from: Pos2, to: Pos2) {+fn drag(h: &mut Harness<'static, PdfCraftApp>, from: Pos2, to: Pos2) {h.hover_at(from);h.run_steps(1);h.drag_at(from);@@ -58,7 +58,7 @@ fn drag(h: &mut Harness<'static, PrintCraftApp>, from: Pos2, to: Pos2) {h.run_steps(3);}-fn field<'a>(h: &'a Harness<'static, PrintCraftApp>, label: &'a str) -> egui_kittest::Node<'a> {+fn field<'a>(h: &'a Harness<'static, PdfCraftApp>, label: &'a str) -> egui_kittest::Node<'a> {h.get_all_by_label(label).last().unwrap_or_else(|| panic!("no {label:?}"))}@@ -154,7 +154,7 @@ fn drawing_a_signature_creating_an_id_signing_and_trusting() {assert!(v.name.contains("signed version") && v.signatures.iter().any(|x| x.signed));// Trusted certificates and the ID list persist.let saved = s.persist();- let mut fresh = PrintCraftApp::new();+ let mut fresh = PdfCraftApp::new();fresh.restore(&saved);assert_eq!((fresh.digital_ids.len(), fresh.session.trusted_certificates().len()), (1, 1));}@@ -224,7 +224,7 @@ fn clicking_an_empty_signature_field_signs_it() {assert_eq!(h.state().dialog, Some(Dialog::Sign));assert_eq!(h.state().sign_draft.as_ref().and_then(|d| d.field.clone()).as_deref(), Some("Approver"));let entry = {- let id = printcraft_engine::sign::pkcs12::open(+ let id = pdfcraft_engine::sign::pkcs12::open(&std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/../sign/tests/data/ec-p256.p12")).unwrap(),"test",)diff --git a/crates/ui-egui/tests/stamps.rs b/crates/ui-egui/tests/stamps.rsindex 6fbe076d1..3665f1875 100644--- a/crates/ui-egui/tests/stamps.rs+++ b/crates/ui-egui/tests/stamps.rs@@ -2,12 +2,12 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{PrintCraftApp, QuickTool};+use pdfcraft_ui_egui::{PdfCraftApp, QuickTool};#[test]fn choosing_and_placing_stamps() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("zoom", "150").unwrap();app@@ -18,7 +18,7 @@ fn choosing_and_placing_stamps() {h.get_by_label("Add a stamp");h.get_all_by_label("APPROVED").next().expect("dynamic approved").click();h.run_steps(2);- assert_eq!(h.state().quick_tool, QuickTool::Stamp(printcraft_engine::StampKind::DynApproved));+ assert_eq!(h.state().quick_tool, QuickTool::Stamp(pdfcraft_engine::StampKind::DynApproved));let p = {let r = h.state().views[0].page_screen_rect(0).unwrap();r.min + egui::vec2(r.width() * 0.5, r.height() * 0.85)@@ -38,7 +38,7 @@ fn choosing_and_placing_stamps() {h.run_steps(2);std::thread::sleep(std::time::Duration::from_millis(10));}- if let Ok(dir) = std::env::var("PRINTCRAFT_SHOTS") {+ if let Ok(dir) = std::env::var("PDFCRAFT_SHOTS") {h.render().unwrap().save(format!("{dir}/stamps.png")).unwrap();}}@@ -46,7 +46,7 @@ fn choosing_and_placing_stamps() {#[test]fn creating_placing_and_keeping_custom_stamps() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();app.set_option("zoom", "150").unwrap();app@@ -87,7 +87,7 @@ fn creating_placing_and_keeping_custom_stamps() {assert_eq!(doc.can_undo(), Some("Add stamp"));// The library is kept with the app's settings.let saved = s.persist();- let mut again = PrintCraftApp::new();+ let mut again = PdfCraftApp::new();again.restore(&saved);assert_eq!(again.custom_stamps.len(), 1);assert_eq!((again.custom_stamps[0].category.as_str(), again.custom_stamps[0].name.as_str()), ("Company", "logo"));diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rsindex 1925a6730..e5547f602 100644--- a/crates/ui-egui/tests/ui.rs+++ b/crates/ui-egui/tests/ui.rs@@ -2,7 +2,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;/// A tiny PDF with two pages, two bookmarks and one sticky note.const FIXTURE: &[u8] = b"%PDF-1.7@@ -17,9 +17,9 @@ const FIXTURE: &[u8] = b"%PDF-1.7trailer << /Root 1 0 R >>%%EOF";-fn harness(setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Harness<'static, PrintCraftApp> {+fn harness(setup: impl FnOnce(&mut PdfCraftApp) + 'static) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();setup(&mut app);app});@@ -31,7 +31,7 @@ fn harness(setup: impl FnOnce(&mut PrintCraftApp) + 'static) -> Harness<'static,#[test]fn home_shows_welcome_and_tools() {let h = harness(|_| {});- h.get_by_label_contains("Welcome to PrintCraft");+ h.get_by_label_contains("Welcome to PdfCraft");assert!(h.query_all_by_label("Organize pages").count() >= 2, "tool list + home card");h.get_by_label("Open file");}@@ -41,7 +41,7 @@ fn every_catalog_tool_is_listed_after_view_more() {let mut h = harness(|_| {});h.get_by_label("View more").click();h.run_steps(3);- for g in printcraft_engine::catalog::TOOL_GROUPS {+ for g in pdfcraft_engine::catalog::TOOL_GROUPS {assert!(h.query_all_by_label(g.label).count() >= 1, "tool {} missing from All tools", g.label);}}@@ -59,7 +59,7 @@ fn opening_a_pdf_shows_comments_and_bookmarks() {#[test]fn garbage_input_is_rejected_without_panicking() {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();assert!(app.open_bytes("junk.pdf", None, b"this is not a pdf".to_vec()).is_err());assert!(app.open_bytes("empty.pdf", None, Vec::new()).is_err());let mut truncated = FIXTURE.to_vec();@@ -97,7 +97,7 @@ endstream endobjtrailer << /Root 1 0 R >>%%EOF";-fn settle(h: &mut Harness<'static, PrintCraftApp>) {+fn settle(h: &mut Harness<'static, PdfCraftApp>) {for _ in 0..200 {h.run_steps(2);if !h.state().render_pending() {@@ -157,15 +157,15 @@ fn drag_selects_text_and_copy_returns_it() {#[test]fn persistence_round_trips_and_tolerates_garbage() {- let mut a = PrintCraftApp::new();- a.theme = printcraft_ui_egui::theme::ThemeKind::Dark;+ let mut a = PdfCraftApp::new();+ a.theme = pdfcraft_ui_egui::theme::ThemeKind::Dark;let json = a.persist();- let mut b = PrintCraftApp::new();+ let mut b = PdfCraftApp::new();b.restore(&json);- assert_eq!(b.theme, printcraft_ui_egui::theme::ThemeKind::Dark);+ assert_eq!(b.theme, pdfcraft_ui_egui::theme::ThemeKind::Dark);b.restore("{not json");b.restore("{\"recent\": 5, \"theme\": \"Purple\"}");- assert_eq!(b.theme, printcraft_ui_egui::theme::ThemeKind::Dark);+ assert_eq!(b.theme, pdfcraft_ui_egui::theme::ThemeKind::Dark);}#[test]@@ -231,7 +231,7 @@ impl egui::DroppedFile for Dropped {#[test]fn dropping_a_pdf_on_the_window_opens_it() {- let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(|_cc| PrintCraftApp::new());+ let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(|_cc| PdfCraftApp::new());h.run_steps(3);assert!(h.state().views.is_empty());let file: egui::DroppedFileHandle = std::sync::Arc::new(Dropped { path: "dropped.pdf".into(), bytes: FIXTURE.to_vec() });@@ -244,8 +244,8 @@ fn dropping_a_pdf_on_the_window_opens_it() {#[test]fn files_and_quit_from_the_operating_system() {// #73: macOS hands Finder double-clicks, Open With and Dock drops over as Apple events.- use printcraft_ui_egui::OsEvent;- let name = format!("printcraft-os-open-{}.pdf", std::process::id());+ use pdfcraft_ui_egui::OsEvent;+ let name = format!("pdfcraft-os-open-{}.pdf", std::process::id());let path = std::env::temp_dir().join(&name);std::fs::write(&path, FIXTURE).unwrap();let queue = std::rc::Rc::new(std::cell::RefCell::new(vec![OsEvent::Open(vec![path.to_string_lossy().into_owned()])]));diff --git a/crates/ui-egui/tests/updates.rs b/crates/ui-egui/tests/updates.rsindex 816fb4d4f..141c27818 100644--- a/crates/ui-egui/tests/updates.rs+++ b/crates/ui-egui/tests/updates.rs@@ -4,24 +4,24 @@ use std::sync::Arc;use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::PrintCraftApp;-use printcraft_ui_egui::updates::{Release, UpdateSource, is_newer};+use pdfcraft_ui_egui::PdfCraftApp;+use pdfcraft_ui_egui::updates::{Release, UpdateSource, is_newer};fn source(answer: Result<&str, &str>) -> UpdateSource {let answer = answer.map(str::to_string).map_err(str::to_string);- Arc::new(move || answer.clone().map(|v| Release { url: format!("https://github.com/storytold/printcraft/releases/tag/{v}"), version: v }))+ Arc::new(move || answer.clone().map(|v| Release { url: format!("https://github.com/storytold/pdfcraft/releases/tag/{v}"), version: v }))}-fn harness(answer: Result<&str, &str>) -> Harness<'static, PrintCraftApp> {+fn harness(answer: Result<&str, &str>) -> Harness<'static, PdfCraftApp> {Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.update_source = Some(source(answer));app})}/// Run frames until the background check has reported (or give up).-fn settle(h: &mut Harness<'static, PrintCraftApp>) {+fn settle(h: &mut Harness<'static, PdfCraftApp>) {for _ in 0..200 {h.run_steps(2);if h.query_by_label_contains("Checking for a newer version").is_none() {@@ -50,7 +50,7 @@ fn a_newer_release_is_offered_for_download() {let mut h = harness(Ok("v99.0.0"));h.state_mut().execute("help.check_updates");settle(&mut h);- h.get_by_label_contains("PrintCraft 99.0.0 is available");+ h.get_by_label_contains("PdfCraft 99.0.0 is available");h.get_by_label("Download");h.get_by_label("Later").click();h.run_steps(3);@@ -77,13 +77,13 @@ fn nothing_is_asked_until_the_user_checks() {let calls = Arc::new(std::sync::atomic::AtomicUsize::new(0));let counted = calls.clone();let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();// Settings from a build that had the startup option are ignored.app.restore(r#"{"check_updates_at_start": true}"#);let counted = counted.clone();app.update_source = Some(Arc::new(move || {counted.fetch_add(1, std::sync::atomic::Ordering::SeqCst);- Ok(Release { version: "v99.0.0".into(), url: "https://github.com/storytold/printcraft/releases/tag/v99.0.0".into() })+ Ok(Release { version: "v99.0.0".into(), url: "https://github.com/storytold/pdfcraft/releases/tag/v99.0.0".into() })}));app});@@ -93,5 +93,5 @@ fn nothing_is_asked_until_the_user_checks() {h.state_mut().execute("help.check_updates");settle(&mut h);assert_eq!(calls.load(std::sync::atomic::Ordering::SeqCst), 1);- h.get_by_label_contains("PrintCraft 99.0.0 is available");+ h.get_by_label_contains("PdfCraft 99.0.0 is available");}diff --git a/crates/ui-egui/tests/view.rs b/crates/ui-egui/tests/view.rsindex 5d017f1f8..ad9df9b15 100644--- a/crates/ui-egui/tests/view.rs+++ b/crates/ui-egui/tests/view.rs@@ -2,7 +2,7 @@use egui::{Key, Modifiers};use egui_kittest::Harness;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;/// Three 300×400 pt pages. Page 1 links to page 3.const PAGES: &[u8] = b"%PDF-1.7@@ -27,9 +27,9 @@ fn gpu() -> std::sync::MutexGuard<'static, ()> {GPU.lock().unwrap_or_else(std::sync::PoisonError::into_inner)}-fn harness(options: &'static [(&'static str, &'static str)]) -> Harness<'static, PrintCraftApp> {+fn harness(options: &'static [(&'static str, &'static str)]) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("pages.pdf", None, PAGES.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();app.set_option("panel", "none").unwrap();@@ -42,7 +42,7 @@ fn harness(options: &'static [(&'static str, &'static str)]) -> Harness<'static,h}-fn rect(h: &Harness<'static, PrintCraftApp>, page: usize) -> Option<egui::Rect> {+fn rect(h: &Harness<'static, PdfCraftApp>, page: usize) -> Option<egui::Rect> {h.state().views[0].page_screen_rect(page)}@@ -131,9 +131,9 @@ endstream endobjtrailer << /Root 1 0 R >>%%EOF";-fn form_harness() -> Harness<'static, PrintCraftApp> {+fn form_harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, FORM.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();app@@ -170,7 +170,7 @@ fn highlight_fields_tints_the_field_area() {let r = rect(&h, 0).expect("page 1");// The field spans x 50..250, y 300..330 (PDF space, y up) on a 300×400 page; sample inside it.let at = egui::pos2(r.min.x + r.width() * (60.0 / 300.0), r.min.y + r.height() * (1.0 - 305.0 / 400.0));- let pixel = |h: &mut Harness<'static, PrintCraftApp>| {+ let pixel = |h: &mut Harness<'static, PdfCraftApp>| {let img = h.render().expect("renders");let ppp = h.ctx.pixels_per_point();*img.get_pixel((at.x * ppp) as u32, (at.y * ppp) as u32)@@ -221,8 +221,8 @@ fn required_fields_get_a_red_border_when_highlighting() {let mut h = form_harness();h.state_mut().set_option("panel", "none").unwrap();h.state_mut().set_option("fields", "on").unwrap();- let props = printcraft_engine::FieldProps { required: Some(true), ..Default::default() };- h.state_mut().apply_edit(printcraft_engine::Edit::SetFieldProps { name: "fullname".into(), props: Box::new(props) });+ let props = pdfcraft_engine::FieldProps { required: Some(true), ..Default::default() };+ h.state_mut().apply_edit(pdfcraft_engine::Edit::SetFieldProps { name: "fullname".into(), props: Box::new(props) });for _ in 0..100 {h.run_steps(2);if !h.state().render_pending() {diff --git a/crates/ui-egui/tests/viewer.rs b/crates/ui-egui/tests/viewer.rsindex e93a763eb..355cc6b6f 100644--- a/crates/ui-egui/tests/viewer.rs+++ b/crates/ui-egui/tests/viewer.rs@@ -3,7 +3,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::{Dialog, PrintCraftApp};+use pdfcraft_ui_egui::{Dialog, PdfCraftApp};/// `n` pages of 200×300; page i says "Page i+1" plus "page" and "Pages" for find tests.fn fixture(n: usize) -> Vec<u8> {@@ -31,9 +31,9 @@ fn fixture(n: usize) -> Vec<u8> {out}-fn harness() -> Harness<'static, PrintCraftApp> {+fn harness() -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("a.pdf", None, fixture(5)).unwrap();app.open_bytes("b.pdf", None, fixture(2)).unwrap();app@@ -52,18 +52,18 @@ fn harness() -> Harness<'static, PrintCraftApp> {fn close_all_asks_only_for_changed_documents() {let mut h = harness();// Change the active document (b.pdf).- h.state_mut().apply_edit(printcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });+ h.state_mut().apply_edit(pdfcraft_engine::Edit::RotatePages { pages: vec![0], degrees: 90 });h.state_mut().execute("file.close_all");h.run_steps(2);assert_eq!(h.state().views.len(), 1, "the clean document closed at once");- assert_eq!(h.state().close_request, Some(printcraft_ui_egui::CloseRequest::All), "b.pdf asks to be saved");+ assert_eq!(h.state().close_request, Some(pdfcraft_ui_egui::CloseRequest::All), "b.pdf asks to be saved");h.get_by_label_contains("Save changes");}#[test]fn revert_after_confirming() {let mut h = harness();- h.state_mut().apply_edit(printcraft_engine::Edit::DeletePages { pages: vec![0] });+ h.state_mut().apply_edit(pdfcraft_engine::Edit::DeletePages { pages: vec![0] });assert!(h.state_mut().execute("file.revert"));h.run_steps(2);assert_eq!(h.state().dialog, Some(Dialog::Revert));@@ -126,7 +126,7 @@ fn view_history_select_all_and_find_options() {#[test]fn layouts_fit_height_labels_and_system_theme() {- use printcraft_ui_egui::canvas::{Fit, PageLayout};+ use pdfcraft_ui_egui::canvas::{Fit, PageLayout};let mut h = harness();h.state_mut().active = Some(0);// Fit height: the page's height fills the view (less the margins).@@ -151,10 +151,10 @@ fn layouts_fit_height_labels_and_system_theme() {assert!(a.left() > vp.center().x - 1.0, "the cover sits on the right");assert!(b.top() > a.bottom() && (b.top() - c.top()).abs() < 1.0, "then pairs 2–3");// Page labels in the page box.- h.state_mut().apply_edit(printcraft_engine::Edit::NumberPages {+ h.state_mut().apply_edit(pdfcraft_engine::Edit::NumberPages {from: 0,to: 1,- style: printcraft_engine::LabelStyle::LowerRoman,+ style: pdfcraft_engine::LabelStyle::LowerRoman,prefix: String::new(),first: 1,});@@ -176,13 +176,13 @@ fn layouts_fit_height_labels_and_system_theme() {fn two_page_view_steps_a_spread_at_a_time() {// #70: ⌘→ went to the right-hand page of the same spread, so the view never moved.use egui::{Key, Modifiers};- use printcraft_ui_egui::canvas::{Fit, PageLayout};+ use pdfcraft_ui_egui::canvas::{Fit, PageLayout};let mut h = harness();h.state_mut().active = Some(0);h.state_mut().views[0].fit = Fit::Width;h.state_mut().views[0].layout = PageLayout::TwoUp;h.run_steps(4);- let step = |h: &mut Harness<'static, PrintCraftApp>, key| {+ let step = |h: &mut Harness<'static, PdfCraftApp>, key| {h.key_press_modifiers(Modifiers::COMMAND, key);h.run_steps(4);h.state().views[0].current@@ -207,7 +207,7 @@ trailer << /Root 1 0 R >>%%EOF".to_vec();let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("damaged.pdf", None, damaged.clone()).unwrap();app});@@ -215,15 +215,15 @@ trailer << /Root 1 0 R >>h.get_by_label_contains("This file was damaged and has been repaired.");h.get_by_label("Details").click();h.run_steps(3);- assert_eq!(h.state().dialog, Some(Dialog::Properties(printcraft_ui_egui::PropsTab::Advanced)));+ assert_eq!(h.state().dialog, Some(Dialog::Properties(pdfcraft_ui_egui::PropsTab::Advanced)));h.get_by_label("Repair log");}#[test]fn initial_view_is_edited_and_honoured_on_open() {- use printcraft_engine::{InitialLayout, Magnification, Navigation};+ use pdfcraft_engine::{InitialLayout, Magnification, Navigation};let mut h = harness();- h.state_mut().dialog = Some(Dialog::Properties(printcraft_ui_egui::PropsTab::InitialView));+ h.state_mut().dialog = Some(Dialog::Properties(pdfcraft_ui_egui::PropsTab::InitialView));h.run_steps(2);h.get_by_label("Open to page");{@@ -244,13 +244,13 @@ fn initial_view_is_edited_and_honoured_on_open() {assert_eq!(s.session.get(id).unwrap().can_undo(), Some("Change document properties"));// Opening the saved file follows it.let bytes = s.session.save_bytes(id).unwrap();- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("again.pdf", None, bytes.to_vec()).unwrap();let view = &app.views[0];- assert_eq!((view.current, view.cover, app.right), (1, true, Some(printcraft_ui_egui::RightPanel::Bookmarks)));+ assert_eq!((view.current, view.cover, app.right), (1, true, Some(pdfcraft_ui_egui::RightPanel::Bookmarks)));}-fn drag(h: &mut Harness<'static, PrintCraftApp>, a: egui::Pos2, b: egui::Pos2) {+fn drag(h: &mut Harness<'static, PdfCraftApp>, a: egui::Pos2, b: egui::Pos2) {h.hover_at(a);h.run_steps(1);h.drag_at(a);@@ -306,10 +306,10 @@ fn fit_visible_zooms_to_the_content_width() {#[test]fn tab_and_window_show_the_document_title_when_asked() {- use printcraft_engine::Edit;+ use pdfcraft_engine::Edit;let mut h = harness();h.run_steps(2);- assert_eq!(h.state().window_title, "b.pdf — PrintCraft");+ assert_eq!(h.state().window_title, "b.pdf — PdfCraft");{let s = h.state_mut();let id = s.views[s.active.unwrap()].id;@@ -319,13 +319,13 @@ fn tab_and_window_show_the_document_title_when_asked() {s.session.apply(id, Edit::SetInitialView(Box::new(v))).unwrap();}h.run_steps(2);- assert_eq!(h.state().window_title, "Quarterly report — PrintCraft");+ assert_eq!(h.state().window_title, "Quarterly report — PdfCraft");h.get_by_label_contains("Quarterly report");}#[test]fn an_earlier_revision_opens_from_document_properties() {- use printcraft_engine::Edit;+ use pdfcraft_engine::Edit;let mut h = harness();{let s = h.state_mut();@@ -335,7 +335,7 @@ fn an_earlier_revision_opens_from_document_properties() {s.open_bytes("updated.pdf", None, bytes.to_vec()).unwrap();}h.run_steps(2);- h.state_mut().dialog = Some(Dialog::Properties(printcraft_ui_egui::PropsTab::Advanced));+ h.state_mut().dialog = Some(Dialog::Properties(pdfcraft_ui_egui::PropsTab::Advanced));h.run_steps(2);h.run_steps(2);h.get_by_label("View revision 1").click();diff --git a/crates/ui-egui/tests/xfa.rs b/crates/ui-egui/tests/xfa.rsindex bdd545207..ad36e09ec 100644--- a/crates/ui-egui/tests/xfa.rs+++ b/crates/ui-egui/tests/xfa.rs@@ -3,7 +3,7 @@use egui_kittest::Harness;use egui_kittest::kittest::Queryable;-use printcraft_ui_egui::PrintCraftApp;+use pdfcraft_ui_egui::PdfCraftApp;/// A one-page PDF with a proper xref; `acroform` is the catalog's /AcroForm (or empty), `extra`/// more catalog entries, `objects` extra objects numbered from 5.@@ -32,9 +32,9 @@ fn pdf(acroform: &str, extra: &str, objects: &[&str]) -> Vec<u8> {const XFA_PACKET: &str = "<< /Length 52 >>\nstream\n<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\"></xdp:xdp>\nendstream";-fn open(bytes: Vec<u8>) -> Harness<'static, PrintCraftApp> {+fn open(bytes: Vec<u8>) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 800.0)).build_eframe(move |_cc| {- let mut app = PrintCraftApp::new();+ let mut app = PdfCraftApp::new();app.open_bytes("form.pdf", None, bytes).expect("opens");app});@@ -42,7 +42,7 @@ fn open(bytes: Vec<u8>) -> Harness<'static, PrintCraftApp> {h}-fn xfa(h: &Harness<'static, PrintCraftApp>) -> Option<printcraft_render::Xfa> {+fn xfa(h: &Harness<'static, PdfCraftApp>) -> Option<pdfcraft_render::Xfa> {let s = h.state();s.session.get(s.views[0].id).unwrap().info.xfa}@@ -51,18 +51,18 @@ fn xfa(h: &Harness<'static, PrintCraftApp>) -> Option<printcraft_render::Xfa> {fn a_dynamic_xfa_form_says_its_page_is_a_placeholder() {// No fields, the form lives in the XFA packets (an array of name/stream pairs here).let h = open(pdf("/AcroForm << /Fields [] /XFA [(template) 5 0 R] >>", "/NeedsRendering true", &[XFA_PACKET]));- assert_eq!(xfa(&h), Some(printcraft_render::Xfa::Dynamic));+ assert_eq!(xfa(&h), Some(pdfcraft_render::Xfa::Dynamic));h.get_by_label_contains("dynamic XFA form");// Without /NeedsRendering, no fields still means nothing to fill but the placeholder.let h = open(pdf("/AcroForm << /Fields [] /XFA 5 0 R >>", "", &[XFA_PACKET]));- assert_eq!(xfa(&h), Some(printcraft_render::Xfa::Dynamic));+ assert_eq!(xfa(&h), Some(pdfcraft_render::Xfa::Dynamic));}#[test]fn a_static_xfa_form_can_be_filled_but_warns_about_its_xfa_data() {let field = "<< /FT /Tx /T (name) /Rect [20 20 200 40] /Type /Annot /Subtype /Widget /P 3 0 R >>";let h = open(pdf("/AcroForm << /Fields [6 0 R] /XFA 5 0 R >>", "", &[XFA_PACKET, field]));- assert_eq!(xfa(&h), Some(printcraft_render::Xfa::Static));+ assert_eq!(xfa(&h), Some(pdfcraft_render::Xfa::Static));h.get_by_label_contains("also contains XFA data");// The fields can still be highlighted from the notice.h.get_by_label("Highlight fields");@@ -77,5 +77,5 @@ fn ordinary_forms_and_documents_have_no_xfa_notice() {h.get_by_label_contains("interactive form fields");// A malformed /XFA (a number) still counts as XFA; it never crashes the open.let h = open(pdf("/AcroForm << /Fields [] /XFA 42 >>", "", &[]));- assert_eq!(xfa(&h), Some(printcraft_render::Xfa::Dynamic));+ assert_eq!(xfa(&h), Some(pdfcraft_render::Xfa::Dynamic));}diff --git a/crates/xfdf/Cargo.toml b/crates/xfdf/Cargo.tomlindex e6ff01de1..3ede56503 100644--- a/crates/xfdf/Cargo.toml+++ b/crates/xfdf/Cargo.toml@@ -1,5 +1,5 @@[package]-name = "printcraft-xfdf"+name = "pdfcraft-xfdf"description = "Comment and form data exchange: XFDF (ISO 19444-1) and FDF import/export, form data as XML, CSV and tab-delimited text"version.workspace = trueedition.workspace = true@@ -9,9 +9,9 @@ license.workspace = trueworkspace = true[dependencies]-printcraft-cos = { workspace = true }-printcraft-annot = { workspace = true }-printcraft-forms = { workspace = true }-printcraft-model = { workspace = true }+pdfcraft-cos = { workspace = true }+pdfcraft-annot = { workspace = true }+pdfcraft-forms = { workspace = true }+pdfcraft-model = { workspace = true }roxmltree = "0.20"thiserror = { workspace = true }diff --git a/crates/xfdf/README.md b/crates/xfdf/README.mdindex ef02e1b18..f30155b63 100644--- a/crates/xfdf/README.md+++ b/crates/xfdf/README.md@@ -1,4 +1,4 @@-# printcraft-xfdf+# pdfcraft-xfdfLayer L4: comment and form data exchange (execution plan M5.6, M6.7).@@ -9,7 +9,7 @@ let txt = export_data(&doc, Format::Txt); // or Xml, Csvlet report = import(&mut doc, &bytes)?; // XFDF, FDF, XML, CSV or text, detected```-- **XFDF** (ISO 19444-1): every comment type PrintCraft knows (text, free text, line, square,+- **XFDF** (ISO 19444-1): every comment type PdfCraft knows (text, free text, line, square,circle, polygon, polyline, markup, stamp, caret, ink, attachments, sound, redact) with rect,name, author, subject, dates, flags, colours, opacity, width, icon, quads, line ends, ink,default appearance, pop-ups and reply threads (`inreplyto`); field values nested by name.@@ -17,6 +17,6 @@ let report = import(&mut doc, &bytes)?; // XFDF, FDF, XML, CSV o- **Form data**: Acrobat's XML (`xfdf:original` keeps names that aren't XML names), CSV andtab-delimited text (a row of names, a row of values).-Import replaces comments with the same `/NM`, draws appearances PrintCraft can draw, and sets+Import replaces comments with the same `/NM`, draws appearances PdfCraft can draw, and setsvalues through the form's own checks (formats, validation, recalculation); read-only fields takeimported values, as in Acrobat. XML is read with `roxmltree`.diff --git a/crates/xfdf/src/lib.rs b/crates/xfdf/src/lib.rsindex 2e6336ce3..c41f8da22 100644--- a/crates/xfdf/src/lib.rs+++ b/crates/xfdf/src/lib.rs@@ -14,8 +14,8 @@use std::collections::HashMap;use std::fmt::Write as _;-use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};-use printcraft_forms::{FieldKind, FieldValue};+use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString};+use pdfcraft_forms::{FieldKind, FieldValue};#[cfg(test)]mod tests;@@ -29,7 +29,7 @@ pub enum DataError {#[error("nothing in the file matches this document")]NothingImported,#[error(transparent)]- Cos(#[from] printcraft_cos::CosError),+ Cos(#[from] pdfcraft_cos::CosError),}/// What export writes.@@ -168,7 +168,7 @@ fn arr(v: &[f64]) -> Object {/// Every comment as an XFDF element (one line per comment, replies included).fn xfdf_annots(doc: &Document, out: &mut String) {- let pages = printcraft_model::pages(doc);+ let pages = pdfcraft_model::pages(doc);// NM of every annotation, for inreplyto.let mut names: HashMap<ObjRef, String> = HashMap::new();for p in &pages {@@ -291,7 +291,7 @@ fn xfdf_fields(doc: &Document, out: &mut String) {kids: Vec<(String, Node)>,}let mut root = Node::default();- for f in printcraft_forms::fields(doc) {+ for f in pdfcraft_forms::fields(doc) {if matches!(f.kind, FieldKind::PushButton | FieldKind::Signature) {continue;}@@ -346,7 +346,7 @@ pub fn export_xfdf(doc: &Document, comments: bool, fields: bool, file: &str) ->fn pdf_string(s: &str) -> Vec<u8> {let mut v = Vec::new();- printcraft_cos::serialize(&Object::String(PdfString::text(s)), &mut v);+ pdfcraft_cos::serialize(&Object::String(PdfString::text(s)), &mut v);v}@@ -355,7 +355,7 @@ pub fn export_fdf(doc: &Document, comments: bool, fields: bool, file: &str) -> Vlet mut body: Vec<u8> = b"<< /FDF << ".to_vec();if fields {body.extend_from_slice(b"/Fields [");- for f in printcraft_forms::fields(doc) {+ for f in pdfcraft_forms::fields(doc) {if matches!(f.kind, FieldKind::PushButton | FieldKind::Signature) {continue;}@@ -365,10 +365,10 @@ pub fn export_fdf(doc: &Document, comments: bool, fields: bool, file: &str) -> Vmatch f.kind {FieldKind::CheckBox | FieldKind::Radio => {let v = f.value.first().cloned().unwrap_or_else(|| "Off".into());- printcraft_cos::serialize(&Object::Name(v.into_bytes()), &mut body);+ pdfcraft_cos::serialize(&Object::Name(v.into_bytes()), &mut body);}FieldKind::List if f.value.len() > 1 => {- printcraft_cos::serialize(&Object::Array(f.value.iter().map(|v| Object::String(PdfString::text(v))).collect()), &mut body);+ pdfcraft_cos::serialize(&Object::Array(f.value.iter().map(|v| Object::String(PdfString::text(v))).collect()), &mut body);}_ => body.extend(pdf_string(f.value.first().map(String::as_str).unwrap_or(""))),}@@ -378,7 +378,7 @@ pub fn export_fdf(doc: &Document, comments: bool, fields: bool, file: &str) -> V}if comments {body.extend_from_slice(b"/Annots [");- for (pi, p) in printcraft_model::pages(doc).iter().enumerate() {+ for (pi, p) in pdfcraft_model::pages(doc).iter().enumerate() {for a in p.dict.get(b"Annots").map(|a| doc.resolve(a)).and_then(|a| a.as_array().cloned()).unwrap_or_default() {let Some(mut d) = doc.resolve(&a).as_dict().cloned() else { continue };let Some(sub) = d.name(b"Subtype") else { continue };@@ -400,7 +400,7 @@ pub fn export_fdf(doc: &Document, comments: bool, fields: bool, file: &str) -> V}}d.set(b"Page".to_vec(), Object::Int(pi as i64));- printcraft_cos::serialize(&Object::Dict(d), &mut body);+ pdfcraft_cos::serialize(&Object::Dict(d), &mut body);body.push(b' ');}}@@ -426,7 +426,7 @@ fn xml_name(name: &str) -> String {/// Form data as XML, CSV or tab-delimited text (Acrobat's Export data formats).pub fn export_data(doc: &Document, format: Format) -> String {- let fields: Vec<(String, String)> = printcraft_forms::fields(doc)+ let fields: Vec<(String, String)> = pdfcraft_forms::fields(doc).into_iter().filter(|f| !matches!(f.kind, FieldKind::PushButton | FieldKind::Signature)).map(|f| {@@ -471,7 +471,7 @@ pub fn export_data(doc: &Document, format: Format) -> String {/// Set the values of fields named in `values` (full names), counting what took.fn apply_values(doc: &mut Document, values: &[(String, Vec<String>)], report: &mut Report) {- let all = printcraft_forms::fields(doc);+ let all = pdfcraft_forms::fields(doc);for (name, vals) in values {let Some(f) = all.iter().find(|f| &f.name == name) else { continue };let first = vals.first().cloned().unwrap_or_default();@@ -481,7 +481,7 @@ fn apply_values(doc: &mut Document, values: &[(String, Vec<String>)], report: &mFieldKind::Radio => FieldValue::Radio((!first.is_empty() && first != "Off").then_some(first)),// XML, CSV and text hold a multi-select list's values in one cell, joined by ", "// (as export_data writes them); split it unless the whole cell is one option.- FieldKind::List if f.has(printcraft_forms::flags::MULTI_SELECT) && vals.len() == 1 && !f.options.iter().any(|(e, _)| *e == first) => {+ FieldKind::List if f.has(pdfcraft_forms::flags::MULTI_SELECT) && vals.len() == 1 && !f.options.iter().any(|(e, _)| *e == first) => {FieldValue::Choice(first.split(", ").filter(|v| !v.is_empty()).map(str::to_string).collect())}FieldKind::Combo | FieldKind::List => FieldValue::Choice(vals.iter().filter(|v| !v.is_empty()).cloned().collect()),@@ -490,9 +490,9 @@ fn apply_values(doc: &mut Document, values: &[(String, Vec<String>)], report: &m// Read-only fields still take imported data, as in Acrobat.let ro = f.read_only();if ro {- let _ = doc.update_dict(f.obj, |d| d.set(b"Ff".to_vec(), Object::Int((f.flags & !printcraft_forms::flags::READ_ONLY) as i64)));+ let _ = doc.update_dict(f.obj, |d| d.set(b"Ff".to_vec(), Object::Int((f.flags & !pdfcraft_forms::flags::READ_ONLY) as i64)));}- match printcraft_forms::set_value(doc, name, &v) {+ match pdfcraft_forms::set_value(doc, name, &v) {Ok(()) => report.fields += 1,Err(_) => report.rejected.push(name.clone()),}@@ -612,7 +612,7 @@ fn place(doc: &mut Document, page_ref: ObjRef, d: Dict) -> Result<ObjRef, DataEr}let r = doc.add(Object::Dict(d));// Our own appearance where we can draw one; others keep none (viewers draw a default).- let _ = printcraft_annot::set_appearance(doc, r);+ let _ = pdfcraft_annot::set_appearance(doc, r);kept.push(Object::Ref(r));doc.update_dict(page_ref, |p| p.set(b"Annots".to_vec(), Object::Array(kept)))?;Ok(r)@@ -625,7 +625,7 @@ fn import_xfdf(doc: &mut Document, text: &str) -> Result<Report, DataError> {return Err(DataError::UnknownFormat);}let mut report = Report::default();- let pages: Vec<ObjRef> = printcraft_model::pages(doc).iter().map(|p| p.obj).collect();+ let pages: Vec<ObjRef> = pdfcraft_model::pages(doc).iter().map(|p| p.obj).collect();// Comments: parents first, then replies (whose /IRT needs the parent's reference).let mut by_name: HashMap<String, ObjRef> = HashMap::new();let mut later: Vec<(ObjRef, String)> = Vec::new();@@ -678,7 +678,7 @@ fn import_xfdf(doc: &mut Document, text: &str) -> Result<Report, DataError> {}fn find_by_name(doc: &Document, nm: &str) -> Option<ObjRef> {- for p in printcraft_model::pages(doc) {+ for p in pdfcraft_model::pages(doc) {for a in p.dict.get(b"Annots").map(|a| doc.resolve(a)).and_then(|a| a.as_array().cloned()).unwrap_or_default() {if let Some(r) = a.as_ref()&& doc.get(r).as_dict().and_then(|d| text_of(doc, d, b"NM")).as_deref() == Some(nm)@@ -762,7 +762,7 @@ pub fn data_values(bytes: &[u8]) -> Result<Vec<(String, Vec<String>)>, DataError}if bytes.starts_with(b"%PDF") || bytes.windows(5).take(1024).any(|w| w == b"%PDF-") {let doc = Document::open(std::sync::Arc::new(bytes.to_vec())).map_err(|e| DataError::Malformed(e.to_string()))?;- return Ok(printcraft_forms::fields(&doc)+ return Ok(pdfcraft_forms::fields(&doc).into_iter().filter(|f| !matches!(f.kind, FieldKind::PushButton | FieldKind::Signature)).map(|f| {@@ -818,7 +818,7 @@ fn import_fdf(doc: &mut Document, bytes: &[u8]) -> Result<Report, DataError> {walk_fdf(&fdf, &list, "", &mut values, 0);}// Comments.- let pages: Vec<ObjRef> = printcraft_model::pages(doc).iter().map(|p| p.obj).collect();+ let pages: Vec<ObjRef> = pdfcraft_model::pages(doc).iter().map(|p| p.obj).collect();for a in body.get(b"Annots").map(|a| fdf.resolve(a)).and_then(|a| a.as_array().cloned()).unwrap_or_default() {let Object::Dict(mut d) = deep(&fdf, &a, 0) else { continue };let Some(page) = d.get(b"Page").and_then(Object::as_int).and_then(|p| usize::try_from(p).ok()).and_then(|p| pages.get(p).copied()) else {diff --git a/crates/xfdf/src/tests.rs b/crates/xfdf/src/tests.rsindex f3af5cc62..07d079a5a 100644--- a/crates/xfdf/src/tests.rs+++ b/crates/xfdf/src/tests.rs@@ -1,8 +1,8 @@use std::sync::Arc;-use printcraft_annot::{Markup, Meta, NewAnnotation, Shape, Style, add_annotation, add_reply, summaries};-use printcraft_cos::{SaveOptions, write_full};-use printcraft_forms::{NewField, add_field, fields, set_value};+use pdfcraft_annot::{Markup, Meta, NewAnnotation, Shape, Style, add_annotation, add_reply, summaries};+use pdfcraft_cos::{SaveOptions, write_full};+use pdfcraft_forms::{NewField, add_field, fields, set_value};use super::*;@@ -40,7 +40,7 @@ fn blank() -> Document {fn filled() -> Document {let mut doc = blank();let meta = |id: &str| Meta { date: Some("D:20261002120000Z".into()), id: id.into() };- let note = Shape::Note { at: [100.0, 500.0], icon: printcraft_annot::NoteIcon::Comment };+ let note = Shape::Note { at: [100.0, 500.0], icon: pdfcraft_annot::NoteIcon::Comment };add_annotation(&mut doc,&NewAnnotation {@@ -194,7 +194,7 @@ fn data_files_merge_into_a_spreadsheet() {let fdf = export_fdf(&src, false, true, "form.pdf");let mut other = blank();set_value(&mut other, "Name", &FieldValue::Text("Grace \"Amazing\" Hopper, RADM".into())).unwrap();- let pdf = printcraft_cos::write_full(&other, &Default::default()).unwrap();+ let pdf = pdfcraft_cos::write_full(&other, &Default::default()).unwrap();let rows: Vec<_> = [xfdf.as_bytes(), &fdf[..], &pdf[..]].iter().map(|b| data_values(b).unwrap()).collect();assert_eq!(rows[0], rows[1], "XFDF and FDF carry the same values");let csv = merge_csv(&rows);diff --git a/deny.toml b/deny.tomlindex 61a8ec57d..0c2dedceb 100644--- a/deny.toml+++ b/deny.toml@@ -36,7 +36,7 @@ unknown-git = "deny"[advisories]yanked = "warn"ignore = [- # Marvin (RSA private-key timing side channel, no fixed `rsa` release). printcraft-sign uses+ # Marvin (RSA private-key timing side channel, no fixed `rsa` release). pdfcraft-sign uses# `rsa` only for public-key signature verification, which the advisory does not affect; RSA# private-key operations use aws-lc-rs on native targets and are refused in the browser# (ADR-0009). Revisit when a fixed `rsa` ships.diff --git a/docs/brand/LICENSE-brand.txt b/docs/brand/LICENSE-brand.txtindex b6faf37d7..1d2c4ef73 100644--- a/docs/brand/LICENSE-brand.txt+++ b/docs/brand/LICENSE-brand.txt@@ -2,7 +2,7 @@ ArtCraft brand assets: licenseThe ArtCraft name, wordmark and mark (the "ArtCraft Marks"), including every file in thisdirectory in every color, size and format, are owned by the ArtCraft Team. They are trademarks-and are NOT open source. They are not covered by PrintCraft's MIT OR Apache-2.0 license, and nothing in+and are NOT open source. They are not covered by PdfCraft's MIT OR Apache-2.0 license, and nothing inthat license, in NOTICE or in any other file of this repository grants any right to them.Permission@@ -11,7 +11,7 @@ The ArtCraft Team grants a limited, non-exclusive, non-transferable, revocable,permission to use the ArtCraft Marks only:1. as part of copies of this repository; and- 2. within PrintCraft itself, its documentation and its official builds, to identify PrintCraft as made+ 2. within PdfCraft itself, its documentation and its official builds, to identify PdfCraft as madeby the ArtCraft team and community and to link to getartcraft.com and its community.Conditions@@ -21,17 +21,17 @@ The permission holds only while every one of these is true:- The marks are used exactly as supplied in this directory. Do not redraw, recolor, crop,stretch, rotate, animate, outline or add effects to them, extract parts of them, or combinethem with any other name, mark or artwork.- - They are used only in the context of PrintCraft, and only to say that the ArtCraft team makes it.+ - They are used only in the context of PdfCraft, and only to say that the ArtCraft team makes it.They must never suggest that the ArtCraft Team made, sponsors, endorses, certifies or supportsany other product, service, fork, modified version, plug-in, organization or person.- Neither the marks nor the ArtCraft name appear in the name, logo, icon, domain, social media- handle, app-store listing, advertising or marketing of anything other than PrintCraft.+ handle, app-store listing, advertising or marketing of anything other than PdfCraft.Forks and modified versions-If you distribute or publish a modified version of PrintCraft, or any work derived from it, you must+If you distribute or publish a modified version of PdfCraft, or any work derived from it, you mustremove the ArtCraft Marks from it (or replace them with your own) and must not call it ArtCraft or-present it as an ArtCraft product. You may say, in plain text, that your work is based on PrintCraft by+present it as an ArtCraft product. You may say, in plain text, that your work is based on PdfCraft bythe ArtCraft team. A fork kept only to propose changes back to this repository may keep the marksunchanged.diff --git a/docs/images/printcraft-bookmarks.png b/docs/images/pdfcraft-bookmarks.pngsimilarity index 100%rename from docs/images/printcraft-bookmarks.pngrename to docs/images/pdfcraft-bookmarks.pngdiff --git a/docs/images/printcraft-dark.png b/docs/images/pdfcraft-dark.pngsimilarity index 100%rename from docs/images/printcraft-dark.pngrename to docs/images/pdfcraft-dark.pngdiff --git a/docs/images/printcraft-find.png b/docs/images/pdfcraft-find.pngsimilarity index 100%rename from docs/images/printcraft-find.pngrename to docs/images/pdfcraft-find.pngdiff --git a/docs/images/printcraft-forms.png b/docs/images/pdfcraft-forms.pngsimilarity index 100%rename from docs/images/printcraft-forms.pngrename to docs/images/pdfcraft-forms.pngdiff --git a/docs/images/printcraft-layers.png b/docs/images/pdfcraft-layers.pngsimilarity index 100%rename from docs/images/printcraft-layers.pngrename to docs/images/pdfcraft-layers.pngdiff --git a/docs/images/printcraft-organize.png b/docs/images/pdfcraft-organize.pngsimilarity index 100%rename from docs/images/printcraft-organize.pngrename to docs/images/pdfcraft-organize.pngdiff --git a/docs/images/printcraft-palette.png b/docs/images/pdfcraft-palette.pngsimilarity index 100%rename from docs/images/printcraft-palette.pngrename to docs/images/pdfcraft-palette.pngdiff --git a/docs/images/printcraft-properties.png b/docs/images/pdfcraft-properties.pngsimilarity index 100%rename from docs/images/printcraft-properties.pngrename to docs/images/pdfcraft-properties.pngdiff --git a/docs/images/printcraft-scripts.png b/docs/images/pdfcraft-scripts.pngsimilarity index 100%rename from docs/images/printcraft-scripts.pngrename to docs/images/pdfcraft-scripts.pngdiff --git a/docs/images/printcraft-split.png b/docs/images/pdfcraft-split.pngsimilarity index 100%rename from docs/images/printcraft-split.pngrename to docs/images/pdfcraft-split.pngdiff --git a/docs/images/printcraft-tools.png b/docs/images/pdfcraft-tools.pngsimilarity index 100%rename from docs/images/printcraft-tools.pngrename to docs/images/pdfcraft-tools.pngdiff --git a/docs/images/printcraft-twoup.png b/docs/images/pdfcraft-twoup.pngsimilarity index 100%rename from docs/images/printcraft-twoup.pngrename to docs/images/pdfcraft-twoup.pngdiff --git a/docs/images/printcraft-viewer.png b/docs/images/pdfcraft-viewer.pngsimilarity index 100%rename from docs/images/printcraft-viewer.pngrename to docs/images/pdfcraft-viewer.pngdiff --git a/docs/releasing.md b/docs/releasing.mdindex 4bb74c82f..7277047eb 100644--- a/docs/releasing.md+++ b/docs/releasing.md@@ -1,12 +1,12 @@-# Releasing PrintCraft+# Releasing PdfCraftEvery push to the `release` branch runs `.github/workflows/release.yml`. It builds installers formacOS, Windows, Linux, FreeBSD and the web, signs the ones it has certificates for, and creates or-updates a **draft** GitHub Release named `PrintCraft v<version>`. Nobody sees a draft until a+updates a **draft** GitHub Release named `PdfCraft v<version>`. Nobody sees a draft until amaintainer publishes it.-The pipeline was ported from PhotoCraft's. User-facing names say **PrintCraft**; files, binaries and-ids stay lowercase (`printcraft-<version>-<platform>-<arch>.<ext>`, `ai.storyteller.printcraft`).+The pipeline was ported from PhotoCraft's. User-facing names say **PdfCraft**; files, binaries and+ids stay lowercase (`pdfcraft-<version>-<platform>-<arch>.<ext>`, `ai.storyteller.pdfcraft`).## Cutting a release@@ -18,10 +18,10 @@ ids stay lowercase (`printcraft-<version>-<platform>-<arch>.<ext>`, `ai.storytelcargo xtask version set 0.3.0 # or 0.3.0-rc.1; updates Cargo.toml and Cargo.lock```- Commit the change through the normal review flow (see the `Release: PrintCraft v0.2.1` PR).+ Commit the change through the normal review flow (see the `Release: PdfCraft v0.2.1` PR).2. **Merge `main` into `release`** (or fast-forward it) and push. The workflow starts by itself.3. **Wait for the draft.** When every job has finished (notarization is the slow part), the- Releases page has a draft `PrintCraft v0.3.0` targeting the pushed commit, with every artifact+ Releases page has a draft `PdfCraft v0.3.0` targeting the pushed commit, with every artifactand `SHA256SUMS.txt`. The notes are generated from the merged PRs.4. **Check it.** Download an installer or two and read the job summaries. A `::warning::` theremeans a signing secret was missing and that artifact is unsigned.@@ -40,21 +40,21 @@ with `cargo xtask version set` before building, so the binaries report it too. T| Platform | Artifacts | Built on ||---|---|---|-| macOS 11+ (universal: Apple silicon + Intel) | `printcraft-<v>-macos-universal.dmg`, `printcraft-cli-<v>-macos-universal.zip` | `macos-15` |-| Windows 10+ x64 | `printcraft-<v>-windows-x64.msi`, `printcraft-<v>-windows-x64-portable.zip` | `windows-latest` |-| Windows 10+ x86 (32-bit) | `printcraft-<v>-windows-x86.msi`, `printcraft-<v>-windows-x86-portable.zip` | `windows-latest` |-| Windows 11 on ARM64 | `printcraft-<v>-windows-arm64.msi`, `printcraft-<v>-windows-arm64-portable.zip` | `windows-latest` (cross-compiled) |-| Linux x86_64 | `printcraft-<v>-linux-x86_64.{AppImage,deb,rpm,tar.gz}` | `ubuntu-22.04` |-| Linux aarch64 | `printcraft-<v>-linux-aarch64.{AppImage,deb,rpm,tar.gz}` | `ubuntu-22.04-arm` |-| FreeBSD 14 x86_64 | `printcraft-<v>-freebsd-x86_64.tar.gz` | FreeBSD VM on `ubuntu-latest` |-| Web | `printcraft-web-<v>.zip` (a static site; see [`packaging/web/README.md`](../packaging/web/README.md)) | `ubuntu-latest` |+| macOS 11+ (universal: Apple silicon + Intel) | `pdfcraft-<v>-macos-universal.dmg`, `pdfcraft-cli-<v>-macos-universal.zip` | `macos-15` |+| Windows 10+ x64 | `pdfcraft-<v>-windows-x64.msi`, `pdfcraft-<v>-windows-x64-portable.zip` | `windows-latest` |+| Windows 10+ x86 (32-bit) | `pdfcraft-<v>-windows-x86.msi`, `pdfcraft-<v>-windows-x86-portable.zip` | `windows-latest` |+| Windows 11 on ARM64 | `pdfcraft-<v>-windows-arm64.msi`, `pdfcraft-<v>-windows-arm64-portable.zip` | `windows-latest` (cross-compiled) |+| Linux x86_64 | `pdfcraft-<v>-linux-x86_64.{AppImage,deb,rpm,tar.gz}` | `ubuntu-22.04` |+| Linux aarch64 | `pdfcraft-<v>-linux-aarch64.{AppImage,deb,rpm,tar.gz}` | `ubuntu-22.04-arm` |+| FreeBSD 14 x86_64 | `pdfcraft-<v>-freebsd-x86_64.tar.gz` | FreeBSD VM on `ubuntu-latest` |+| Web | `pdfcraft-web-<v>.zip` (a static site; see [`packaging/web/README.md`](../packaging/web/README.md)) | `ubuntu-latest` |The ARM64 Windows build is cross-compiled on the x64 runner, so signing and WiX work as for theother Windows builds; `.github/workflows/windows-arm64.yml` installs and runs it on ARM64 hardware.-Every binary reports its version (`printcraft --version`, `printcraft-cli --version`, *Help ▸ About*).-The workflow sets `PRINTCRAFT_BUILD_SHA` and `PRINTCRAFT_BUILD_DATE` (`packaging/env.sh` fills them in-for local builds): the commit is recorded in the macOS `Info.plist` (`PrintCraftBuildCommit`) and the+Every binary reports its version (`pdfcraft --version`, `pdfcraft-cli --version`, *Help ▸ About*).+The workflow sets `PDFCRAFT_BUILD_SHA` and `PDFCRAFT_BUILD_DATE` (`packaging/env.sh` fills them in+for local builds): the commit is recorded in the macOS `Info.plist` (`PdfCraftBuildCommit`) and thedate in the AppStream metadata. The binaries don't embed the commit yet.**Fonts:** every job checks out [craft-fonts](https://github.com/storytold/craft-fonts) at the commit@@ -65,10 +65,10 @@ deliberately.### macOS`packaging/macos/package.sh` builds both architectures, joins them with `lipo`, and assembles-`PrintCraft.app` from `Info.plist.in` (bundle id `ai.storyteller.printcraft`, macOS 11+, PDF declared-as a document type with rank Alternate, so PrintCraft is offered under Open With without taking over+`PdfCraft.app` from `Info.plist.in` (bundle id `ai.storyteller.pdfcraft`, macOS 11+, PDF declared+as a document type with rank Alternate, so PdfCraft is offered under Open With without taking overfrom Preview). Files opened from Finder arrive as Apple events, which-`apps/printcraft/src/apple_events.rs` receives.+`apps/pdfcraft/src/apple_events.rs` receives.- **Signing** uses the hardened runtime and a secure timestamp, executable first, then the bundle.`packaging/macos/import-cert.sh` puts the certificate in a temporary keychain, deleted at the end@@ -76,7 +76,7 @@ from Preview). Files opened from Finder arrive as Apple events, which- **Notarization:** the app is zipped and sent with `xcrun notarytool submit --wait`, the ticket isstapled, and the result is checked with `codesign --verify`, `stapler validate` and `spctl`. Theapp ships on a drag-to-Applications DMG, which is signed and notarized too.-- **CLI:** `printcraft-cli` is signed and notarized as a zip. A bare executable can't hold a stapled+- **CLI:** `pdfcraft-cli` is signed and notarized as a zip. A bare executable can't hold a stapledticket, so Gatekeeper looks it up online the first time a downloaded copy runs.Without certificates (locally) the script signs ad-hoc and skips notarization:@@ -91,9 +91,9 @@ packaging/macos/package.sh --arch aarch64 # quicker, host-only; --arch univeneither the MSI nor the portable zip needs the Visual C++ redistributable.- Before packaging, it reads both executables' PE headers: the machine type must match `-Arch`, and- `printcraft.exe` must be a GUI-subsystem program (no console window, #57) while `printcraft-cli.exe`+ `pdfcraft.exe` must be a GUI-subsystem program (no console window, #57) while `pdfcraft-cli.exe`stays a console program.-- `printcraft.wxs` (WiX v5) installs per machine into Program Files with a Start Menu shortcut and an+- `pdfcraft.wxs` (WiX v5) installs per machine into Program Files with a Start Menu shortcut and anApp Paths entry. The MSI version is the numeric `X.Y.Z` (MSI has no pre-release field), andsame-version upgrades are allowed so release candidates replace each other. Icon ids end in `.ico`or `.exe` (Windows Installer requires it); packaging-lint checks this.@@ -128,7 +128,7 @@ binaries; check the tarball against `SHA256SUMS.txt`.### Web-`packaging/web/package.sh` runs `trunk build --release` in `apps/printcraft-web` and zips the site+`packaging/web/package.sh` runs `trunk build --release` in `apps/pdfcraft-web` and zips the sitewith sample `_headers` and `.htaccess` files. Hosting (MIME types, compression, caching, iframes) iscovered in [`packaging/web/README.md`](../packaging/web/README.md).diff --git a/packaging/env.sh b/packaging/env.shindex 75b8b73f6..d4023a1ab 100644--- a/packaging/env.sh+++ b/packaging/env.sh@@ -3,10 +3,10 @@## Exports:# ROOT workspace root-# VERSION [workspace.package] version from Cargo.toml (override: PRINTCRAFT_VERSION)+# VERSION [workspace.package] version from Cargo.toml (override: PDFCRAFT_VERSION)# DIST output directory for release artifacts (default: $ROOT/dist/release)-# PRINTCRAFT_BUILD_SHA git commit, recorded in the macOS Info.plist (PrintCraftBuildCommit)-# PRINTCRAFT_BUILD_DATE UTC build date, YYYY-MM-DD+# PDFCRAFT_BUILD_SHA git commit, recorded in the macOS Info.plist (PdfCraftBuildCommit)+# PDFCRAFT_BUILD_DATE UTC build date, YYYY-MM-DD# CARGO_TARGET_DIR cargo's target dir (default: $ROOT/target)ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"@@ -21,7 +21,7 @@ workspace_version() {' "$ROOT/Cargo.toml"}-VERSION="${PRINTCRAFT_VERSION:-$(workspace_version)}"+VERSION="${PDFCRAFT_VERSION:-$(workspace_version)}"if [ -z "$VERSION" ]; thenecho "error: could not read [workspace.package] version from $ROOT/Cargo.toml" >&2exit 1@@ -32,11 +32,11 @@ DIST="${DIST:-$ROOT/dist/release}"mkdir -p "$DIST"export DIST-if [ -z "${PRINTCRAFT_BUILD_SHA:-}" ]; then- PRINTCRAFT_BUILD_SHA="$(git -C "$ROOT" rev-parse HEAD 2>/dev/null || true)"+if [ -z "${PDFCRAFT_BUILD_SHA:-}" ]; then+ PDFCRAFT_BUILD_SHA="$(git -C "$ROOT" rev-parse HEAD 2>/dev/null || true)"fi-export PRINTCRAFT_BUILD_SHA-export PRINTCRAFT_BUILD_DATE="${PRINTCRAFT_BUILD_DATE:-$(date -u +%Y-%m-%d)}"+export PDFCRAFT_BUILD_SHA+export PDFCRAFT_BUILD_DATE="${PDFCRAFT_BUILD_DATE:-$(date -u +%Y-%m-%d)}"export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT/target}"# Emit a GitHub Actions warning (plain stderr outside Actions).diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.shindex 3d24d4220..cb357b8ba 100755--- a/packaging/freebsd/package.sh+++ b/packaging/freebsd/package.sh@@ -1,8 +1,8 @@#!/usr/bin/env bash-# Build PrintCraft for FreeBSD and package it:-# $DIST/printcraft-<version>-freebsd-<arch>.tar.gz a /usr/local-style tree (bin/, share/)+# Build PdfCraft for FreeBSD and package it:+# $DIST/pdfcraft-<version>-freebsd-<arch>.tar.gz a /usr/local-style tree (bin/, share/)#-# Extract it into /usr/local (or anywhere, and run bin/printcraft from there). The desktop entry,+# Extract it into /usr/local (or anywhere, and run bin/pdfcraft from there). The desktop entry,# MIME type, AppStream metadata and icons are the freedesktop ones Linux uses.## Usage: packaging/freebsd/package.sh [--skip-build]@@ -11,7 +11,7 @@ set -euo pipefail# shellcheck source=../env.sh. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"LINUX="$ROOT/packaging/linux"-APP_ID=ai.storyteller.printcraft+APP_ID=ai.storyteller.pdfcraftSKIP_BUILD=0while [ $# -gt 0 ]; do@@ -28,12 +28,12 @@ case "$ARCH" inarm64 | aarch64) ARCH=aarch64 ;;*) echo "unsupported architecture $ARCH" >&2; exit 2 ;;esac-BASENAME="printcraft-$VERSION-freebsd-$ARCH"+BASENAME="pdfcraft-$VERSION-freebsd-$ARCH"-echo "==> PrintCraft $VERSION for FreeBSD $ARCH"+echo "==> PdfCraft $VERSION for FreeBSD $ARCH"if [ "$SKIP_BUILD" = 0 ]; then- (cd "$ROOT" && cargo build --release --locked -p printcraft -p printcraft-cli)+ (cd "$ROOT" && cargo build --release --locked -p pdfcraft -p pdfcraft-cli)fiBIN="$CARGO_TARGET_DIR/release"WORK="$CARGO_TARGET_DIR/freebsd-package"@@ -42,17 +42,17 @@ rm -rf "$WORK"# FreeBSD's install(1) has no -D: create the directories first.mkdir -p "$STAGE/bin" "$STAGE/share/applications" "$STAGE/share/mime/packages" "$STAGE/share/metainfo" \- "$STAGE/share/icons" "$STAGE/share/doc/printcraft"-install -m 755 "$BIN/printcraft" "$BIN/printcraft-cli" "$STAGE/bin/"-strip "$STAGE/bin/printcraft" "$STAGE/bin/printcraft-cli" 2>/dev/null || true+ "$STAGE/share/icons" "$STAGE/share/doc/pdfcraft"+install -m 755 "$BIN/pdfcraft" "$BIN/pdfcraft-cli" "$STAGE/bin/"+strip "$STAGE/bin/pdfcraft" "$STAGE/bin/pdfcraft-cli" 2>/dev/null || trueinstall -m 644 "$LINUX/$APP_ID.desktop" "$STAGE/share/applications/$APP_ID.desktop"install -m 644 "$LINUX/$APP_ID.mime.xml" "$STAGE/share/mime/packages/$APP_ID.xml"-sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$PRINTCRAFT_BUILD_DATE/g" \+sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$PDFCRAFT_BUILD_DATE/g" \"$LINUX/$APP_ID.metainfo.xml.in" >"$STAGE/share/metainfo/$APP_ID.metainfo.xml"cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/share/icons/"-copy_docs "$STAGE/share/doc/printcraft"+copy_docs "$STAGE/share/doc/pdfcraft"-"$STAGE/bin/printcraft" --version+"$STAGE/bin/pdfcraft" --versionmkdir -p "$DIST"tar -C "$WORK" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME"echo "wrote $DIST/$BASENAME.tar.gz"diff --git a/packaging/icons.sh b/packaging/icons.shindex 8f16be0c5..e8b2c9960 100755--- a/packaging/icons.sh+++ b/packaging/icons.sh@@ -1,5 +1,5 @@#!/usr/bin/env bash-# Regenerate every app icon from assets/app-icon/printcraft.svg (the master vector).+# Regenerate every app icon from assets/app-icon/pdfcraft.svg (the master vector).## Needs: resvg (brew install resvg / cargo install resvg) and python3 (stdlib only, for the .ico).# On macOS, iconutil also writes the .icns. The outputs are committed, so building and packaging@@ -10,8 +10,8 @@set -euo pipefailROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"DIR="$ROOT/assets/app-icon"-SVG="$DIR/printcraft.svg"-ID="ai.storyteller.printcraft"+SVG="$DIR/pdfcraft.svg"+ID="ai.storyteller.pdfcraft"TMP="$(mktemp -d)"trap 'rm -rf "$TMP"' EXIT@@ -28,8 +28,8 @@ MAC="$TMP/macos.svg"render() { resvg -w "$2" -h "$2" "$1" "$3" </dev/null; }-# 1024 px PNG on Apple's grid (also the runtime Dock icon on macOS, see apps/printcraft/src/main.rs).-render "$MAC" 1024 "$DIR/printcraft-1024.png"+# 1024 px PNG on Apple's grid (also the runtime Dock icon on macOS, see apps/pdfcraft/src/main.rs).+render "$MAC" 1024 "$DIR/pdfcraft-1024.png"# Linux hicolor theme (full bleed; hicolor/256x256 is also the runtime icon on Windows and Linux).for s in 16 24 32 48 64 128 256 512; do@@ -45,7 +45,7 @@ for s in 16 20 24 32 40 48 64 128 256; dorender "$SVG" "$s" "$TMP/ico-$s.png"ICO_PNGS+=("$TMP/ico-$s.png")done-python3 - "$DIR/printcraft.ico" "${ICO_PNGS[@]}" <<'PY'+python3 - "$DIR/pdfcraft.ico" "${ICO_PNGS[@]}" <<'PY'import struct, sysout, pngs = sys.argv[1], sys.argv[2:]blobs = [open(p, "rb").read() for p in pngs]@@ -61,14 +61,14 @@ PY# macOS .icns.if command -v iconutil >/dev/null; then- SET="$TMP/printcraft.iconset"+ SET="$TMP/pdfcraft.iconset"mkdir -p "$SET"for s in 16 32 128 256 512; dorender "$MAC" "$s" "$SET/icon_${s}x${s}.png"render "$MAC" $((s * 2)) "$SET/icon_${s}x${s}@2x.png"done- iconutil -c icns -o "$DIR/printcraft.icns" "$SET"+ iconutil -c icns -o "$DIR/pdfcraft.icns" "$SET"else- echo "warning: iconutil not found (macOS only); printcraft.icns not regenerated" >&2+ echo "warning: iconutil not found (macOS only); pdfcraft.icns not regenerated" >&2fiecho "icons written to $DIR"diff --git a/packaging/linux/ai.storyteller.printcraft.desktop b/packaging/linux/ai.storyteller.pdfcraft.desktopsimilarity index 70%rename from packaging/linux/ai.storyteller.printcraft.desktoprename to packaging/linux/ai.storyteller.pdfcraft.desktopindex ec8244ca6..f32d625d7 100644--- a/packaging/linux/ai.storyteller.printcraft.desktop+++ b/packaging/linux/ai.storyteller.pdfcraft.desktop@@ -1,14 +1,14 @@[Desktop Entry]Type=Application-Name=PrintCraft+Name=PdfCraftGenericName=PDF EditorComment=Read, organize, combine, split and secure PDFs-Exec=printcraft %F-TryExec=printcraft-Icon=ai.storyteller.printcraft+Exec=pdfcraft %F+TryExec=pdfcraft+Icon=ai.storyteller.pdfcraftTerminal=falseStartupNotify=true-StartupWMClass=printcraft+StartupWMClass=pdfcraftCategories=Office;Viewer;Graphics;Keywords=pdf;viewer;editor;annotate;sign;forms;merge;split;MimeType=application/pdf;diff --git a/packaging/linux/ai.storyteller.printcraft.metainfo.xml.in b/packaging/linux/ai.storyteller.pdfcraft.metainfo.xml.insimilarity index 73%rename from packaging/linux/ai.storyteller.printcraft.metainfo.xml.inrename to packaging/linux/ai.storyteller.pdfcraft.metainfo.xml.inindex 256cf79b2..c8251ac63 100644--- a/packaging/linux/ai.storyteller.printcraft.metainfo.xml.in+++ b/packaging/linux/ai.storyteller.pdfcraft.metainfo.xml.in@@ -2,26 +2,26 @@<!-- AppStream metadata (software centres, Flathub). Template: package.sh and the Flatpakmanifest substitute @VERSION@ and @DATE@ from Cargo.toml and the build date. --><component type="desktop-application">- <id>ai.storyteller.printcraft</id>+ <id>ai.storyteller.pdfcraft</id><metadata_license>CC0-1.0</metadata_license><project_license>MIT OR Apache-2.0</project_license>- <name>PrintCraft</name>+ <name>PdfCraft</name><summary>Read, organize, combine, split and secure PDFs</summary><developer id="ai.storyteller"><name>Learning Machines LLC</name></developer><description><p>- PrintCraft is an open-source PDF workbench. Read, comment on, fill in and sign PDFs;+ PdfCraft is an open-source PDF workbench. Read, comment on, fill in and sign PDFs;organize, combine and split pages; edit, redact, protect and export documents.</p></description>- <launchable type="desktop-id">ai.storyteller.printcraft.desktop</launchable>- <icon type="stock">ai.storyteller.printcraft</icon>+ <launchable type="desktop-id">ai.storyteller.pdfcraft.desktop</launchable>+ <icon type="stock">ai.storyteller.pdfcraft</icon><!-- Only url types known to appstream 0.15 (Ubuntu 22.04, where CI validates): no vcs-browser. -->- <url type="homepage">https://getartcraft.com/apps/printcraft</url>- <url type="bugtracker">https://github.com/storytold/printcraft/issues</url>- <url type="help">https://github.com/storytold/printcraft</url>+ <url type="homepage">https://getartcraft.com/apps/pdfcraft</url>+ <url type="bugtracker">https://github.com/storytold/pdfcraft/issues</url>+ <url type="help">https://github.com/storytold/pdfcraft</url><url type="contact">https://discord.gg/artcraft</url><categories><category>Office</category>@@ -36,7 +36,7 @@<screenshots><screenshot type="default"><caption>A PDF open with its threaded comments</caption>- <image>https://raw.githubusercontent.com/storytold/printcraft/main/docs/images/printcraft-viewer.png</image>+ <image>https://raw.githubusercontent.com/storytold/pdfcraft/main/docs/images/pdfcraft-viewer.png</image></screenshot></screenshots><branding>@@ -52,7 +52,7 @@<control>tablet</control></supports><provides>- <binary>printcraft</binary>+ <binary>pdfcraft</binary><mediatype>application/pdf</mediatype></provides><content_rating type="oars-1.1"/>diff --git a/packaging/linux/ai.storyteller.printcraft.mime.xml b/packaging/linux/ai.storyteller.pdfcraft.mime.xmlsimilarity index 100%rename from packaging/linux/ai.storyteller.printcraft.mime.xmlrename to packaging/linux/ai.storyteller.pdfcraft.mime.xmldiff --git a/packaging/linux/flatpak/ai.storyteller.printcraft.yml b/packaging/linux/flatpak/ai.storyteller.pdfcraft.ymlsimilarity index 67%rename from packaging/linux/flatpak/ai.storyteller.printcraft.ymlrename to packaging/linux/flatpak/ai.storyteller.pdfcraft.ymlindex 49632f61c..c2ba3b8c2 100644--- a/packaging/linux/flatpak/ai.storyteller.printcraft.yml+++ b/packaging/linux/flatpak/ai.storyteller.pdfcraft.yml@@ -1,20 +1,20 @@-# Flatpak manifest for PrintCraft, ready for a Flathub submission.+# Flatpak manifest for PdfCraft, ready for a Flathub submission.## Flatpak builds run offline, so the crate sources must be vendored first. From the repo root:## curl -fsSLO https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py# python3 flatpak-cargo-generator.py Cargo.lock -o packaging/linux/flatpak/cargo-sources.json-# flatpak-builder --user --install --force-clean build-flatpak packaging/linux/flatpak/ai.storyteller.printcraft.yml-# flatpak run ai.storyteller.printcraft+# flatpak-builder --user --install --force-clean build-flatpak packaging/linux/flatpak/ai.storyteller.pdfcraft.yml+# flatpak run ai.storyteller.pdfcraft## For Flathub, replace the `dir` source with a `git` source pinned to a release tag and commit.-id: ai.storyteller.printcraft+id: ai.storyteller.pdfcraftruntime: org.freedesktop.Platformruntime-version: '25.08'sdk: org.freedesktop.Sdksdk-extensions:- org.freedesktop.Sdk.Extension.rust-stable-command: printcraft+command: pdfcraftfinish-args:- --share=ipc- --socket=wayland@@ -27,23 +27,23 @@ finish-args:build-options:append-path: /usr/lib/sdk/rust-stable/binmodules:- - name: printcraft+ - name: pdfcraftbuildsystem: simplebuild-options:env:- CARGO_HOME: /run/build/printcraft/cargo+ CARGO_HOME: /run/build/pdfcraft/cargoCARGO_NET_OFFLINE: 'true'build-commands:- - cargo --offline build --release --locked -p printcraft- - install -Dm755 target/release/printcraft /app/bin/printcraft- - install -Dm644 packaging/linux/ai.storyteller.printcraft.desktop /app/share/applications/ai.storyteller.printcraft.desktop- - install -Dm644 packaging/linux/ai.storyteller.printcraft.mime.xml /app/share/mime/packages/ai.storyteller.printcraft.xml+ - cargo --offline build --release --locked -p pdfcraft+ - install -Dm755 target/release/pdfcraft /app/bin/pdfcraft+ - install -Dm644 packaging/linux/ai.storyteller.pdfcraft.desktop /app/share/applications/ai.storyteller.pdfcraft.desktop+ - install -Dm644 packaging/linux/ai.storyteller.pdfcraft.mime.xml /app/share/mime/packages/ai.storyteller.pdfcraft.xml- mkdir -p /app/share/icons && cp -R assets/app-icon/hicolor /app/share/icons/- >-version=$(awk '/^\[/{p=($0=="[workspace.package]");next} p&&$1=="version"{gsub(/[" ]/,"",$3);print $3;exit}' Cargo.toml);install -d /app/share/metainfo;sed -e "s/@VERSION@/$version/" -e "s/@DATE@/$(date -u +%Y-%m-%d)/"- packaging/linux/ai.storyteller.printcraft.metainfo.xml.in > /app/share/metainfo/ai.storyteller.printcraft.metainfo.xml+ packaging/linux/ai.storyteller.pdfcraft.metainfo.xml.in > /app/share/metainfo/ai.storyteller.pdfcraft.metainfo.xmlsources:- type: dirpath: ../../..diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yamlindex 00a6457ac..5bf20703a 100644--- a/packaging/linux/nfpm.yaml+++ b/packaging/linux/nfpm.yaml@@ -3,7 +3,7 @@# exports VERSION and NFPM_ARCH.## nfpm package -f packaging/linux/nfpm.yaml -p deb -t dist/release/-name: printcraft+name: pdfcraftarch: ${NFPM_ARCH}platform: linuxversion: ${VERSION}@@ -12,14 +12,14 @@ version_schema: semverrelease: 1section: graphicspriority: optional-maintainer: ${PRINTCRAFT_MAINTAINER}+maintainer: ${PDFCRAFT_MAINTAINER}vendor: Learning Machines LLC-homepage: https://getartcraft.com/apps/printcraft+homepage: https://getartcraft.com/apps/pdfcraftlicense: MIT OR Apache-2.0description: |-Open-source, native PDF workbench: read, comment, fill and sign forms,organize, combine, split, edit, redact, protect and export PDFs.- Includes printcraft-cli, a headless command runner and opt-in MCP server.+ Includes pdfcraft-cli, a headless command runner and opt-in MCP server.# The binaries link only glibc and libgcc_s directly. Windowing (X11/Wayland, xkbcommon) and the# GPU (Vulkan, EGL/GL) are loaded at runtime, so they are dependencies/recommendations here@@ -54,11 +54,11 @@ overrides:- xdg-desktop-portalcontents:- - src: ${STAGE}/usr/bin/printcraft- dst: /usr/bin/printcraft+ - src: ${STAGE}/usr/bin/pdfcraft+ dst: /usr/bin/pdfcraftfile_info: { mode: 0755 }- - src: ${STAGE}/usr/bin/printcraft-cli- dst: /usr/bin/printcraft-cli+ - src: ${STAGE}/usr/bin/pdfcraft-cli+ dst: /usr/bin/pdfcraft-clifile_info: { mode: 0755 }- src: ${STAGE}/usr/share/dst: /usr/share/diff --git a/packaging/linux/package.sh b/packaging/linux/package.shindex 8f69f468d..4a57b4817 100755--- a/packaging/linux/package.sh+++ b/packaging/linux/package.sh@@ -1,10 +1,10 @@#!/usr/bin/env bash-# Build and package PrintCraft for Linux (<arch> is x86_64 or aarch64):+# Build and package PdfCraft for Linux (<arch> is x86_64 or aarch64):#-# $DIST/printcraft-<version>-linux-<arch>.AppImage any distro with glibc >= the build host's-# $DIST/printcraft-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...-# $DIST/printcraft-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...-# $DIST/printcraft-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)+# $DIST/pdfcraft-<version>-linux-<arch>.AppImage any distro with glibc >= the build host's+# $DIST/pdfcraft-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...+# $DIST/pdfcraft-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...+# $DIST/pdfcraft-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)## Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"]#@@ -15,7 +15,7 @@ set -euo pipefail# shellcheck source=../env.sh. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"HERE="$ROOT/packaging/linux"-APP_ID=ai.storyteller.printcraft+APP_ID=ai.storyteller.pdfcraftSKIP_BUILD=0FORMATS="appimage deb rpm tar"@@ -34,13 +34,13 @@ case "$ARCH" inaarch64 | arm64) ARCH=aarch64; DEB_ARCH=arm64 ;;*) echo "unsupported architecture $ARCH" >&2; exit 2 ;;esac-export PRINTCRAFT_MAINTAINER="${PRINTCRAFT_MAINTAINER:-PrintCraft maintainers <[email protected]>}"-BASENAME="printcraft-$VERSION-linux-$ARCH"+export PDFCRAFT_MAINTAINER="${PDFCRAFT_MAINTAINER:-PdfCraft maintainers <[email protected]>}"+BASENAME="pdfcraft-$VERSION-linux-$ARCH"-echo "==> PrintCraft $VERSION for Linux $ARCH ($FORMATS)"+echo "==> PdfCraft $VERSION for Linux $ARCH ($FORMATS)"if [ "$SKIP_BUILD" = 0 ]; then- (cd "$ROOT" && cargo build --release --locked -p printcraft -p printcraft-cli)+ (cd "$ROOT" && cargo build --release --locked -p pdfcraft -p pdfcraft-cli)fiBIN="$CARGO_TARGET_DIR/release"WORK="$CARGO_TARGET_DIR/linux-package"@@ -48,18 +48,18 @@ STAGE="$WORK/root"rm -rf "$WORK"# ---- stage an FHS tree (shared by every format) --------------------------------------------------install -Dm755 "$BIN/printcraft" "$STAGE/usr/bin/printcraft"-install -Dm755 "$BIN/printcraft-cli" "$STAGE/usr/bin/printcraft-cli"-strip "$STAGE/usr/bin/printcraft" "$STAGE/usr/bin/printcraft-cli" 2>/dev/null || true+install -Dm755 "$BIN/pdfcraft" "$STAGE/usr/bin/pdfcraft"+install -Dm755 "$BIN/pdfcraft-cli" "$STAGE/usr/bin/pdfcraft-cli"+strip "$STAGE/usr/bin/pdfcraft" "$STAGE/usr/bin/pdfcraft-cli" 2>/dev/null || trueinstall -Dm644 "$HERE/$APP_ID.desktop" "$STAGE/usr/share/applications/$APP_ID.desktop"install -Dm644 "$HERE/$APP_ID.mime.xml" "$STAGE/usr/share/mime/packages/$APP_ID.xml"mkdir -p "$STAGE/usr/share/metainfo"-sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$PRINTCRAFT_BUILD_DATE/g" \+sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$PDFCRAFT_BUILD_DATE/g" \"$HERE/$APP_ID.metainfo.xml.in" >"$STAGE/usr/share/metainfo/$APP_ID.metainfo.xml"mkdir -p "$STAGE/usr/share/icons"cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/usr/share/icons/"-mkdir -p "$STAGE/usr/share/doc/printcraft"-copy_docs "$STAGE/usr/share/doc/printcraft"+mkdir -p "$STAGE/usr/share/doc/pdfcraft"+copy_docs "$STAGE/usr/share/doc/pdfcraft"if command -v desktop-file-validate >/dev/null; thendesktop-file-validate "$STAGE/usr/share/applications/$APP_ID.desktop"@@ -92,10 +92,10 @@ fi# ---- AppImage -----------------------------------------------------------------------------------if has appimage; then- APPDIR="$WORK/PrintCraft.AppDir"+ APPDIR="$WORK/PdfCraft.AppDir"cp -R "$STAGE" "$APPDIR"mv "$APPDIR/usr/share/doc" "$WORK/doc-unused"- ln -s usr/bin/printcraft "$APPDIR/AppRun"+ ln -s usr/bin/pdfcraft "$APPDIR/AppRun"cp "$HERE/$APP_ID.desktop" "$APPDIR/$APP_ID.desktop"cp "$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png" "$APPDIR/$APP_ID.png"ln -s "$APP_ID.png" "$APPDIR/.DirIcon"@@ -115,6 +115,6 @@ if has appimage; thenecho "wrote $OUT"fi-"$STAGE/usr/bin/printcraft-cli" --version+"$STAGE/usr/bin/pdfcraft-cli" --versionecho "==> done"ls -lh "$DIST"diff --git a/packaging/macos/Info.plist.in b/packaging/macos/Info.plist.inindex c83f1bca1..4934f733f 100644--- a/packaging/macos/Info.plist.in+++ b/packaging/macos/Info.plist.in@@ -7,13 +7,13 @@<key>CFBundleDevelopmentRegion</key><string>en</string><key>CFBundleDisplayName</key>- <string>PrintCraft</string>+ <string>PdfCraft</string><key>CFBundleName</key>- <string>PrintCraft</string>+ <string>PdfCraft</string><key>CFBundleExecutable</key>- <string>PrintCraft</string>+ <string>PdfCraft</string><key>CFBundleIdentifier</key>- <string>ai.storyteller.printcraft</string>+ <string>ai.storyteller.pdfcraft</string><key>CFBundleInfoDictionaryVersion</key><string>6.0</string><key>CFBundlePackageType</key>@@ -24,12 +24,12 @@<string>@SHORT_VERSION@</string><key>CFBundleVersion</key><string>@SHORT_VERSION@</string>- <key>PrintCraftVersion</key>+ <key>PdfCraftVersion</key><string>@VERSION@</string>- <key>PrintCraftBuildCommit</key>+ <key>PdfCraftBuildCommit</key><string>@BUILD_SHA@</string><key>CFBundleIconFile</key>- <string>PrintCraft</string>+ <string>PdfCraft</string><key>LSApplicationCategoryType</key><string>public.app-category.graphics-design</string><!-- Must match MACOSX_DEPLOYMENT_TARGET in package.sh. Big Sur is the first release on@@ -43,12 +43,12 @@<key>NSRequiresAquaSystemAppearance</key><false/><key>NSHumanReadableCopyright</key>- <string>Copyright © the PrintCraft authors. MIT OR Apache-2.0.</string>+ <string>Copyright © the PdfCraft authors. MIT OR Apache-2.0.</string>- <!-- Documents PrintCraft opens (#73): it is offered under Open With and can be made the default+ <!-- Documents PdfCraft opens (#73): it is offered under Open With and can be made the defaultfor PDFs, without taking over from the system's viewer on install ("Alternate"). Declared byextension and MIME type; LaunchServices maps them to the system's PDF type. Finder hands the- file over as an Apple event, which apps/printcraft/src/apple_events.rs receives. -->+ file over as an Apple event, which apps/pdfcraft/src/apple_events.rs receives. --><key>CFBundleDocumentTypes</key><array><dict>diff --git a/packaging/macos/entitlements.plist b/packaging/macos/entitlements.plistindex de1817173..020921205 100644--- a/packaging/macos/entitlements.plist+++ b/packaging/macos/entitlements.plist@@ -1,6 +1,6 @@<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">-<!-- Hardened-runtime entitlements for Printcraft. Deliberately empty: the app is pure Rust,+<!-- Hardened-runtime entitlements for Pdfcraft. Deliberately empty: the app is pure Rust,loads no unsigned code, needs no JIT, and is not sandboxed (it opens files by path, from thecommand line and drag-and-drop). Add exceptions here only with a reason in a comment. --><plist version="1.0">diff --git a/packaging/macos/import-cert.sh b/packaging/macos/import-cert.shindex 95b815a9b..ae5ee44c6 100755--- a/packaging/macos/import-cert.sh+++ b/packaging/macos/import-cert.sh@@ -18,8 +18,8 @@ if [ -z "${APPLE_CERTIFICATE:-}" ]; thenfiTMP="${RUNNER_TEMP:-${TMPDIR:-/tmp}}"-KEYCHAIN="$TMP/printcraft-signing.keychain-db"-CERT="$TMP/printcraft-signing.p12"+KEYCHAIN="$TMP/pdfcraft-signing.keychain-db"+CERT="$TMP/pdfcraft-signing.p12"KC_PASS="${KEYCHAIN_PASSWORD:-$(openssl rand -hex 24)}"trap 'rm -f "$CERT"' EXITdiff --git a/packaging/macos/package.sh b/packaging/macos/package.shindex b7100fecb..7f69443b9 100755--- a/packaging/macos/package.sh+++ b/packaging/macos/package.sh@@ -1,8 +1,8 @@#!/usr/bin/env bash# Build, sign and (optionally) notarize the macOS release artifacts:#-# $DIST/printcraft-<version>-macos-<arch>.dmg PrintCraft.app on a drag-to-Applications DMG-# $DIST/printcraft-cli-<version>-macos-<arch>.zip the headless CLI+# $DIST/pdfcraft-<version>-macos-<arch>.dmg PdfCraft.app on a drag-to-Applications DMG+# $DIST/pdfcraft-cli-<version>-macos-<arch>.zip the headless CLI## Usage: packaging/macos/package.sh [--arch universal|aarch64|x86_64] [--skip-build]#@@ -39,9 +39,9 @@ export MACOSX_DEPLOYMENT_TARGET=11.0IDENTITY="${MACOS_SIGN_IDENTITY:--}"SHORT_VERSION="${VERSION%%-*}"WORK="$CARGO_TARGET_DIR/macos-package"-APP="$WORK/PrintCraft.app"-DMG="$DIST/printcraft-$VERSION-macos-$ARCH.dmg"-CLI_ZIP="$DIST/printcraft-cli-$VERSION-macos-$ARCH.zip"+APP="$WORK/PdfCraft.app"+DMG="$DIST/pdfcraft-$VERSION-macos-$ARCH.dmg"+CLI_ZIP="$DIST/pdfcraft-cli-$VERSION-macos-$ARCH.zip"NOTARIZE=0if [ "$IDENTITY" = "-" ]; then@@ -52,18 +52,18 @@ elsewarn "macOS: APPLE_ID / APPLE_PASSWORD / APPLE_TEAM_ID incomplete; signed but not notarized"fi-echo "==> PrintCraft $VERSION for macOS ($ARCH), identity: $IDENTITY, notarize: $NOTARIZE"+echo "==> PdfCraft $VERSION for macOS ($ARCH), identity: $IDENTITY, notarize: $NOTARIZE"# ---- build -------------------------------------------------------------------------------------if [ "$SKIP_BUILD" = 0 ]; thenargs=()for t in "${TARGETS[@]}"; do args+=(--target "$t"); done- (cd "$ROOT" && cargo build --release --locked -p printcraft -p printcraft-cli "${args[@]}")+ (cd "$ROOT" && cargo build --release --locked -p pdfcraft -p pdfcraft-cli "${args[@]}")firm -rf "$WORK"mkdir -p "$WORK/bin"-for bin in printcraft printcraft-cli; do+for bin in pdfcraft pdfcraft-cli; doinputs=()for t in "${TARGETS[@]}"; do inputs+=("$CARGO_TARGET_DIR/$t/release/$bin"); donelipo -create -output "$WORK/bin/$bin" "${inputs[@]}"@@ -97,28 +97,28 @@ notarize() {fi}-# ---- PrintCraft.app ----------------------------------------------------------------------------+# ---- PdfCraft.app ----------------------------------------------------------------------------echo "==> assembling $APP"mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"# Executable and icon carry the display name (CFBundleExecutable / CFBundleIconFile).-cp "$WORK/bin/printcraft" "$APP/Contents/MacOS/PrintCraft"-cp "$ROOT/assets/app-icon/printcraft.icns" "$APP/Contents/Resources/PrintCraft.icns"+cp "$WORK/bin/pdfcraft" "$APP/Contents/MacOS/PdfCraft"+cp "$ROOT/assets/app-icon/pdfcraft.icns" "$APP/Contents/Resources/PdfCraft.icns"copy_font_licences "$APP/Contents/Resources"sed -e "s/@VERSION@/$VERSION/g" -e "s/@SHORT_VERSION@/$SHORT_VERSION/g" \- -e "s/@BUILD_SHA@/${PRINTCRAFT_BUILD_SHA:-unknown}/g" \+ -e "s/@BUILD_SHA@/${PDFCRAFT_BUILD_SHA:-unknown}/g" \"$HERE/Info.plist.in" >"$APP/Contents/Info.plist"plutil -lint "$APP/Contents/Info.plist"printf 'APPL????' >"$APP/Contents/PkgInfo"# Sign inside-out: nested code first, then the bundle itself (no --deep on the final signature).# Today the only nested code is the main executable; frameworks/helpers would be signed here too.-sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP/Contents/MacOS/PrintCraft"+sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP/Contents/MacOS/PdfCraft"sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP"codesign --verify --strict --deep --verbose=2 "$APP"if [ "$NOTARIZE" = 1 ]; then- ditto -c -k --keepParent "$APP" "$WORK/PrintCraft-notarize.zip"- notarize "$WORK/PrintCraft-notarize.zip"+ ditto -c -k --keepParent "$APP" "$WORK/PdfCraft-notarize.zip"+ notarize "$WORK/PdfCraft-notarize.zip"xcrun stapler staple "$APP"xcrun stapler validate "$APP"spctl --assess --type execute -vvv "$APP"@@ -128,12 +128,12 @@ fiecho "==> building $DMG"STAGE="$WORK/dmg"mkdir -p "$STAGE"-ditto "$APP" "$STAGE/PrintCraft.app"+ditto "$APP" "$STAGE/PdfCraft.app"ln -s /Applications "$STAGE/Applications"rm -f "$DMG" "$WORK/raw.dmg"# makehybrid + convert builds the image without attaching a device, unlike `create -srcfolder`,# which is flaky on CI runners ("Resource busy") and hangs in sandboxed sessions.-hdiutil makehybrid -hfs -hfs-volume-name "PrintCraft $VERSION" -hfs-openfolder "$STAGE" -o "$WORK/raw.dmg" "$STAGE"+hdiutil makehybrid -hfs -hfs-volume-name "PdfCraft $VERSION" -hfs-openfolder "$STAGE" -o "$WORK/raw.dmg" "$STAGE"hdiutil convert "$WORK/raw.dmg" -format UDZO -imagekey zlib-level=9 -o "$DMG"rm -f "$WORK/raw.dmg"sign "$DMG"@@ -147,17 +147,17 @@ fi# ---- CLI ---------------------------------------------------------------------------------------echo "==> building $CLI_ZIP"-CLI_DIR="$WORK/printcraft-cli-$VERSION-macos-$ARCH"+CLI_DIR="$WORK/pdfcraft-cli-$VERSION-macos-$ARCH"mkdir -p "$CLI_DIR"-cp "$WORK/bin/printcraft-cli" "$CLI_DIR/"+cp "$WORK/bin/pdfcraft-cli" "$CLI_DIR/"copy_docs "$CLI_DIR"-sign --options runtime "$CLI_DIR/printcraft-cli"-codesign --verify --strict --verbose=2 "$CLI_DIR/printcraft-cli"+sign --options runtime "$CLI_DIR/pdfcraft-cli"+codesign --verify --strict --verbose=2 "$CLI_DIR/pdfcraft-cli"rm -f "$CLI_ZIP"ditto -c -k --keepParent "$CLI_DIR" "$CLI_ZIP"# A bare Mach-O can't carry a stapled ticket; Gatekeeper looks the notarization up online.if [ "$NOTARIZE" = 1 ]; then notarize "$CLI_ZIP"; fi-"$WORK/bin/printcraft-cli" --version+"$WORK/bin/pdfcraft-cli" --versionecho "==> done"ls -lh "$DMG" "$CLI_ZIP"diff --git a/packaging/web/README.md b/packaging/web/README.mdindex 29686140c..20ed886a2 100644--- a/packaging/web/README.md+++ b/packaging/web/README.md@@ -1,22 +1,22 @@-# Hosting PrintCraft for the web+# Hosting PdfCraft for the web-`printcraft-web-<version>.zip` (from the GitHub release, or `packaging/web/package.sh`) holds a-static site in `printcraft-web-<version>/`:+`pdfcraft-web-<version>.zip` (from the GitHub release, or `packaging/web/package.sh`) holds a+static site in `pdfcraft-web-<version>/`:| File | What it is ||---|---|| `index.html` | The page. It loads everything through relative URLs. |-| `printcraft-web-<hash>.js` | wasm-bindgen glue (generated, ES module) |-| `printcraft-web-<hash>_bg.wasm` | The app, about 13 MB, or 5 MB with compression |+| `pdfcraft-web-<hash>.js` | wasm-bindgen glue (generated, ES module) |+| `pdfcraft-web-<hash>_bg.wasm` | The app, about 13 MB, or 5 MB with compression || `_headers`, `.htaccess` | Sample header rules for Netlify/Cloudflare Pages and Apache |There is no server-side code. Upload the folder's contents anywhere that serves static files.## Any path works-All URLs in `index.html` are relative (`public_url = "./"` in `apps/printcraft-web/Trunk.toml`),+All URLs in `index.html` are relative (`public_url = "./"` in `apps/pdfcraft-web/Trunk.toml`),so the site works at a domain root (`https://example.com/`), under a prefix-(`https://example.com/tools/printcraft/`) and from a CDN bucket. The asset names carry a content+(`https://example.com/tools/pdfcraft/`) and from a CDN bucket. The asset names carry a contenthash, so they can be cached forever. Only `index.html` needs revalidation.## Required server settings@@ -31,7 +31,7 @@ hash, so they can be cached forever. Only `index.html` needs revalidation.`.js` files, and `no-cache` on `index.html`.- **HTTPS:** WebGPU (and the clipboard) only work in a secure context, which means `https://`or `http://localhost`. Over plain HTTP elsewhere, the app falls back to WebGL2.-- **No special isolation headers:** PrintCraft doesn't use `SharedArrayBuffer`, so it doesn't+- **No special isolation headers:** PdfCraft doesn't use `SharedArrayBuffer`, so it doesn'tneed `Cross-Origin-Opener-Policy` or `Cross-Origin-Embedder-Policy`. If your site already sendsCOEP `require-corp`, also send `Cross-Origin-Resource-Policy: same-origin` (or `cross-origin`when the files live on a CDN) on the app's files.@@ -39,7 +39,7 @@ hash, so they can be cached forever. Only `index.html` needs revalidation.nginx example:```nginx-location /printcraft/ {+location /pdfcraft/ {types { application/wasm wasm; text/javascript js; text/html html; }gzip on;gzip_types application/wasm text/javascript text/html;@@ -54,8 +54,8 @@ Local test: `python3 -m http.server 8765` inside the folder, then open http://lo```html<iframe- src="https://example.com/printcraft/"- title="PrintCraft PDF workbench"+ src="https://example.com/pdfcraft/"+ title="PdfCraft PDF workbench"style="width: 100%; height: 720px; border: 0;"allow="fullscreen; clipboard-read; clipboard-write"allowfullscreen>@@ -75,7 +75,7 @@ Local test: `python3 -m http.server 8765` inside the folder, then open http://lo## Renderer selection and fallback flags-PrintCraft renders with wgpu. It uses **WebGPU** when the browser has it and falls back to+PdfCraft renders with wgpu. It uses **WebGPU** when the browser has it and falls back to**WebGL2** on its own. URL query flags override this, and they work on the iframe `src` too:| Flag | Effect |@@ -84,6 +84,6 @@ PrintCraft renders with wgpu. It uses **WebGPU** when the browser has it and fal| `?webgl` | Force the WebGL2 backend (useful when a WebGPU driver misbehaves) || `?cpu` | Force the CPU canvas path (slowest, most compatible) |-For example: `<iframe src="https://example.com/printcraft/?webgl" ...>`.+For example: `<iframe src="https://example.com/pdfcraft/?webgl" ...>`.A browser with neither WebGPU nor WebGL2 gets a message in place of the app.diff --git a/packaging/web/package.sh b/packaging/web/package.shindex 12fea1566..c676721fd 100755--- a/packaging/web/package.sh+++ b/packaging/web/package.sh@@ -1,10 +1,10 @@#!/usr/bin/env bash-# Build the browser version and zip it: $DIST/printcraft-web-<version>.zip+# Build the browser version and zip it: $DIST/pdfcraft-web-<version>.zip## Usage: packaging/web/package.sh [--skip-build]## Needs: trunk (brew install trunk / cargo install trunk --locked) and the wasm32-unknown-unknown-# target. The zip holds a self-contained static site in printcraft-web-<version>/ that works+# target. The zip holds a self-contained static site in pdfcraft-web-<version>/ that works# from any URL path and inside an <iframe>. Hosting notes: packaging/web/README.md.set -euo pipefail# shellcheck source=../env.sh@@ -13,7 +13,7 @@ HERE="$ROOT/packaging/web"if [ "${1:-}" != "--skip-build" ]; thencommand -v trunk >/dev/null || { echo "error: trunk not found (cargo install trunk --locked)" >&2; exit 1; }- (cd "$ROOT/apps/printcraft-web" && trunk build --release)+ (cd "$ROOT/apps/pdfcraft-web" && trunk build --release)fiSITE="$ROOT/dist/web"@@ -24,7 +24,7 @@ if grep -Eq '(src|href)="/[^/]' "$SITE/index.html"; thenexit 1fi-NAME="printcraft-web-$VERSION"+NAME="pdfcraft-web-$VERSION"WORK="$CARGO_TARGET_DIR/web-package"rm -rf "$WORK"mkdir -p "$WORK/$NAME"diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1index 208271de0..98e84ab14 100644--- a/packaging/windows/package.ps1+++ b/packaging/windows/package.ps1@@ -1,11 +1,11 @@<#.SYNOPSIS- Build, sign and package PrintCraft for Windows.+ Build, sign and package PdfCraft for Windows..DESCRIPTIONProduces, in $env:DIST (default: dist/release):- printcraft-<version>-windows-<arch>.msi per-machine installer (WiX v5)- printcraft-<version>-windows-<arch>-portable.zip printcraft.exe + printcraft-cli.exe+ pdfcraft-<version>-windows-<arch>.msi per-machine installer (WiX v5)+ pdfcraft-<version>-windows-<arch>-portable.zip pdfcraft.exe + pdfcraft-cli.exeThe binaries link the C runtime statically (+crt-static), so neither the MSI nor the portablezip needs the Visual C++ redistributable. Signing is delegated to sign.ps1 (skipped with a@@ -33,7 +33,7 @@ function Invoke-Native([string] $What, [scriptblock] $Block) {}# The version lives in one place: [workspace.package] version in the root Cargo.toml.-$Version = $env:PRINTCRAFT_VERSION+$Version = $env:PDFCRAFT_VERSIONif (-not $Version) {$inPkg = $falseforeach ($line in Get-Content (Join-Path $Root 'Cargo.toml')) {@@ -50,10 +50,10 @@ $Dist = if ($env:DIST) { $env:DIST } else { Join-Path $Root 'dist\release' }$TargetDir = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { Join-Path $Root 'target' }New-Item -ItemType Directory -Force -Path $Dist | Out-Null-if (-not $env:PRINTCRAFT_BUILD_SHA) { $env:PRINTCRAFT_BUILD_SHA = (git -C $Root rev-parse HEAD 2>$null) }-if (-not $env:PRINTCRAFT_BUILD_DATE) { $env:PRINTCRAFT_BUILD_DATE = (Get-Date).ToUniversalTime().ToString('yyyy-MM-dd') }+if (-not $env:PDFCRAFT_BUILD_SHA) { $env:PDFCRAFT_BUILD_SHA = (git -C $Root rev-parse HEAD 2>$null) }+if (-not $env:PDFCRAFT_BUILD_DATE) { $env:PDFCRAFT_BUILD_DATE = (Get-Date).ToUniversalTime().ToString('yyyy-MM-dd') }-Write-Output "PrintCraft $Version for Windows $Arch ($Target)"+Write-Output "PdfCraft $Version for Windows $Arch ($Target)"if (-not $SkipBuild) {# Static CRT: no VC++ redistributable needed. Scoped to the target so host build scripts and@@ -61,8 +61,8 @@ if (-not $SkipBuild) {$flagVar = 'CARGO_TARGET_' + ($Target.ToUpper() -replace '-', '_') + '_RUSTFLAGS'[Environment]::SetEnvironmentVariable($flagVar, '-C target-feature=+crt-static')# Fail the build (rather than warn) if the icon/VERSIONINFO can't be embedded.- $env:PRINTCRAFT_REQUIRE_WINRES = '1'- Invoke-Native "cargo build ($Target)" { cargo build --release --locked -p printcraft -p printcraft-cli --target $Target }+ $env:PDFCRAFT_REQUIRE_WINRES = '1'+ Invoke-Native "cargo build ($Target)" { cargo build --release --locked -p pdfcraft -p pdfcraft-cli --target $Target }}$Bin = Join-Path $TargetDir "$Target\release"@@ -77,7 +77,7 @@ function Get-PeHeader([string] $Path) {return @{ Machine = [BitConverter]::ToUInt16($bytes, $pe + 4); Subsystem = [BitConverter]::ToUInt16($bytes, $pe + 0x5C) }}$Machine = switch ($Arch) { 'x64' { 0x8664 } 'x86' { 0x14C } 'arm64' { 0xAA64 } }-foreach ($check in @(@('printcraft.exe', 2), @('printcraft-cli.exe', 3))) {+foreach ($check in @(@('pdfcraft.exe', 2), @('pdfcraft-cli.exe', 3))) {$h = Get-PeHeader (Join-Path $Bin $check[0])if ($h.Machine -ne $Machine) { throw "$($check[0]) is for machine 0x$('{0:X}' -f $h.Machine), expected 0x$('{0:X}' -f $Machine) ($Arch)" }if ($h.Subsystem -ne $check[1]) { throw "$($check[0]) has PE subsystem $($h.Subsystem), expected $($check[1])" }@@ -86,15 +86,15 @@ foreach ($check in @(@('printcraft.exe', 2), @('printcraft-cli.exe', 3))) {$Stage = Join-Path $TargetDir "windows-package\$Arch"Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinueNew-Item -ItemType Directory -Force -Path $Stage | Out-Null-Copy-Item (Join-Path $Bin 'printcraft.exe'), (Join-Path $Bin 'printcraft-cli.exe') $Stage+Copy-Item (Join-Path $Bin 'pdfcraft.exe'), (Join-Path $Bin 'pdfcraft-cli.exe') $Stage-& (Join-Path $PSScriptRoot 'sign.ps1') (Join-Path $Stage 'printcraft.exe') (Join-Path $Stage 'printcraft-cli.exe')+& (Join-Path $PSScriptRoot 'sign.ps1') (Join-Path $Stage 'pdfcraft.exe') (Join-Path $Stage 'pdfcraft-cli.exe')# ---- MSI ----------------------------------------------------------------------------------------$Msi = Join-Path $Dist "printcraft-$Version-windows-$Arch.msi"+$Msi = Join-Path $Dist "pdfcraft-$Version-windows-$Arch.msi"Invoke-Native 'wix build' {- wix build (Join-Path $PSScriptRoot 'printcraft.wxs') -arch $Arch `- -d "Version=$MsiVersion" -d "BinDir=$Stage" -d "IconPath=$(Join-Path $Root 'assets\app-icon\printcraft.ico')" `+ wix build (Join-Path $PSScriptRoot 'pdfcraft.wxs') -arch $Arch `+ -d "Version=$MsiVersion" -d "BinDir=$Stage" -d "IconPath=$(Join-Path $Root 'assets\app-icon\pdfcraft.ico')" `-o $Msi}# wix writes its debug symbols (.wixpdb) next to the MSI; keep them out of the release assets.@@ -102,7 +102,7 @@ Remove-Item -Force -ErrorAction SilentlyContinue ([IO.Path]::ChangeExtension($Ms& (Join-Path $PSScriptRoot 'sign.ps1') $Msi# ---- portable zip -------------------------------------------------------------------------------$Portable = Join-Path $TargetDir "windows-package\printcraft-$Version-windows-$Arch-portable"+$Portable = Join-Path $TargetDir "windows-package\pdfcraft-$Version-windows-$Arch-portable"Remove-Item -Recurse -Force $Portable -ErrorAction SilentlyContinueNew-Item -ItemType Directory -Force -Path $Portable | Out-NullCopy-Item (Join-Path $Stage '*.exe') $Portable@@ -118,7 +118,7 @@ if ($env:CRAFT_FONTS_DIR) {if (Test-Path $ofl) { Copy-Item $ofl (Join-Path $Portable "OFL-$($_.Name).txt") }}}-$Zip = Join-Path $Dist "printcraft-$Version-windows-$Arch-portable.zip"+$Zip = Join-Path $Dist "pdfcraft-$Version-windows-$Arch-portable.zip"Remove-Item -Force $Zip -ErrorAction SilentlyContinueCompress-Archive -Path $Portable -DestinationPath $Zip@@ -126,8 +126,8 @@ Compress-Archive -Path $Portable -DestinationPath $Zip# here; .github/workflows/windows-arm64.yml installs and runs it on ARM64 instead.$HostArch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()if ($Arch -ne 'arm64' -or $HostArch -eq 'arm64') {- Invoke-Native 'printcraft-cli --version' { & (Join-Path $Stage 'printcraft-cli.exe') --version }+ Invoke-Native 'pdfcraft-cli --version' { & (Join-Path $Stage 'pdfcraft-cli.exe') --version }} else {- Write-Output "skipping printcraft-cli --version: an $Arch build doesn't run on this $HostArch machine"+ Write-Output "skipping pdfcraft-cli --version: an $Arch build doesn't run on this $HostArch machine"}Get-Item $Msi, $Zip | Format-Table Name, Lengthdiff --git a/packaging/windows/pdfcraft.wxs b/packaging/windows/pdfcraft.wxsnew file mode 100644index 000000000..cc895cc88--- /dev/null+++ b/packaging/windows/pdfcraft.wxs@@ -0,0 +1,81 @@+<?xml version="1.0" encoding="utf-8"?>+<!--+ PdfCraft MSI (WiX Toolset v5: `dotnet tool install -g wix`). Built by package.ps1:++ wix build pdfcraft.wxs -arch x64 -d Version=1.2.3 -d BinDir=... -d IconPath=... -o out.msi++ Per-machine install into Program Files, a Start Menu shortcut, an App Paths entry, and PdfCraft+ registered as a PDF handler (offered under "Open with" and in Default apps, never forced as the+ default). Files opened with PdfCraft arrive on its command line.+-->+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">+ <Package+ Name="PdfCraft"+ Manufacturer="Learning Machines LLC"+ Version="$(var.Version)"+ UpgradeCode="EA00C367-7270-4C50-9D8B-A7A5C88AD27F"+ Scope="perMachine"+ Compressed="yes"+ Language="1033">+ <SummaryInformation Description="PdfCraft PDF workbench" Manufacturer="Learning Machines LLC" />+ <!-- Same-version upgrades let successive pre-releases of one X.Y.Z replace each other+ (MSI versions are numeric, so 1.2.3-rc.1 and 1.2.3-rc.2 are both 1.2.3). -->+ <MajorUpgrade AllowSameVersionUpgrades="yes"+ DowngradeErrorMessage="A newer version of PdfCraft is already installed." />+ <MediaTemplate EmbedCab="yes" CompressionLevel="high" />++ <!-- Windows Installer requires an Icon id ending in .ico or .exe, or advertised shortcuts and+ Add/Remove Programs show a blank icon (#57). -->+ <Icon Id="PdfcraftIcon.ico" SourceFile="$(var.IconPath)" />+ <Property Id="ARPPRODUCTICON" Value="PdfcraftIcon.ico" />+ <Property Id="ARPURLINFOABOUT" Value="https://getartcraft.com/apps/pdfcraft" />+ <Property Id="ARPURLUPDATEINFO" Value="https://getartcraft.com/apps/pdfcraft" />+ <Property Id="ARPHELPLINK" Value="https://discord.gg/artcraft" />++ <StandardDirectory Id="ProgramFiles6432Folder">+ <Directory Id="INSTALLFOLDER" Name="PdfCraft" />+ </StandardDirectory>+ <StandardDirectory Id="ProgramMenuFolder" />++ <Feature Id="Main" Title="PdfCraft" Level="1">+ <ComponentGroupRef Id="PdfcraftFiles" />+ </Feature>+ </Package>++ <Fragment>+ <ComponentGroup Id="PdfcraftFiles" Directory="INSTALLFOLDER">+ <Component Id="PdfcraftApp" Guid="E724C1C6-091F-4E21-A685-80D089FDBE21">+ <File Id="PdfcraftExe" Source="$(var.BinDir)\pdfcraft.exe" KeyPath="yes">+ <Shortcut Id="StartMenuShortcut" Directory="ProgramMenuFolder" Name="PdfCraft"+ Description="PdfCraft PDF workbench" WorkingDirectory="INSTALLFOLDER" Advertise="yes"+ Icon="PdfcraftIcon.ico" IconIndex="0" />+ </File>++ <RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Value="[#PdfcraftExe]" Type="string" />++ <!-- PDF files (#107): PdfCraft is offered under "Open with" and in Settings ▸ Default+ apps, through Windows' Default Programs registration (a ProgID, OpenWithProgids,+ Capabilities and RegisteredApplications). It never takes over an existing default:+ .pdf's own default value is left alone, and the user chooses. Without this, the only+ PdfCraft entry to pick was the advertised Start Menu shortcut, which Windows can't+ run as a file handler ("This app can't run on your PC"). -->+ <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document" Value="PDF Document" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document\DefaultIcon" Value="[#PdfcraftExe],0" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document\shell\open\command" Value=""[#PdfcraftExe]" "%1"" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\Classes\.pdf\OpenWithProgids" Name="PdfCraft.Document" Value="" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe" Name="FriendlyAppName" Value="PdfCraft" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe\SupportedTypes" Name=".pdf" Value="" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe\shell\open\command" Value=""[#PdfcraftExe]" "%1"" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities" Name="ApplicationName" Value="PdfCraft" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities" Name="ApplicationDescription" Value="Open-source PDF workbench" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities" Name="ApplicationIcon" Value="[#PdfcraftExe],0" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities\FileAssociations" Name=".pdf" Value="PdfCraft.Document" Type="string" />+ <RegistryValue Root="HKLM" Key="Software\RegisteredApplications" Name="PdfCraft" Value="Software\PdfCraft\Capabilities" Type="string" />+ </Component>++ <Component Id="PdfcraftCli">+ <File Id="PdfcraftCliExe" Source="$(var.BinDir)\pdfcraft-cli.exe" KeyPath="yes" />+ </Component>+ </ComponentGroup>+ </Fragment>+</Wix>diff --git a/packaging/windows/printcraft.wxs b/packaging/windows/printcraft.wxsdeleted file mode 100644index 0bb390d09..000000000--- a/packaging/windows/printcraft.wxs+++ /dev/null@@ -1,81 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<!--- PrintCraft MSI (WiX Toolset v5: `dotnet tool install -g wix`). Built by package.ps1:-- wix build printcraft.wxs -arch x64 -d Version=1.2.3 -d BinDir=... -d IconPath=... -o out.msi-- Per-machine install into Program Files, a Start Menu shortcut, an App Paths entry, and PrintCraft- registered as a PDF handler (offered under "Open with" and in Default apps, never forced as the- default). Files opened with PrintCraft arrive on its command line.--->-<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">- <Package- Name="PrintCraft"- Manufacturer="Learning Machines LLC"- Version="$(var.Version)"- UpgradeCode="EA00C367-7270-4C50-9D8B-A7A5C88AD27F"- Scope="perMachine"- Compressed="yes"- Language="1033">- <SummaryInformation Description="PrintCraft PDF workbench" Manufacturer="Learning Machines LLC" />- <!-- Same-version upgrades let successive pre-releases of one X.Y.Z replace each other- (MSI versions are numeric, so 1.2.3-rc.1 and 1.2.3-rc.2 are both 1.2.3). -->- <MajorUpgrade AllowSameVersionUpgrades="yes"- DowngradeErrorMessage="A newer version of PrintCraft is already installed." />- <MediaTemplate EmbedCab="yes" CompressionLevel="high" />-- <!-- Windows Installer requires an Icon id ending in .ico or .exe, or advertised shortcuts and- Add/Remove Programs show a blank icon (#57). -->- <Icon Id="PrintcraftIcon.ico" SourceFile="$(var.IconPath)" />- <Property Id="ARPPRODUCTICON" Value="PrintcraftIcon.ico" />- <Property Id="ARPURLINFOABOUT" Value="https://getartcraft.com/apps/printcraft" />- <Property Id="ARPURLUPDATEINFO" Value="https://getartcraft.com/apps/printcraft" />- <Property Id="ARPHELPLINK" Value="https://discord.gg/artcraft" />-- <StandardDirectory Id="ProgramFiles6432Folder">- <Directory Id="INSTALLFOLDER" Name="PrintCraft" />- </StandardDirectory>- <StandardDirectory Id="ProgramMenuFolder" />-- <Feature Id="Main" Title="PrintCraft" Level="1">- <ComponentGroupRef Id="PrintcraftFiles" />- </Feature>- </Package>-- <Fragment>- <ComponentGroup Id="PrintcraftFiles" Directory="INSTALLFOLDER">- <Component Id="PrintcraftApp" Guid="E724C1C6-091F-4E21-A685-80D089FDBE21">- <File Id="PrintcraftExe" Source="$(var.BinDir)\printcraft.exe" KeyPath="yes">- <Shortcut Id="StartMenuShortcut" Directory="ProgramMenuFolder" Name="PrintCraft"- Description="PrintCraft PDF workbench" WorkingDirectory="INSTALLFOLDER" Advertise="yes"- Icon="PrintcraftIcon.ico" IconIndex="0" />- </File>-- <RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\printcraft.exe" Value="[#PrintcraftExe]" Type="string" />-- <!-- PDF files (#107): PrintCraft is offered under "Open with" and in Settings ▸ Default- apps, through Windows' Default Programs registration (a ProgID, OpenWithProgids,- Capabilities and RegisteredApplications). It never takes over an existing default:- .pdf's own default value is left alone, and the user chooses. Without this, the only- PrintCraft entry to pick was the advertised Start Menu shortcut, which Windows can't- run as a file handler ("This app can't run on your PC"). -->- <RegistryValue Root="HKLM" Key="Software\Classes\PrintCraft.Document" Value="PDF Document" Type="string" />- <RegistryValue Root="HKLM" Key="Software\Classes\PrintCraft.Document\DefaultIcon" Value="[#PrintcraftExe],0" Type="string" />- <RegistryValue Root="HKLM" Key="Software\Classes\PrintCraft.Document\shell\open\command" Value=""[#PrintcraftExe]" "%1"" Type="string" />- <RegistryValue Root="HKLM" Key="Software\Classes\.pdf\OpenWithProgids" Name="PrintCraft.Document" Value="" Type="string" />- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\printcraft.exe" Name="FriendlyAppName" Value="PrintCraft" Type="string" />- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\printcraft.exe\SupportedTypes" Name=".pdf" Value="" Type="string" />- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\printcraft.exe\shell\open\command" Value=""[#PrintcraftExe]" "%1"" Type="string" />- <RegistryValue Root="HKLM" Key="Software\PrintCraft\Capabilities" Name="ApplicationName" Value="PrintCraft" Type="string" />- <RegistryValue Root="HKLM" Key="Software\PrintCraft\Capabilities" Name="ApplicationDescription" Value="Open-source PDF workbench" Type="string" />- <RegistryValue Root="HKLM" Key="Software\PrintCraft\Capabilities" Name="ApplicationIcon" Value="[#PrintcraftExe],0" Type="string" />- <RegistryValue Root="HKLM" Key="Software\PrintCraft\Capabilities\FileAssociations" Name=".pdf" Value="PrintCraft.Document" Type="string" />- <RegistryValue Root="HKLM" Key="Software\RegisteredApplications" Name="PrintCraft" Value="Software\PrintCraft\Capabilities" Type="string" />- </Component>-- <Component Id="PrintcraftCli">- <File Id="PrintcraftCliExe" Source="$(var.BinDir)\printcraft-cli.exe" KeyPath="yes" />- </Component>- </ComponentGroup>- </Fragment>-</Wix>diff --git a/packaging/windows/sign.ps1 b/packaging/windows/sign.ps1index 5025ca663..5dd206b45 100644--- a/packaging/windows/sign.ps1+++ b/packaging/windows/sign.ps1@@ -15,7 +15,7 @@timestamp server, ...). Optional overrides: WINDOWS_TIMESTAMP_URL, SIGNTOOL (path to signtool.exe)..EXAMPLE- pwsh packaging/windows/sign.ps1 dist/printcraft.exe dist/Printcraft.msi+ pwsh packaging/windows/sign.ps1 dist/pdfcraft.exe dist/Pdfcraft.msi#>param([Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)]@@ -55,8 +55,8 @@ if (-not $haveCert -and -not $haveAzure) {}$script:SignTool = Find-SignTool-$common = @('sign', '/v', '/fd', 'SHA256', '/td', 'SHA256', '/d', 'PrintCraft', '/du', 'https://github.com/storytold/printcraft')-$tmp = Join-Path ([IO.Path]::GetTempPath()) "printcraft-sign-$PID"+$common = @('sign', '/v', '/fd', 'SHA256', '/td', 'SHA256', '/d', 'PdfCraft', '/du', 'https://github.com/storytold/pdfcraft')+$tmp = Join-Path ([IO.Path]::GetTempPath()) "pdfcraft-sign-$PID"New-Item -ItemType Directory -Force -Path $tmp | Out-Nulltry {diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.tomlindex 2e00cfad7..258b17702 100644--- a/parity/acrobat-features.toml+++ b/parity/acrobat-features.toml@@ -1,4 +1,4 @@-# PrintCraft parity checklist vs Acrobat Pro (offline feature set). Generated from plan docs; maintained by hand.+# PdfCraft parity checklist vs Acrobat Pro (offline feature set). Generated from plan docs; maintained by hand.# Validated and reported by `cargo xtask parity`. Schema: see the [schema] table.# Status rules: `shipped` = usable today with at least one cited test; `partial` = part exists (notes say what is# missing); `planned` = not started; `na` = Adobe-cloud-only (notes name the local or pluggable alternative).@@ -1694,7 +1694,7 @@ milestone = "M3"status = "partial"commands = ["help.check_updates"]tools = []-evidence = ["crates/ui-egui/tests/updates.rs::a_newer_release_is_offered_for_download", "crates/ui-egui/tests/updates.rs::nothing_is_asked_until_the_user_checks", "apps/printcraft/src/updates.rs::answers_are_read_and_only_our_release_pages_are_offered"]+evidence = ["crates/ui-egui/tests/updates.rs::a_newer_release_is_offered_for_download", "crates/ui-egui/tests/updates.rs::nothing_is_asked_until_the_user_checks", "apps/pdfcraft/src/updates.rs::answers_are_read_and_only_our_release_pages_are_offered"]notes = "asks GitHub Releases on request and offers the release page. By the owner's decision there is no check at start and no in-place install (Acrobat has both)"[[feature]]@@ -2323,7 +2323,7 @@ status = "shipped"commands = ["edit.header_footer.update", "edit.header_footer.remove"]tools = ["doc_header_footer", "doc_remove_marks"]evidence = ["crates/edit/src/tests.rs::replace_and_remove_restore_the_original_content", "crates/ui-egui/tests/marks.rs::header_and_footer_dialog_inserts_tokens_and_applies_to_a_subset"]-notes = "recognises PrintCraft marks; Acrobat-made headers are not detected yet"+notes = "recognises PdfCraft marks; Acrobat-made headers are not detected yet"[[feature]]id = "edit.header-footer-tokens"@@ -3471,7 +3471,7 @@ status = "partial"commands = []tools = ["comment_add"]evidence = ["crates/annot/src/tests.rs::every_tool_creates_a_drawable_comment", "crates/engine/src/tests.rs::highlight_multiplies_over_text", "crates/annot/src/tests.rs::polygons_clouds_connected_lines_callouts_and_carets_are_drawn"]-notes = "appearances for every type PrintCraft creates (highlight multiplies; clouds, callouts, stamps, polygons, carets); rich text not yet"+notes = "appearances for every type PdfCraft creates (highlight multiplies; clouds, callouts, stamps, polygons, carets); rich text not yet"[[feature]]id = "comment.sticky-note"@@ -3987,7 +3987,7 @@ status = "shipped"commands = ["comment.stamp"]tools = ["comment_add"]evidence = ["crates/annot/src/tests.rs::stamps_draw_their_label_and_by_line", "crates/ui-egui/tests/stamps.rs::choosing_and_placing_stamps", "crates/automation/tests/automation.rs::stamps_through_tools"]-notes = "12 standard business stamps in PrintCraft's own design; ISO 32000 stamp names where defined"+notes = "12 standard business stamps in PdfCraft's own design; ISO 32000 stamp names where defined"[[feature]]id = "comment.stamps-sign-here"@@ -5191,7 +5191,7 @@ status = "shipped"commands = ["sign.fill.check", "sign.fill.cross", "sign.fill.dot", "sign.fill.line"]tools = ["fill_sign_add"]evidence = ["crates/ui-egui/tests/fill_sign.rs::text_marks_and_date", "crates/annot/src/tests.rs::fill_and_sign_items_are_drawn"]-notes = "PrintCraft-drawn stamps"+notes = "PdfCraft-drawn stamps"[[feature]]id = "form.fill-sign-date"@@ -9363,7 +9363,7 @@ status = "shipped"commands = []tools = ["doc_info", "text_extract", "page_render"]evidence = ["crates/automation/tests/automation.rs::mcp_resources_expose_open_documents", "crates/automation/src/mcp.rs::resource_uris_parse"]-notes = "resources/list, resources/templates/list and resources/read: printcraft://doc/{doc}/info (JSON), /text, /page/{page}/text, /page/{page}/image?dpi= (PNG)"+notes = "resources/list, resources/templates/list and resources/read: pdfcraft://doc/{doc}/info (JSON), /text, /page/{page}/text, /page/{page}/image?dpi= (PNG)"[[feature]]id = "misc.ui-control-channel"diff --git a/vendor/README.md b/vendor/README.mdindex b2dd12ae9..75868f029 100644--- a/vendor/README.md+++ b/vendor/README.md@@ -1,8 +1,8 @@# Vendored cratesPermissively licensed crates we carry small patches for. Each directory keeps the upstream-licence files unchanged. Every patch is marked `PrintCraft patch:` in the source, is covered by a-PrintCraft test, and should be proposed upstream. Remove the vendored copy once upstream releases+licence files unchanged. Every patch is marked `PdfCraft patch:` in the source, is covered by a+PdfCraft test, and should be proposed upstream. Remove the vendored copy once upstream releasesthe fix. Vendoring copyleft code is never allowed (plan/adr/0001).| Crate | Version | Licence | Patches | Test |diff --git a/vendor/hayro-interpret/src/context.rs b/vendor/hayro-interpret/src/context.rsindex 4338837af..5a2f2ab8c 100644--- a/vendor/hayro-interpret/src/context.rs+++ b/vendor/hayro-interpret/src/context.rs@@ -18,12 +18,12 @@ use std::rc::Rc;/// Maximum nesting depth for interpreting `XObject`'s/patterns/streams.pub(crate) const MAX_NESTED_INTERPRETATION_DEPTH: u32 = 50;-/// PrintCraft patch: maximum nesting for content that is painted recursively by the device+/// PdfCraft patch: maximum nesting for content that is painted recursively by the device/// (tiling patterns, Type 3 glyphs). Either can refer back to itself through resources it/// inherits, which recursed until the stack overflowed (found by fuzzing).pub(crate) const MAX_PAINT_NESTING: u32 = 16;-/// PrintCraft patch: how many nested paints (a form inside a form, a Type 3 glyph or tiling+/// PdfCraft patch: how many nested paints (a form inside a form, a Type 3 glyph or tiling/// pattern painted from inside another one) one page may do. Nesting depth alone doesn't bound/// the work: a glyph that shows ten glyphs of its own font, nested sixteen deep, is 10^16/// paints (a fuzzed file hung). Ordinary pages stay far below this.@@ -33,7 +33,7 @@ std::thread_local! {static NESTED_PAINTS: core::cell::Cell<u32> = const { core::cell::Cell::new(0) };}-/// PrintCraft patch: count a paint at `depth` (top-level ones are free); `false` once this+/// PdfCraft patch: count a paint at `depth` (top-level ones are free); `false` once this/// page's budget is spent, and the paint is skipped.pub(crate) fn take_nested_paint(depth: u32) -> bool {if depth < 2 {@@ -101,7 +101,7 @@ impl<'a> Context<'a> {settings: InterpreterSettings,) -> Self {let state = State::new(initial_transform);- // PrintCraft patch: a page (or other top-level content) starts with a fresh budget.+ // PdfCraft patch: a page (or other top-level content) starts with a fresh budget.NESTED_PAINTS.with(|n| n.set(0));Self::new_with(initial_transform, bbox, cache, xref, settings, state, 0)@@ -122,7 +122,7 @@ impl<'a> Context<'a> {.map(|catalog| OcgState::from_catalog(&catalog)).unwrap_or_default()};- // PrintCraft patch: apply viewer layer toggles.+ // PdfCraft patch: apply viewer layer toggles.for (num, generation, visible) in settings.ocg_overrides.iter() {ocg_state.set_active(hayro_syntax::object::ObjectIdentifier::new(*num, *generation), *visible);}diff --git a/vendor/hayro-interpret/src/font/cid.rs b/vendor/hayro-interpret/src/font/cid.rsindex ad00a84f3..2cfd36bc9 100644--- a/vendor/hayro-interpret/src/font/cid.rs+++ b/vendor/hayro-interpret/src/font/cid.rs@@ -509,7 +509,7 @@ impl CidToGIdMap {}}-/// PrintCraft patch: the largest CID (ISO 32000-2 §9.7.2; CIDs are at most two bytes).+/// PdfCraft patch: the largest CID (ISO 32000-2 §9.7.2; CIDs are at most two bytes).const MAX_CID: u32 = 65_535;fn read_widths(arr: &Array<'_>) -> Option<HashMap<u32, f32>> {@@ -526,7 +526,7 @@ fn read_widths(arr: &Array<'_>) -> Option<HashMap<u32, f32>> {first = first.checked_add(1)?;}} else if let Some((first, second, width)) = iter.next::<(u32, u32, f32)>() {- // PrintCraft patch: CIDs stop at 65535. A corrupt range such as+ // PdfCraft patch: CIDs stop at 65535. A corrupt range such as// `0 4294967295 500` inserted billions of entries (found by fuzzing).for i in first..=second.min(MAX_CID) {map.insert(i, width);@@ -554,7 +554,7 @@ fn read_widths2(arr: &Array<'_>) -> Option<HashMap<u32, [f32; 3]>> {first = first.checked_add(1)?;}} else if let Some((first, second, w, v1, v2)) = iter.next::<(u32, u32, f32, f32, f32)>() {- // PrintCraft patch: as in `read_widths`.+ // PdfCraft patch: as in `read_widths`.for i in first..=second.min(MAX_CID) {map.insert(i, [w, v1, v2]);}diff --git a/vendor/hayro-interpret/src/font/mod.rs b/vendor/hayro-interpret/src/font/mod.rsindex 43c4cffe4..878a4b16a 100644--- a/vendor/hayro-interpret/src/font/mod.rs+++ b/vendor/hayro-interpret/src/font/mod.rs@@ -217,7 +217,7 @@ impl<'a> Type3Glyph<'a> {self.font.char_code_to_unicode(self.char_code)}- /// PrintCraft patch: the advance width in glyph space (1000 units per em), from `/Widths`.+ /// PdfCraft patch: the advance width in glyph space (1000 units per em), from `/Widths`.pub fn advance_width(&self) -> Option<f32> {u8::try_from(self.char_code).ok().map(|c| self.font.glyph_width(c))}diff --git a/vendor/hayro-interpret/src/font/type3.rs b/vendor/hayro-interpret/src/font/type3.rsindex 3f651ccef..4816f6a70 100644--- a/vendor/hayro-interpret/src/font/type3.rs+++ b/vendor/hayro-interpret/src/font/type3.rs@@ -96,7 +96,7 @@ impl<'a> Type3<'a> {}pub(crate) fn char_code_to_unicode(&self, char_code: u32) -> Option<BfString> {- // PrintCraft patch: upstream only consulted ToUnicode. Many Type3 fonts (e.g. TeX/dvips+ // PdfCraft patch: upstream only consulted ToUnicode. Many Type3 fonts (e.g. TeX/dvips// bitmap fonts) have none; fall back to the /Encoding glyph names, then to printable// ASCII codes, as other viewers do for text extraction.self.to_unicode@@ -123,7 +123,7 @@ impl<'a> Type3<'a> {paint: &Paint<'a>,device: &mut impl Device<'a>,) -> Option<()> {- // PrintCraft patch: a glyph procedure may show text in this same font (through+ // PdfCraft patch: a glyph procedure may show text in this same font (through// inherited resources), recursing until the stack overflowed.if glyph.nesting_depth > crate::context::MAX_PAINT_NESTING|| !crate::context::take_nested_paint(glyph.nesting_depth)diff --git a/vendor/hayro-interpret/src/interpret/mod.rs b/vendor/hayro-interpret/src/interpret/mod.rsindex 3229c7745..448eabf9b 100644--- a/vendor/hayro-interpret/src/interpret/mod.rs+++ b/vendor/hayro-interpret/src/interpret/mod.rs@@ -101,10 +101,10 @@ pub struct InterpreterSettings {/// Note that this feature is currently not fully implemented yet, so some/// annotations might be missing.pub render_annotations: bool,- /// PrintCraft patch: hide comments (markup annotations) but keep form fields (`/Widget`)+ /// PdfCraft patch: hide comments (markup annotations) but keep form fields (`/Widget`)/// and links, for the viewer's "Hide all comments".pub hide_comments: bool,- /// PrintCraft patch: viewer overrides for optional content groups (object number, generation,+ /// PdfCraft patch: viewer overrides for optional content groups (object number, generation,/// visible), applied on top of the document's default configuration (Layers panel toggles).pub ocg_overrides: Arc<Vec<(i32, i32, bool)>>,}@@ -158,18 +158,18 @@ pub fn interpret_page<'a>(let flags = annot.get::<u32>(F).unwrap_or(0);// Annotation should be hidden (Hidden = bit 2, NoView = bit 6).- // PrintCraft patch: NoView was not honoured upstream.+ // PdfCraft patch: NoView was not honoured upstream.if flags & (2 | 32) != 0 {continue;}- // PrintCraft patch: "Hide all comments" keeps widgets and links.+ // PdfCraft patch: "Hide all comments" keeps widgets and links.if context.settings.hide_comments&& !matches!(annot.get::<hayro_syntax::object::Name<'_>>(SUBTYPE).as_deref(), Some(b"Widget" | b"Link")){continue;}- // PrintCraft patch: `/N` may be a stream or a dictionary of appearance states selected+ // PdfCraft patch: `/N` may be a stream or a dictionary of appearance states selected// by `/AS` (checkboxes, radio buttons, …). Upstream only handled the stream form.let normal = annot.get::<Dict<'_>>(AP).and_then(|ap| {ap.get::<Stream<'_>>(N).or_else(|| {diff --git a/vendor/hayro-interpret/src/lib.rs b/vendor/hayro-interpret/src/lib.rsindex 159932f5e..07cfb0041 100644--- a/vendor/hayro-interpret/src/lib.rs+++ b/vendor/hayro-interpret/src/lib.rs@@ -41,7 +41,7 @@ mod ocg;mod soft_mask;mod types;mod x_object;-/// PrintCraft patch: exported for its regression test.+/// PdfCraft patch: exported for its regression test.pub use x_object::image_size_ok;pub mod color;diff --git a/vendor/hayro-interpret/src/ocg.rs b/vendor/hayro-interpret/src/ocg.rsindex 1d12b1f06..c59b70df4 100644--- a/vendor/hayro-interpret/src/ocg.rs+++ b/vendor/hayro-interpret/src/ocg.rs@@ -120,7 +120,7 @@ impl OcgState {self.visibility_stack.pop();}- /// PrintCraft patch: override one group's state (viewer layer toggles).+ /// PdfCraft patch: override one group's state (viewer layer toggles).pub(crate) fn set_active(&mut self, id: ObjectIdentifier, active: bool) {if active {self.inactive_ocgs.remove(&id);diff --git a/vendor/hayro-interpret/src/pattern.rs b/vendor/hayro-interpret/src/pattern.rsindex 54188f206..145b143d0 100644--- a/vendor/hayro-interpret/src/pattern.rs+++ b/vendor/hayro-interpret/src/pattern.rs@@ -228,7 +228,7 @@ impl<'a> TilingPattern<'a> {initial_transform: Affine,is_stroke: bool,) -> Option<()> {- // PrintCraft patch: a tiling pattern can paint itself (directly, or through resources it+ // PdfCraft patch: a tiling pattern can paint itself (directly, or through resources it// inherits when its own are missing), which recursed until the stack overflowed. Bound// the nesting like XObjects do, tighter because every level rasterizes a tile.if self.nesting_depth > crate::context::MAX_PAINT_NESTING || !crate::context::take_nested_paint(self.nesting_depth) {diff --git a/vendor/hayro-interpret/src/soft_mask.rs b/vendor/hayro-interpret/src/soft_mask.rsindex 45937ceb7..048035e7e 100644--- a/vendor/hayro-interpret/src/soft_mask.rs+++ b/vendor/hayro-interpret/src/soft_mask.rs@@ -104,7 +104,7 @@ impl<'a> SoftMask<'a> {let obj_id = dict.get_ref(G)?.into();let group_stream = dict.get::<Stream<'_>>(G)?;let group = FormXObject::new(&group_stream)?;- // PrintCraft patch: the group's /CS is optional (ISO 32000-2 §11.6.5.2; Chrome/Skia omit+ // PdfCraft patch: the group's /CS is optional (ISO 32000-2 §11.6.5.2; Chrome/Skia omit// it). Upstream returned None here, silently dropping the whole soft mask. Fall back to// DeviceRGB, the blending space our renderer composites in.let cs = groupdiff --git a/vendor/hayro-interpret/src/x_object.rs b/vendor/hayro-interpret/src/x_object.rsindex 42bfaf321..954a0d05d 100644--- a/vendor/hayro-interpret/src/x_object.rs+++ b/vendor/hayro-interpret/src/x_object.rs@@ -399,7 +399,7 @@ fn decode_context<'a>(obj: &ImageXObject<'a>,target_dimension: Option<(u32, u32)>,) -> Option<DecodeContext<'a>> {- // PrintCraft patch: images and masks over `MAX_IMAGE_PIXELS` are not decoded at all (the+ // PdfCraft patch: images and masks over `MAX_IMAGE_PIXELS` are not decoded at all (the// renderer skips them anyway): a fuzzed `/W 4294967295` stencil mask allocated gigabytes here.if !image_size_ok(obj.width, obj.height) {(obj.warning_sink)(InterpreterWarning::ImageDecodeFailure);@@ -975,7 +975,7 @@ fn apply_decode_array(Some(decoded_arr)}-/// PrintCraft patch: whether an image or mask of `width` × `height` may be decoded (at most+/// PdfCraft patch: whether an image or mask of `width` × `height` may be decoded (at most/// 2^28 pixels, the renderer's `MAX_IMAGE_PIXELS`).pub fn image_size_ok(width: u32, height: u32) -> bool {width > 0 && height > 0 && u64::from(width) * u64::from(height) <= 1 << 28diff --git a/vendor/hayro-jbig2/src/bitmap.rs b/vendor/hayro-jbig2/src/bitmap.rsindex 7643860c0..35ed97561 100644--- a/vendor/hayro-jbig2/src/bitmap.rs+++ b/vendor/hayro-jbig2/src/bitmap.rs@@ -14,7 +14,7 @@ use alloc::vec::Vec;// to `u16::MAX`, which should be more than enough.pub(crate) const MAX_DIMENSION: u32 = u16::MAX as u32;-/// PrintCraft patch: the most pixels one bitmap may have (2^28, the renderer's+/// PdfCraft patch: the most pixels one bitmap may have (2^28, the renderer's/// `MAX_IMAGE_PIXELS`). Each side alone may be 65535, so a single region could be 4.3 billion/// pixels, decoded one by one.pub(crate) const MAX_PIXELS: u64 = 1 << 28;@@ -69,7 +69,7 @@ impl Bitmap {if width > MAX_DIMENSION || height > MAX_DIMENSION {bail!(OverflowError::BitmapDimension);}- // PrintCraft patch: see `MAX_PIXELS`.+ // PdfCraft patch: see `MAX_PIXELS`.if u64::from(width) * u64::from(height) > MAX_PIXELS {bail!(OverflowError::BitmapDimension);}@@ -96,7 +96,7 @@ impl Bitmap {if width > MAX_DIMENSION || height > MAX_DIMENSION {return Err(OverflowError::BitmapDimension.into());}- // PrintCraft patch: see `MAX_PIXELS` (the page bitmap is sized here).+ // PdfCraft patch: see `MAX_PIXELS` (the page bitmap is sized here).if u64::from(width) * u64::from(height) > MAX_PIXELS {return Err(OverflowError::BitmapDimension.into());}diff --git a/vendor/hayro-jbig2/src/decode/halftone.rs b/vendor/hayro-jbig2/src/decode/halftone.rsindex f03a15702..eb5c1c21e 100644--- a/vendor/hayro-jbig2/src/decode/halftone.rs+++ b/vendor/hayro-jbig2/src/decode/halftone.rs@@ -97,7 +97,7 @@ pub(crate) fn parse<'a>(reader: &mut Reader<'a>) -> Result<HalftoneRegionHeader<if grid_width > MAX_DIMENSION || grid_height > MAX_DIMENSION {bail!(OverflowError::GridDimension);}- // PrintCraft patch: the product is bounded too (see `bitmap::MAX_PIXELS`).+ // PdfCraft patch: the product is bounded too (see `bitmap::MAX_PIXELS`).if u64::from(grid_width) * u64::from(grid_height) > crate::bitmap::MAX_PIXELS {bail!(OverflowError::GridDimension);}diff --git a/vendor/hayro-jbig2/src/decode/symbol.rs b/vendor/hayro-jbig2/src/decode/symbol.rsindex 90cfd3b8a..ad8042520 100644--- a/vendor/hayro-jbig2/src/decode/symbol.rs+++ b/vendor/hayro-jbig2/src/decode/symbol.rs@@ -24,7 +24,7 @@ use crate::reader::Reader;const MAX_SYMBOLS: u32 = u16::MAX as u32;-/// PrintCraft patch: the most symbol pixels one dictionary may decode (2^26). Symbols are+/// PdfCraft patch: the most symbol pixels one dictionary may decode (2^26). Symbols are/// decoded pixel by pixel, and up to 65535 of them of up to 65535 × 65535 each kept a fuzzed/// file decoding for minutes; real dictionaries hold about a million pixels.const MAX_DICTIONARY_PIXELS: u64 = 1 << 26;@@ -107,7 +107,7 @@ pub(crate) fn decode(.total_width.checked_add(symbol_width).ok_or(OverflowError::BitmapDimension)?;- // PrintCraft patch: see `MAX_DICTIONARY_PIXELS`.+ // PdfCraft patch: see `MAX_DICTIONARY_PIXELS`.ctx.pixels = ctx.pixels.saturating_add(u64::from(symbol_width) * u64::from(ctx.height_class_height));@@ -447,7 +447,7 @@ struct SymbolDecodeContext<'a> {symbols_decoded_count: u32,total_width: u32,height_class_height: u32,- /// PrintCraft patch: symbol pixels decoded so far (see `MAX_DICTIONARY_PIXELS`).+ /// PdfCraft patch: symbol pixels decoded so far (see `MAX_DICTIONARY_PIXELS`).pixels: u64,}diff --git a/vendor/hayro-jbig2/src/gray_scale.rs b/vendor/hayro-jbig2/src/gray_scale.rsindex 6fa53482e..2836ec77a 100644--- a/vendor/hayro-jbig2/src/gray_scale.rs+++ b/vendor/hayro-jbig2/src/gray_scale.rs@@ -83,7 +83,7 @@ fn decode_arithmetic(if width > MAX_DIMENSION || height > MAX_DIMENSION {bail!(OverflowError::BitmapDimension);}- // PrintCraft patch: the product is bounded too (see `bitmap::MAX_PIXELS`).+ // PdfCraft patch: the product is bounded too (see `bitmap::MAX_PIXELS`).if u64::from(width) * u64::from(height) > crate::bitmap::MAX_PIXELS {bail!(OverflowError::BitmapDimension);}diff --git a/vendor/hayro-syntax/src/content/mod.rs b/vendor/hayro-syntax/src/content/mod.rsindex 59163dd87..0e111b2f8 100644--- a/vendor/hayro-syntax/src/content/mod.rs+++ b/vendor/hayro-syntax/src/content/mod.rs@@ -91,7 +91,7 @@ impl<'a> Readable<'a> for Operator<'a> {}}-/// PrintCraft patch: how many `EI` candidates an inline image examines, and how far past each+/// PdfCraft patch: how many `EI` candidates an inline image examines, and how far past each/// one the end-of-data heuristic looks, before taking the current candidate. Unbounded, the/// heuristic re-parsed the rest of the stream for every candidate, and each re-parse ran the/// heuristic again on the inline images it met: a fuzzed file hung for minutes.@@ -104,7 +104,7 @@ pub struct UntypedIter<'a> {reader: Reader<'a>,stack: Stack<'a>,operator: Option<Operator<'a>>,- /// PrintCraft patch: this iterator only checks whether data reads as content (the+ /// PdfCraft patch: this iterator only checks whether data reads as content (the/// end-of-data heuristic below); inline images it meets end at their first `EI`.lookahead: bool,}@@ -210,7 +210,7 @@ impl<'a> UntypedIter<'a> {// new we don't bother trying to read it.let tail = &self.reader.tail()?[2..];let mut find_reader = Reader::new(tail);- // PrintCraft patch: bounded (see `MAX_EI_CANDIDATES`).+ // PdfCraft patch: bounded (see `MAX_EI_CANDIDATES`).candidates += 1;let mut steps = 0;let heuristic = !self.lookahead && candidates <= MAX_EI_CANDIDATES;diff --git a/vendor/hayro-syntax/src/filter/ccitt.rs b/vendor/hayro-syntax/src/filter/ccitt.rsindex 3c49e53ff..98924f2db 100644--- a/vendor/hayro-syntax/src/filter/ccitt.rs+++ b/vendor/hayro-syntax/src/filter/ccitt.rs@@ -34,7 +34,7 @@ pub(crate) fn decode(invert_black: params.get::<bool>(BLACK_IS_1).unwrap_or(false),};- // PrintCraft patch: refuse absurd sizes before the decoder allocates for them.+ // PdfCraft patch: refuse absurd sizes before the decoder allocates for them.if !super::ccitt_size_ok(settings.columns, settings.rows) {return None;}diff --git a/vendor/hayro-syntax/src/filter/lzw_flate.rs b/vendor/hayro-syntax/src/filter/lzw_flate.rsindex 44c5c3f56..296890b7f 100644--- a/vendor/hayro-syntax/src/filter/lzw_flate.rs+++ b/vendor/hayro-syntax/src/filter/lzw_flate.rs@@ -717,7 +717,7 @@ struct PredictorParams {impl PredictorParams {fn row_length_in_bytes(&self) -> usize {- // PrintCraft patch: saturating, and in usize (colors × bits overflowed u8): a fuzzed+ // PdfCraft patch: saturating, and in usize (colors × bits overflowed u8): a fuzzed// `/Columns 9223372036854775807` wrapped to a 2^61-byte row.self.columns.saturating_mul(usize::from(self.bits_per_component) * usize::from(self.colors))@@ -764,7 +764,7 @@ fn apply_predictor(data: Vec<u8>, params: &PredictorParams) -> Option<Vec<u8>> {row_len};- // PrintCraft patch: a zero-width row divided by zero below, and a row longer than the+ // PdfCraft patch: a zero-width row divided by zero below, and a row longer than the// data was allocated before finding there is nothing to read (no rows: empty output,// as before).if row_len == 0 {@@ -785,7 +785,7 @@ fn apply_predictor(data: Vec<u8>, params: &PredictorParams) -> Option<Vec<u8>> {let (bit_size, chunk_len) = if is_png_predictor {(8,- // PrintCraft patch: in usize (the u8 product overflowed).+ // PdfCraft patch: in usize (the u8 product overflowed).(usize::from(params.colors) * usize::from(params.bits_per_component)).div_ceil(8),)} else {diff --git a/vendor/hayro-syntax/src/filter/mod.rs b/vendor/hayro-syntax/src/filter/mod.rsindex b45646e1a..f7356a39a 100644--- a/vendor/hayro-syntax/src/filter/mod.rs+++ b/vendor/hayro-syntax/src/filter/mod.rs@@ -132,7 +132,7 @@ impl Filter {}}-/// PrintCraft patch: whether a CCITT image of `columns` × `rows` may be decoded. The decoder sizes+/// PdfCraft patch: whether a CCITT image of `columns` × `rows` may be decoded. The decoder sizes/// its line buffers from `/Columns`, which a fuzzed file set to 4294967295 (a 4 GiB allocation);/// real fax lines are a few thousand pixels wide.pub fn ccitt_size_ok(columns: u32, rows: u32) -> bool {diff --git a/vendor/hayro-syntax/src/page.rs b/vendor/hayro-syntax/src/page.rsindex 8225780de..b36ed4c93 100644--- a/vendor/hayro-syntax/src/page.rs+++ b/vendor/hayro-syntax/src/page.rs@@ -53,7 +53,7 @@ impl<'a> Pages<'a> {) -> Option<Self> {let mut pages = vec![];let pages_ctx = PagesContext::new();- // PrintCraft patch: guard against page-tree cycles (a `/Kids` entry pointing back up+ // PdfCraft patch: guard against page-tree cycles (a `/Kids` entry pointing back up// the tree), which otherwise recurse until the stack overflows.let mut visited = BTreeSet::new();resolve_pages(@@ -109,7 +109,7 @@ impl<'a> Deref for Pages<'a> {}}-/// PrintCraft patch: maximum page-tree depth (direct dictionaries have no id to track).+/// PdfCraft patch: maximum page-tree depth (direct dictionaries have no id to track).const MAX_PAGE_TREE_DEPTH: usize = 256;fn resolve_pages<'a>(@@ -120,7 +120,7 @@ fn resolve_pages<'a>(visited: &mut BTreeSet<ObjectIdentifier>,depth: usize,) -> Option<()> {- // PrintCraft patch: skip nodes already visited and absurdly deep trees.+ // PdfCraft patch: skip nodes already visited and absurdly deep trees.if depth > MAX_PAGE_TREE_DEPTH {return None;}diff --git a/vendor/hayro/src/lib.rs b/vendor/hayro/src/lib.rsindex 83ed9dcfe..79c2f6836 100644--- a/vendor/hayro/src/lib.rs+++ b/vendor/hayro/src/lib.rs@@ -60,7 +60,7 @@ use vello_cpu::color::palette::css::WHITE;use vello_cpu::{Level, Pixmap, RenderMode};mod renderer;-/// PrintCraft patch: exported for its regression test.+/// PdfCraft patch: exported for its regression test.pub use renderer::tiling_cell_scale;/// A cache used by the renderer.@@ -99,7 +99,7 @@ pub struct RenderSettings {/// The background color. Determines the color of the base/// rectangle during rendering to a pixmap.pub bg_color: AlphaColor<Srgb>,- /// PrintCraft patch: top-left corner of the rendered region, in device pixels of the scaled+ /// PdfCraft patch: top-left corner of the rendered region, in device pixels of the scaled/// page. Together with `width`/`height` this renders one tile of a large page.pub x_offset: f32,/// See `x_offset`.diff --git a/vendor/hayro/src/renderer.rs b/vendor/hayro/src/renderer.rsindex 9a5876d66..3bf5ccec7 100644--- a/vendor/hayro/src/renderer.rs+++ b/vendor/hayro/src/renderer.rs@@ -21,7 +21,7 @@ use vello_cpu::{};-/// PrintCraft patch: largest image drawn, in pixels (2^28 ≈ 268 MP, well above real page images).+/// PdfCraft patch: largest image drawn, in pixels (2^28 ≈ 268 MP, well above real page images).const MAX_IMAGE_PIXELS: u64 = 1 << 28;pub(crate) struct Renderer {pub(crate) ctx: RenderContext,@@ -77,7 +77,7 @@ impl Renderer {line_width *= threshold;}- // PrintCraft patch: a stroke far wider than the canvas looks the same as one a few canvases+ // PdfCraft patch: a stroke far wider than the canvas looks the same as one a few canvases// wide, but its geometry grows with the width: a fuzzed `/LW 9223372036854775807`// allocated 10 GB in stroke expansion.let widest = 4.0 * (f32::from(self.ctx.width()) + f32::from(self.ctx.height()));@@ -224,7 +224,7 @@ impl Renderer {};let mut img_width = image_data.width();let mut img_height = image_data.height();- // PrintCraft patch: skip images with absurd dimensions (a fuzzed inline image claimed+ // PdfCraft patch: skip images with absurd dimensions (a fuzzed inline image claimed// /W 4294967295 over four bytes of data; resampling it never finished).if img_width == 0 || img_height == 0 || u64::from(img_width) * u64::from(img_height) > MAX_IMAGE_PIXELS {return;@@ -518,7 +518,7 @@ impl Renderer {};xs = xs.max(min_x_scale).min(max_x_scale);ys = ys.max(min_y_scale).min(max_y_scale);- // PrintCraft patch: the cell pixmap is `step × scale` pixels, which only the+ // PdfCraft patch: the cell pixmap is `step × scale` pixels, which only the// u16 cast below bounded (a fuzzed /XStep far beyond /BBox gave 65535² cells).xs = tiling_cell_scale(xs, t.x_step, MAX_PIXMAP_SIZE);ys = tiling_cell_scale(ys, t.y_step, MAX_PIXMAP_SIZE);@@ -1160,7 +1160,7 @@ fn convert_blend_mode(blend_mode: BlendMode) -> peniko::BlendMode {peniko::BlendMode::new(mix, Compose::SrcOver)}-/// PrintCraft patch: the scale for a tiling cell, lowered so that the cell pixmap (`|step| ×+/// PdfCraft patch: the scale for a tiling cell, lowered so that the cell pixmap (`|step| ×/// scale` pixels a side) stays within `max_pixels`. Geometry is unchanged (the pattern transform/// is derived from the scale); an over-large step only renders at lower resolution.pub fn tiling_cell_scale(scale: f32, step: f32, max_pixels: f32) -> f32 {diff --git a/vendor/lopdf/src/filters/png.rs b/vendor/lopdf/src/filters/png.rsindex 7ffced185..e9390799c 100644--- a/vendor/lopdf/src/filters/png.rs+++ b/vendor/lopdf/src/filters/png.rs@@ -86,7 +86,7 @@ pub fn decode_row(filter: FilterType, bpp: usize, previous: &[u8], current: &mut}pub fn decode_frame(content: &[u8], bpp: usize, bytes_per_row: usize) -> Result<Vec<u8>> {- // PrintCraft patch: each row is a filter byte plus `bytes_per_row` bytes, so a row longer+ // PdfCraft patch: each row is a filter byte plus `bytes_per_row` bytes, so a row longer// than the data can never be read (`read_exact` below fails). Refuse it before allocating:// a fuzzed `/Columns 4294967295` allocated two 4 GiB rows here.if !content.is_empty() && bytes_per_row >= content.len() {diff --git a/vendor/lopdf/src/object.rs b/vendor/lopdf/src/object.rsindex 3fdacf59f..843d80ace 100644--- a/vendor/lopdf/src/object.rs+++ b/vendor/lopdf/src/object.rs@@ -1234,7 +1234,7 @@ impl Stream {let columns = max(1, params.get(b"Columns").and_then(Object::as_i64).unwrap_or(1)) as usize;let colors = max(1, params.get(b"Colors").and_then(Object::as_i64).unwrap_or(1)) as usize;let bits = max(1, params.get(b"BitsPerComponent").and_then(Object::as_i64).unwrap_or(8)) as usize;- // PrintCraft patch: saturating, so absurd parameters cannot overflow.+ // PdfCraft patch: saturating, so absurd parameters cannot overflow.let bytes_per_row = columns.saturating_mul(colors).saturating_mul(bits).div_ceil(8);let bpp = colors.saturating_mul(bits).div_ceil(8);data = png::decode_frame(data.as_slice(), bpp, bytes_per_row)?;@@ -1254,7 +1254,7 @@ impl Stream {fn reverse_tiff_predictor2(mut data: Vec<u8>, columns: usize, colors: usize, bits: usize) -> Result<Vec<u8>> {match bits {8 => {- let stride = columns.saturating_mul(colors); // PrintCraft patch: saturating+ let stride = columns.saturating_mul(colors); // PdfCraft patch: saturatingif stride > 0 {for row in data.chunks_mut(stride) {for i in colors..row.len() {@@ -1264,7 +1264,7 @@ impl Stream {}}16 => {- let stride = columns.saturating_mul(colors).saturating_mul(2); // PrintCraft patch: saturating+ let stride = columns.saturating_mul(colors).saturating_mul(2); // PdfCraft patch: saturatingif stride > 0 {for row in data.chunks_mut(stride) {let samples = row.len() / 2;@@ -1299,7 +1299,7 @@ impl Stream {/// `2^bits`, then repacked MSB-first; the row's trailing padding bits are kept.fn reverse_tiff_predictor2_subbyte(row: &mut [u8], columns: usize, colors: usize, bits: usize) {let mask = (1u16 << bits) - 1;- let samples = columns.saturating_mul(colors).min(row.len() * 8 / bits); // PrintCraft patch: saturating+ let samples = columns.saturating_mul(colors).min(row.len() * 8 / bits); // PdfCraft patch: saturatinglet mut acc = vec![0u16; colors];let mut out = vec![0u8; row.len()];let mut in_bit = 0usize;diff --git a/xtask/src/assets.rs b/xtask/src/assets.rsindex 1b35bbe77..36ef6ac90 100644--- a/xtask/src/assets.rs+++ b/xtask/src/assets.rs@@ -1,7 +1,7 @@//! `cargo xtask assets`: enforce the asset policy (AGENTS.md §1).//!//! `ATTRIBUTION.toml` lists every asset: committed or vendored files (`[[asset]]`), files that-//! Cargo dependencies compile into PrintCraft (`[[bundled]]`), and files xtask downloads at build+//! Cargo dependencies compile into PdfCraft (`[[bundled]]`), and files xtask downloads at build//! time (`[[fetched]]`). This gate fails when://! - an asset-like file in the repository has no entry, or its SHA-256 differs;//! - a licence is not on the allowlist, or a declared licence file is missing;@@ -350,7 +350,7 @@ pub fn render_markdown(m: &Manifest) -> String {let mut s = String::new();s.push_str("# Attribution\n\n");s.push_str("<!-- Generated from ATTRIBUTION.toml by `cargo xtask assets --write`. Do not edit by hand. -->\n\n");- s.push_str("Every asset PrintCraft includes, bundles or uses to build its published material, with its author, source and licence. ");+ s.push_str("Every asset PdfCraft includes, bundles or uses to build its published material, with its author, source and licence. ");s.push_str("The policy is in [AGENTS.md](AGENTS.md) §1. The machine-readable list, with SHA-256 hashes, is [ATTRIBUTION.toml](ATTRIBUTION.toml). ",);diff --git a/xtask/src/demo_pdf/annots.rs b/xtask/src/demo_pdf/annots.rsindex 3b9595078..d7c728310 100644--- a/xtask/src/demo_pdf/annots.rs+++ b/xtask/src/demo_pdf/annots.rs@@ -81,7 +81,7 @@ impl Kind {}}-const AUTHOR: &str = "PrintCraft Reviewer";+const AUTHOR: &str = "PdfCraft Reviewer";const AUTHOR_2: &str = "Layout Editor";/// Builds annotation dictionaries (and their appearance XObjects) for one document.@@ -119,7 +119,7 @@ impl Annotator {"Subj" => text(subtype),"M" => Object::string_literal(when.pdf.clone()),"CreationDate" => Object::string_literal(when.pdf),- "NM" => Object::string_literal(format!("printcraft-showcase-{:03}-{}", self.seq, subtype.to_lowercase())),+ "NM" => Object::string_literal(format!("pdfcraft-showcase-{:03}-{}", self.seq, subtype.to_lowercase())),}}@@ -269,7 +269,7 @@ impl Annotator {reply.set("AP", dictionary! { "N" => icon });let reply_id = doc.add_object(reply);- let mut state = self.base("Text", r, colors::TEAL, AUTHOR, "Accepted set by PrintCraft Reviewer", page);+ let mut state = self.base("Text", r, colors::TEAL, AUTHOR, "Accepted set by PdfCraft Reviewer", page);state.set("F", 30); // hidden: review-state annotations are shown only in the comments liststate.set("Name", "Comment");state.set("IRT", self_id);@@ -463,7 +463,7 @@ impl Annotator {fn stamp(&mut self, doc: &mut Document, page: ObjectId, r: Rect) -> Dictionary {let green = Rgb::hex(0x1d7f4e);let mut dict = self.base("Stamp", r, green, AUTHOR, "Approved for the showcase.", page);- dict.set("Name", "PrintCraftApproved");+ dict.set("Name", "PdfCraftApproved");dict.set("CA", 0.92);let (w, h) = (r.w(), r.h());let mut c = Content::new();@@ -479,7 +479,7 @@ impl Annotator {let size = 22.0;let tw = Font::HelvBold.width(title, size) + 3.0 * (title.len() as f32 - 1.0);c.tracked_text(Font::HelvBold, size, (w - tw) / 2.0, h * 0.42, 3.0, title);- let date = format!("PRINTCRAFT QA \u{2022} {}", &self.now.iso[..10]);+ let date = format!("PDFCRAFT QA \u{2022} {}", &self.now.iso[..10]);let dw = Font::Helv.width(&date, 7.0) + 1.0 * (date.chars().count() as f32 - 1.0);c.tracked_text(Font::Helv, 7.0, (w - dw) / 2.0, h * 0.2, 1.0, &date);let res = self.fonts.resources();@@ -488,7 +488,7 @@ impl Annotator {}fn attachment(&mut self, doc: &mut Document, page: ObjectId, r: Rect) -> Dictionary {- let note = "Review notes for the PrintCraft showcase.\n\n\+ let note = "Review notes for the PdfCraft showcase.\n\n\- Page 9 exercises every common annotation type.\n\- Each annotation carries its own appearance stream.\n";let fs = embedded_file(doc, "review-notes.txt", "text/plain", note.as_bytes(), "Notes attached to a comment", &self.now);diff --git a/xtask/src/demo_pdf/chrome.rs b/xtask/src/demo_pdf/chrome.rsindex 89cdd671b..f1a86da17 100644--- a/xtask/src/demo_pdf/chrome.rs+++ b/xtask/src/demo_pdf/chrome.rs@@ -11,7 +11,7 @@ use std::time::{Duration, Instant};use anyhow::{Context, Result, bail};/// Find a Chrome/Chromium binary. `explicit` (from `--chrome`) wins, then the-/// `PRINTCRAFT_CHROME` / `CHROME` environment variables, then well-known+/// `PDFCRAFT_CHROME` / `CHROME` environment variables, then well-known/// install locations, then `PATH`.pub fn find(explicit: Option<&Path>) -> Result<PathBuf> {if let Some(path) = explicit {@@ -20,7 +20,7 @@ pub fn find(explicit: Option<&Path>) -> Result<PathBuf> {}bail!("--chrome {} does not exist", path.display());}- for var in ["PRINTCRAFT_CHROME", "CHROME"] {+ for var in ["PDFCRAFT_CHROME", "CHROME"] {if let Some(path) = env::var_os(var).map(PathBuf::from)&& path.is_file(){@@ -63,7 +63,7 @@ pub fn find(explicit: Option<&Path>) -> Result<PathBuf> {}bail!("could not find Google Chrome or Chromium; install one or pass --chrome <path> \- (or set PRINTCRAFT_CHROME)"+ (or set PDFCRAFT_CHROME)")}diff --git a/xtask/src/demo_pdf/form.rs b/xtask/src/demo_pdf/form.rsindex e1f34d91c..e4d782bc0 100644--- a/xtask/src/demo_pdf/form.rs+++ b/xtask/src/demo_pdf/form.rs@@ -63,7 +63,7 @@ pub fn build(doc: &mut Document, annotator: &mut Annotator, inputs: FormInputs<'});label(&mut c, LEFT, 510.0, "Comments (multiline)");- let comments = "PrintCraft renders this field from its own appearance stream, so it looks \+ let comments = "PdfCraft renders this field from its own appearance stream, so it looks \the same in every viewer. Edit it to see your viewer regenerate the text.";b.text_field("comments", "Comments", Rect::new(LEFT, 446.0, RIGHT, 506.0), comments, None, 0, |d| {d.set("Ff", 4096);@@ -101,7 +101,7 @@ pub fn build(doc: &mut Document, annotator: &mut Annotator, inputs: FormInputs<'"hello","Run JavaScript: app.alert",Rect::new(LEFT, 184.0, 250.0, 206.0),- "app.alert(\"Hello from the PrintCraft showcase! This alert is a JavaScript action on a push button.\", 3);",+ "app.alert(\"Hello from the PdfCraft showcase! This alert is a JavaScript action on a push button.\", 3);",);c.fill_color(colors::INK_3).text(Font::Helv, 7.0, LEFT, 172.0, "JavaScript: shows app.alert(...) in viewers that run document scripts.");label(&mut c, COL2, 212.0, "Signature (unsigned /Sig field)");@@ -166,7 +166,7 @@ pub fn build(doc: &mut Document, annotator: &mut Annotator, inputs: FormInputs<'fn draw_page_chrome(c: &mut Content, folio: &str) {c.fill_color(colors::PAPER).rect(0.0, 0.0, PAGE_W, PAGE_H).fill();c.fill_color(colors::INK_3);- c.tracked_text(Font::Helv, 6.5, LEFT, 757.0, 1.2, "PRINTCRAFT SHOWCASE");+ c.tracked_text(Font::Helv, 6.5, LEFT, 757.0, 1.2, "PDFCRAFT SHOWCASE");let right = "10 \u{00b7} INTERACTIVE FORM";let w = Font::Helv.width(right, 6.5) + 1.2 * (right.chars().count() as f32 - 1.0);c.tracked_text(Font::Helv, 6.5, RIGHT - w, 757.0, 1.2, right);diff --git a/xtask/src/demo_pdf/mod.rs b/xtask/src/demo_pdf/mod.rsindex 3354af121..9a21690a7 100644--- a/xtask/src/demo_pdf/mod.rs+++ b/xtask/src/demo_pdf/mod.rs@@ -1,4 +1,4 @@-//! `cargo xtask demo-pdf`: build the PrintCraft showcase PDF.+//! `cargo xtask demo-pdf`: build the PdfCraft showcase PDF.//!//! 1. Render a procedural PNG and fill the placeholders in `assets/demo/showcase.html`.//! 2. Print the HTML with headless Chrome (tagged PDF, outline from headings).@@ -36,7 +36,7 @@ pub fn run(args: &[String]) -> Result<()> {}let root = repo_root();- let out = out_override.unwrap_or_else(|| root.join("dist/demo/printcraft-showcase.pdf"));+ let out = out_override.unwrap_or_else(|| root.join("dist/demo/pdfcraft-showcase.pdf"));let build = root.join("dist/demo/build");fs::create_dir_all(&build).with_context(|| format!("creating {}", build.display()))?;if let Some(parent) = out.parent() {diff --git a/xtask/src/demo_pdf/postprocess.rs b/xtask/src/demo_pdf/postprocess.rsindex e122fa642..312ff1bda 100644--- a/xtask/src/demo_pdf/postprocess.rs+++ b/xtask/src/demo_pdf/postprocess.rs@@ -8,14 +8,14 @@ use super::form::{self, FormInputs};use super::pdf::{Content, Font, Fonts, Stamp, colors, name, text};/// Links to this prefix in showcase.html mark where annotations go.-const MARKER_PREFIX: &str = "https://mark.printcraft.invalid/";+const MARKER_PREFIX: &str = "https://mark.pdfcraft.invalid/";-const TITLE: &str = "PrintCraft Showcase";-const AUTHOR: &str = "PrintCraft";+const TITLE: &str = "PdfCraft Showcase";+const AUTHOR: &str = "PdfCraft";const SUBJECT: &str = "A specimen document exercising typography, world scripts, vector graphics, \MathML, forms, annotations, layers and attachments.";-const KEYWORDS: &[&str] = &["PDF", "typography", "OpenType", "AcroForm", "annotations", "optional content", "PrintCraft"];-const CREATOR: &str = "printcraft xtask demo-pdf";+const KEYWORDS: &[&str] = &["PDF", "typography", "OpenType", "AcroForm", "annotations", "optional content", "PdfCraft"];+const CREATOR: &str = "pdfcraft xtask demo-pdf";/// Chrome-printed page indices (0-based) that the post-processor refers to.const PAGE_CONTENTS: usize = 1;@@ -376,7 +376,7 @@ fn decode_text(bytes: &[u8]) -> String {fn tidy_title(title: &str) -> String {const ACRONYMS: &[&str] = &["PDF"];// Chrome drops the <br> between the two lines of the cover title.- if title == "PrintCraftShowcase" {+ if title == "PdfCraftShowcase" {return TITLE.to_string();}let title = title.split_whitespace().collect::<Vec<_>>().join(" ");@@ -477,7 +477,7 @@ fn producer(doc: &Document) -> String {.and_then(Object::as_str).map(|s| String::from_utf8_lossy(s).into_owned()).unwrap_or_else(|_| "Chrome".into());- format!("{chrome}; lopdf 0.45 via printcraft xtask")+ format!("{chrome}; lopdf 0.45 via pdfcraft xtask")}fn info_dict(producer: &str, now: &Stamp) -> Dictionary {diff --git a/xtask/src/fuzz.rs b/xtask/src/fuzz.rsindex c8a328298..96cb976c8 100644--- a/xtask/src/fuzz.rs+++ b/xtask/src/fuzz.rs@@ -2,7 +2,7 @@//!//! Seeds are small PDFs (synthetic ones, plus pdf.js corpus files under 64 KB when `corpus/` is//! present). Each iteration mutates a seed, writes it to `fuzz-out/work/`, and runs-//! `printcraft-cli check-one <file> --edit` in a child process with a timeout. That opens,+//! `pdfcraft-cli check-one <file> --edit` in a child process with a timeout. That opens,//! inspects, renders and extracts text from every page (the bootstrap renderer), then runs our//! object layer end to end: decode streams, edit, save incrementally and in full, reopen.//!@@ -330,10 +330,10 @@ pub fn run(args: &[String]) -> Result<()> {let status = Command::new(std::env::var("CARGO").unwrap_or_else(|_| "cargo".into())).current_dir(root())- .args(["build", "--release", "-q", "-p", "printcraft-cli"])+ .args(["build", "--release", "-q", "-p", "pdfcraft-cli"]).status()?;if !status.success() {- bail!("building printcraft-cli failed");+ bail!("building pdfcraft-cli failed");}let exe = release_cli();if !exe.is_file() {diff --git a/xtask/src/gates.rs b/xtask/src/gates.rsindex 9a8ae223b..906750399 100644--- a/xtask/src/gates.rs+++ b/xtask/src/gates.rs@@ -18,9 +18,9 @@ pub fn target_dir() -> PathBuf {std::env::var_os("CARGO_TARGET_DIR").map_or_else(|| root().join("target"), |d| root().join(d))}-/// The release `printcraft-cli` that `cargo build --release -p printcraft-cli` produced.+/// The release `pdfcraft-cli` that `cargo build --release -p pdfcraft-cli` produced.pub fn release_cli() -> PathBuf {- target_dir().join("release").join(format!("printcraft-cli{}", std::env::consts::EXE_SUFFIX))+ target_dir().join("release").join(format!("pdfcraft-cli{}", std::env::consts::EXE_SUFFIX))}fn cargo() -> Command {@@ -157,7 +157,7 @@ pub fn corpus(_: &[String]) -> anyhow::Result<()> {Ok(())}-/// `cargo xtask check [--update-baseline]`: run `printcraft-cli check` over the corpus and compare+/// `cargo xtask check [--update-baseline]`: run `pdfcraft-cli check` over the corpus and compare/// with `xtask/baselines/<corpus>.json` (the list of files known not to open/render cleanly)./// Fails on any crash, and on any file that regressed from `ok`.pub fn check(args: &[String]) -> anyhow::Result<()> {@@ -166,11 +166,11 @@ pub fn check(args: &[String]) -> anyhow::Result<()> {if !corpus.is_dir() {bail!("corpus missing: run `cargo xtask corpus` first");}- run_args(&["build", "--release", "-p", "printcraft-cli"])?;+ run_args(&["build", "--release", "-p", "pdfcraft-cli"])?;let report = target_dir().join("check-pdfjs.json");let mut c = Command::new(release_cli());c.args(["check"]).arg(&corpus).args(["--timeout", "20", "--dpi", "36", "--json"]).arg(&report);- run(c, "printcraft-cli check corpus/pdfjs")?;+ run(c, "pdfcraft-cli check corpus/pdfjs")?;let results: Vec<serde_json::Value> = serde_json::from_str(&std::fs::read_to_string(&report)?)?;let name =|v: &serde_json::Value| Path::new(v["file"].as_str().unwrap_or("")).file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();@@ -208,7 +208,7 @@ pub fn check(args: &[String]) -> anyhow::Result<()> {Ok(())}-/// `cargo xtask text-oracle [--limit N]`: compare `printcraft-cli text` with poppler's `pdftotext`+/// `cargo xtask text-oracle [--limit N]`: compare `pdfcraft-cli text` with poppler's `pdftotext`/// (external oracle process, never linked) over the corpus. Reports word-level F1 per file and the/// median. Plan target (M2): median ≥ 0.97.pub fn text_oracle(args: &[String]) -> anyhow::Result<()> {@@ -216,7 +216,7 @@ pub fn text_oracle(args: &[String]) -> anyhow::Result<()> {if Command::new("pdftotext").arg("-v").output().is_err() {bail!("pdftotext (poppler) not found; install it to run the text oracle (brew install poppler / apt install poppler-utils)");}- run_args(&["build", "--release", "-p", "printcraft-cli"])?;+ run_args(&["build", "--release", "-p", "pdfcraft-cli"])?;let corpus = root().join("corpus/pdfjs/test/pdfs");let mut files: Vec<PathBuf> =std::fs::read_dir(&corpus)?.flatten().map(|e| e.path()).filter(|p| p.extension().is_some_and(|e| e == "pdf")).collect();diff --git a/xtask/src/layers.rs b/xtask/src/layers.rsindex a999f377a..d66f08d44 100644--- a/xtask/src/layers.rs+++ b/xtask/src/layers.rs@@ -27,7 +27,7 @@ impl Class {}}-/// Every workspace crate (package name without the `printcraft-` prefix) and its layer.+/// Every workspace crate (package name without the `pdfcraft-` prefix) and its layer.pub const TABLE: &[(&str, Class)] = &[// L0 foundation (standalone, publishable)("geom", Class::Standalone(0)),@@ -84,7 +84,7 @@ pub const TABLE: &[(&str, Class)] = &[("testkit", Class::Testkit),("oracle", Class::Testkit),// L8 apps + tooling- ("printcraft", Class::Exempt),+ ("pdfcraft", Class::Exempt),("cli", Class::Exempt),("web", Class::Exempt),("xtask", Class::Exempt),@@ -110,7 +110,7 @@ pub const UI_CRATES: &[&str] = &["egui", "eframe", "winit", "egui_kittest", "egupub const UI_MIN_LAYER: u8 = 7;pub fn short_name(pkg: &str) -> &str {- pkg.strip_prefix("printcraft-").unwrap_or(pkg)+ pkg.strip_prefix("pdfcraft-").unwrap_or(pkg)}pub fn classify(pkg: &str) -> Option<Class> {@@ -271,67 +271,67 @@ mod tests {#[test]fn current_graph_shape_passes() {let g = [- c("printcraft-geom", &[]),- c("printcraft-render", &[("hayro", Normal, false), ("lopdf", Normal, false)]),- c("printcraft-engine", &[("printcraft-render", Normal, true)]),- c("printcraft-ui-egui", &[("printcraft-engine", Normal, true), ("egui", Normal, false), ("egui_kittest", Dev, false)]),- c("printcraft", &[("printcraft-ui-egui", Normal, true)]),+ c("pdfcraft-geom", &[]),+ c("pdfcraft-render", &[("hayro", Normal, false), ("lopdf", Normal, false)]),+ c("pdfcraft-engine", &[("pdfcraft-render", Normal, true)]),+ c("pdfcraft-ui-egui", &[("pdfcraft-engine", Normal, true), ("egui", Normal, false), ("egui_kittest", Dev, false)]),+ c("pdfcraft", &[("pdfcraft-ui-egui", Normal, true)]),];assert!(check(&g).is_empty(), "{:?}", check(&g));}#[test]fn upward_and_sideways_edges_flagged() {- let v = check(&[c("printcraft-model", &[("printcraft-engine", Normal, true)])]);+ let v = check(&[c("pdfcraft-model", &[("pdfcraft-engine", Normal, true)])]);assert!(matches!(v[..], [Violation::Upward { from: 2, to: 6, .. }]));// forms -> js must go through the ActionRunner trait, never directly.- let v = check(&[c("printcraft-forms", &[("printcraft-js", Normal, true)])]);+ let v = check(&[c("pdfcraft-forms", &[("pdfcraft-js", Normal, true)])]);assert!(matches!(v[..], [Violation::Upward { from: 3, to: 3, .. }]));}#[test]fn listed_sideways_edges_allowed() {- assert!(check(&[c("printcraft-redact", &[("printcraft-edit", Normal, true)])]).is_empty());- assert!(!check(&[c("printcraft-edit", &[("printcraft-redact", Normal, true)])]).is_empty());+ assert!(check(&[c("pdfcraft-redact", &[("pdfcraft-edit", Normal, true)])]).is_empty());+ assert!(!check(&[c("pdfcraft-edit", &[("pdfcraft-redact", Normal, true)])]).is_empty());}#[test]fn cos_may_use_only_its_listed_foundation() {- assert!(check(&[c("printcraft-cos", &[("printcraft-filters", Normal, true), ("printcraft-crypt", Normal, true)])]).is_empty());- let v = check(&[c("printcraft-cos", &[("printcraft-arlington", Normal, true)])]);+ assert!(check(&[c("pdfcraft-cos", &[("pdfcraft-filters", Normal, true), ("pdfcraft-crypt", Normal, true)])]).is_empty());+ let v = check(&[c("pdfcraft-cos", &[("pdfcraft-arlington", Normal, true)])]);assert!(matches!(v[..], [Violation::StandaloneHasWorkspaceDep { .. }]));- let v = check(&[c("printcraft-filters", &[("printcraft-geom", Normal, true)])]);+ let v = check(&[c("pdfcraft-filters", &[("pdfcraft-geom", Normal, true)])]);assert!(matches!(v[..], [Violation::StandaloneHasWorkspaceDep { .. }]));}#[test]fn ui_crates_below_l7_flagged() {for dep in ["egui", "eframe", "winit", "rfd", "wgpu", "wgpu-core", "egui_dock"] {- let v = check(&[c("printcraft-engine", &[(dep, Normal, false)])]);+ let v = check(&[c("pdfcraft-engine", &[(dep, Normal, false)])]);assert!(matches!(v[..], [Violation::UiBelowL7 { layer: 6, .. }]), "{dep}");}- assert!(check(&[c("printcraft-platform", &[("winit", Normal, false)])]).is_empty());+ assert!(check(&[c("pdfcraft-platform", &[("winit", Normal, false)])]).is_empty());}#[test]fn test_support_only_as_dev_dependency() {- let v = check(&[c("printcraft-cos", &[("printcraft-testkit", Normal, true)])]);+ let v = check(&[c("pdfcraft-cos", &[("pdfcraft-testkit", Normal, true)])]);assert!(!v.is_empty());- assert!(check(&[c("printcraft-render", &[("printcraft-oracle", Dev, true)])]).is_empty());- let v = check(&[c("printcraft-render", &[("printcraft-oracle", Normal, true)])]);+ assert!(check(&[c("pdfcraft-render", &[("pdfcraft-oracle", Dev, true)])]).is_empty());+ let v = check(&[c("pdfcraft-render", &[("pdfcraft-oracle", Normal, true)])]);assert!(matches!(v[..], [Violation::TestkitAsNormalDep { .. }]));}#[test]fn unregistered_crate_is_error() {- let v = check(&[c("printcraft-mystery", &[])]);- assert!(matches!(&v[..], [Violation::Unregistered { krate }] if krate == "printcraft-mystery"));+ let v = check(&[c("pdfcraft-mystery", &[])]);+ assert!(matches!(&v[..], [Violation::Unregistered { krate }] if krate == "pdfcraft-mystery"));}#[test]fn apps_exempt() {- for app in ["printcraft", "printcraft-cli", "printcraft-web", "xtask"] {- assert!(check(&[c(app, &[("egui", Normal, false), ("printcraft-ui-egui", Normal, true)])]).is_empty());+ for app in ["pdfcraft", "pdfcraft-cli", "pdfcraft-web", "xtask"] {+ assert!(check(&[c(app, &[("egui", Normal, false), ("pdfcraft-ui-egui", Normal, true)])]).is_empty());}}}diff --git a/xtask/src/main.rs b/xtask/src/main.rsindex a1139dbcf..a4cb634b8 100644--- a/xtask/src/main.rs+++ b/xtask/src/main.rs@@ -1,4 +1,4 @@-//! Project automation for PrintCraft, run via `cargo xtask <command>`.+//! Project automation for PdfCraft, run via `cargo xtask <command>`.use std::process::ExitCode;@@ -22,13 +22,13 @@ const COMMANDS: &[(&str, &str, Command)] = &[("ci", "fmt --check, clippy -D warnings, test, layers, wasm, assets, deny, parity (stops at first failure)", gates::ci),("assets", "Enforce the asset policy (AGENTS.md §1) against ATTRIBUTION.toml; --write regenerates ATTRIBUTION.md", assets::run),("corpus", "Fetch test corpora into corpus/ (git-ignored): pdf.js test PDFs", gates::corpus),- ("check", "Robustness sweep over corpus/ with printcraft-cli; fails on crashes or regressions vs xtask/baselines", gates::check),+ ("check", "Robustness sweep over corpus/ with pdfcraft-cli; fails on crashes or regressions vs xtask/baselines", gates::check),("fuzz", "Mutation fuzzing of open/render/edit/save in child processes; findings in fuzz-out/ (--time 300)", fuzz::run),("parity", "Validate parity/acrobat-features.toml against the registry, tools and tests; report progress (--json, --partial)", parity::run),("text-oracle", "Compare text extraction with pdftotext over corpus/ (word F1; target median ≥ 0.97)", gates::text_oracle),("screenshots", "Regenerate the README screenshots in docs/images/ and their ATTRIBUTION entries", screenshots::run),("models", "Fetch the OCR models (ATTRIBUTION.toml kind = \"model\") into assets/models/, verified by SHA-256", assets::models),- ("demo-pdf", "Build dist/demo/printcraft-showcase.pdf (needs Google Chrome or Chromium)", demo_pdf::run),+ ("demo-pdf", "Build dist/demo/pdfcraft-showcase.pdf (needs Google Chrome or Chromium)", demo_pdf::run),];fn version_cmd(args: &[String]) -> anyhow::Result<()> {diff --git a/xtask/src/screenshots.rs b/xtask/src/screenshots.rsindex d19aadbb5..28c175bdf 100644--- a/xtask/src/screenshots.rs+++ b/xtask/src/screenshots.rs@@ -16,37 +16,32 @@ use anyhow::{Context, Result, bail};/// (file stem, title, what it shows, shot arguments after the PDF path).pub const SCENES: &[(&str, &str, &str, &[&str])] = &[- ("printcraft-viewer", "Viewer with comments", "README hero", &["--panel", "comments", "--zoom", "72"]),+ ("pdfcraft-viewer", "Viewer with comments", "README hero", &["--panel", "comments", "--zoom", "72"]),+ ("pdfcraft-dark", "Dark theme", "README: themes", &["--theme", "dark", "--panel", "comments", "--page", "11", "--zoom", "80", "--notice", "off"]),+ ("pdfcraft-organize", "Organize pages", "README: organize", &["--organize", "on", "--panel", "none", "--select", "5,6,7"]),+ ("pdfcraft-find", "Find text", "README: search", &["--find", "type", "--page", "4", "--zoom", "90", "--panel", "none", "--notice", "off"]),+ ("pdfcraft-bookmarks", "Bookmarks", "README: navigation", &["--panel", "bookmarks", "--page", "7", "--zoom", "75", "--notice", "off"]),+ ("pdfcraft-forms", "Interactive form", "README: forms", &["--page", "13", "--fields", "on", "--zoom", "80", "--panel", "fields"]),+ ("pdfcraft-layers", "Layers", "README: layers", &["--panel", "layers", "--page", "12", "--zoom", "75", "--notice", "off"]),(- "printcraft-dark",- "Dark theme",- "README: themes",- &["--theme", "dark", "--panel", "comments", "--page", "11", "--zoom", "80", "--notice", "off"],- ),- ("printcraft-organize", "Organize pages", "README: organize", &["--organize", "on", "--panel", "none", "--select", "5,6,7"]),- ("printcraft-find", "Find text", "README: search", &["--find", "type", "--page", "4", "--zoom", "90", "--panel", "none", "--notice", "off"]),- ("printcraft-bookmarks", "Bookmarks", "README: navigation", &["--panel", "bookmarks", "--page", "7", "--zoom", "75", "--notice", "off"]),- ("printcraft-forms", "Interactive form", "README: forms", &["--page", "13", "--fields", "on", "--zoom", "80", "--panel", "fields"]),- ("printcraft-layers", "Layers", "README: layers", &["--panel", "layers", "--page", "12", "--zoom", "75", "--notice", "off"]),- (- "printcraft-scripts",+ "pdfcraft-scripts","Scripts of the world","README: rendering",&["--page", "7", "--zoom", "125", "--left", "closed", "--panel", "none", "--notice", "off"],),- ("printcraft-properties", "Document properties", "README: metadata", &["--dialog", "properties", "--notice", "off"]),- ("printcraft-palette", "Command palette", "README: tools", &["--palette", "page", "--notice", "off"]),- ("printcraft-split", "Split dialog", "README: split", &["--organize", "on", "--panel", "none", "--dialog", "split", "--notice", "off"]),- ("printcraft-tools", "All tools", "README: tool catalogue", &["--tools", "expanded", "--home", "on"]),+ ("pdfcraft-properties", "Document properties", "README: metadata", &["--dialog", "properties", "--notice", "off"]),+ ("pdfcraft-palette", "Command palette", "README: tools", &["--palette", "page", "--notice", "off"]),+ ("pdfcraft-split", "Split dialog", "README: split", &["--organize", "on", "--panel", "none", "--dialog", "split", "--notice", "off"]),+ ("pdfcraft-tools", "All tools", "README: tool catalogue", &["--tools", "expanded", "--home", "on"]),(- "printcraft-twoup",+ "pdfcraft-twoup","Two-up reading","README: layouts",&["--layout", "two-up", "--mode", "read", "--page", "4", "--theme", "dark", "--notice", "off"],),];-const PDF: &str = "dist/demo/printcraft-showcase.pdf";+const PDF: &str = "dist/demo/pdfcraft-showcase.pdf";pub fn run(args: &[String]) -> Result<()> {let root = crate::assets::root();@@ -55,7 +50,7 @@ pub fn run(args: &[String]) -> Result<()> {crate::demo_pdf::run(&[])?;}let status = Command::new(env!("CARGO"))- .args(["build", "--release", "-p", "printcraft-ui-egui", "--example", "shot"])+ .args(["build", "--release", "-p", "pdfcraft-ui-egui", "--example", "shot"]).current_dir(&root).status().context("building the shot example")?;@@ -108,18 +103,18 @@ fn update_attribution(root: &Path) -> Result<()> {for file in images.iter().filter(|f| f.ends_with(".png")) {let stem = file.trim_end_matches(".png");let scene = SCENES.iter().find(|(n, ..)| *n == stem);- let (title, usage) = scene.map(|(_, t, u, _)| (*t, *u)).unwrap_or(("PrintCraft screenshot", "README"));+ let (title, usage) = scene.map(|(_, t, u, _)| (*t, *u)).unwrap_or(("PdfCraft screenshot", "README"));// The home screen shows the ArtCraft mark: say so (it is a Storyteller trademark, not open// source; AGENTS.md §1.2), so the screenshot's licence is not read as covering it.let shows_home = scene.is_some_and(|(.., args)| args.windows(2).any(|w| w[0] == "--home" && w[1] == "on"));let contents = if shows_home {- "Shows PrintCraft UI, Lucide icons, the showcase PDF built from the [[fetched]] OFL fonts, and the ArtCraft mark (Storyteller trademark from docs/brand/, not covered by this licence)"+ "Shows PdfCraft UI, Lucide icons, the showcase PDF built from the [[fetched]] OFL fonts, and the ArtCraft mark (Storyteller trademark from docs/brand/, not covered by this licence)"} else {- "Shows only PrintCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"+ "Shows only PdfCraft UI, Lucide icons and the showcase PDF built from the [[fetched]] OFL fonts"};let bytes = std::fs::read(root.join("docs/images").join(file))?;out.push_str(&format!(- "\n[[asset]]\npath = \"docs/images/{file}\"\ntitle = \"PrintCraft screenshot: {title}\"\nauthor = \"PrintCraft contributors (generated by `cargo xtask screenshots`)\"\nsource = \"this repository\"\nlicence = \"MIT OR Apache-2.0\"\nlicence_file = \"LICENSE-MIT\"\nkind = \"image\"\nusage = \"{usage}. {contents}\"\nsha256 = \"{}\"\n",+ "\n[[asset]]\npath = \"docs/images/{file}\"\ntitle = \"PdfCraft screenshot: {title}\"\nauthor = \"PdfCraft contributors (generated by `cargo xtask screenshots`)\"\nsource = \"this repository\"\nlicence = \"MIT OR Apache-2.0\"\nlicence_file = \"LICENSE-MIT\"\nkind = \"image\"\nusage = \"{usage}. {contents}\"\nsha256 = \"{}\"\n",crate::assets::sha256_hex(&bytes)));}