PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
M14: give Windows PDF files a dedicated document icon (#890)
Joe Abou Serhal892f0b78f09e
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.mdindex 12a860e9d..28bd17c7c 100644--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@ -4,7 +4,7 @@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 (262)+## In this repository (264)| Asset | Title | Author | Licence | Source | Used for ||---|---|---|---|---|---|@@ -232,6 +232,8 @@ Every asset PdfCraft includes, bundles or uses to build its published material,| `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/pdfcraft-document.svg` | PdfCraft PDF document icon (master vector) | Lucide Icons and Contributors (document outline); PdfCraft contributors (PDF badge, lettering and composition) | ISC AND (MIT OR Apache-2.0) | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/file-text.svg); contributor-original composition (assets/app-icon/README.md) | Master artwork for the Windows PDF file type icon; rendered by packaging/icons.sh, without fonts or external images |+| `assets/app-icon/pdfcraft-document.ico` | PdfCraft PDF document icon (Windows .ico, 16-256 px) | Lucide Icons and Contributors (document outline); PdfCraft contributors (PDF badge, lettering and composition) | ISC AND (MIT OR Apache-2.0) | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/file-text.svg); contributor-original composition (assets/app-icon/README.md) | Embedded in pdfcraft.exe as resource 2; the Windows installer uses it for PdfCraft.Document and Applications/pdfcraft.exe PDF file associations || `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) |diff --git a/ATTRIBUTION.toml b/ATTRIBUTION.tomlindex b7df46ac1..e28d15275 100644--- a/ATTRIBUTION.toml+++ b/ATTRIBUTION.toml@@ -2808,6 +2808,28 @@ kind = "icon"usage = "Embedded in pdfcraft.exe by apps/pdfcraft/build.rs (Explorer, taskbar, Start menu, Alt-Tab)"sha256 = "56daaaae9ae5389794909570885809adf5e1d9183bef2d9669ed2f9bba3ed6f5"+[[asset]]+path = "assets/app-icon/pdfcraft-document.svg"+title = "PdfCraft PDF document icon (master vector)"+author = "Lucide Icons and Contributors (document outline); PdfCraft contributors (PDF badge, lettering and composition)"+source = "https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/file-text.svg); contributor-original composition (assets/app-icon/README.md)"+licence = "ISC AND (MIT OR Apache-2.0)"+licence_file = "assets/app-icon/LICENSE-document.txt"+kind = "icon"+usage = "Master artwork for the Windows PDF file type icon; rendered by packaging/icons.sh, without fonts or external images"+sha256 = "8da8278c2b89362be0a960879d453ff879d7544d6d58e47d5389574e8dfff77b"++[[asset]]+path = "assets/app-icon/pdfcraft-document.ico"+title = "PdfCraft PDF document icon (Windows .ico, 16-256 px)"+author = "Lucide Icons and Contributors (document outline); PdfCraft contributors (PDF badge, lettering and composition)"+source = "https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/file-text.svg); contributor-original composition (assets/app-icon/README.md)"+licence = "ISC AND (MIT OR Apache-2.0)"+licence_file = "assets/app-icon/LICENSE-document.txt"+kind = "icon"+usage = "Embedded in pdfcraft.exe as resource 2; the Windows installer uses it for PdfCraft.Document and Applications/pdfcraft.exe PDF file associations"+sha256 = "ba3f9128b368fc6d17d376cf62dbdbc22455451c5c8c4779210d7a2a7409b9e6"+[[asset]]path = "assets/app-icon/hicolor/16x16/apps/ai.storyteller.pdfcraft.png"title = "PdfCraft app icon, 16 px"diff --git a/NOTICE b/NOTICEindex 62e047ec0..721847793 100644--- a/NOTICE+++ b/NOTICE@@ -13,6 +13,10 @@ This product bundles third-party material under its own licenses, listed below.list (author, source, license) is in ATTRIBUTION.md.- Lucide icons (assets/icons/*.svg) — ISC License. See assets/icons/LICENSE-lucide.txt.+ The Windows PDF file icon (assets/app-icon/pdfcraft-document.svg and .ico) adapts Lucide's+ file-text outline and combines it with contributor-original artwork. See+ assets/app-icon/LICENSE-document.txt (ISC AND (MIT OR Apache-2.0)), packaged as+ LICENSE-document.txt beside the Windows executables.- Inter typeface (assets/fonts/Inter-*.ttf) — SIL Open Font License 1.1. See assets/fonts/OFL-Inter.txt.- JetBrains Mono typeface (assets/fonts/JetBrainsMono-*.ttf) — SIL Open Font License 1.1. See assets/fonts/OFL-JetBrainsMono.txt.- Dancing Script typeface (assets/fonts/DancingScript.ttf), Copyright 2016 The Dancing Script Project Authors — SIL Open Font License 1.1 (Reserved Font Name "Dancing Script"). See assets/fonts/OFL-DancingScript.txt.diff --git a/apps/pdfcraft/build.rs b/apps/pdfcraft/build.rsindex 2f61ed5c7..35d519d99 100644--- a/apps/pdfcraft/build.rs+++ b/apps/pdfcraft/build.rs@@ -1,5 +1,6 @@//! 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.+//! shows in Explorer, the taskbar, the Start menu and Alt-Tab. A separate PDF document icon+//! uses resource ID 2; the installer references it as `pdfcraft.exe,-2`.//!//! 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@@ -11,6 +12,7 @@ mod windows_manifest;fn main() {println!("cargo:rerun-if-changed=build.rs");println!("cargo:rerun-if-changed=../../assets/app-icon/pdfcraft.ico");+ println!("cargo:rerun-if-changed=../../assets/app-icon/pdfcraft-document.ico");println!("cargo:rerun-if-changed=src/windows_manifest.rs");println!("cargo:rerun-if-env-changed=PDFCRAFT_REQUIRE_WINRES");if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {@@ -18,6 +20,7 @@ fn main() {}let mut res = winresource::WindowsResource::new();res.set_icon("../../assets/app-icon/pdfcraft.ico")+ .set_icon_with_id("../../assets/app-icon/pdfcraft-document.ico", "2").set_manifest(windows_manifest::WINDOWS_MANIFEST).set("ProductName", "PdfCraft").set("FileDescription", "PdfCraft PDF workbench")diff --git a/assets/app-icon/LICENSE-document.txt b/assets/app-icon/LICENSE-document.txtnew file mode 100644index 000000000..74b44ae1f--- /dev/null+++ b/assets/app-icon/LICENSE-document.txt@@ -0,0 +1,31 @@+PdfCraft PDF document icon (pdfcraft-document.svg and pdfcraft-document.ico).+SPDX-License-Identifier: ISC AND (MIT OR Apache-2.0)++The document outline and fold are adapted from Lucide file-text (lucide-static 1.49.0):+https://github.com/lucide-icons/lucide+The original is kept in assets/icons/file-text.svg.++ISC License++Copyright (c) 2026 Lucide Icons and Contributors++Permission to use, copy, modify, and/or distribute this software for any+purpose with or without fee is hereby granted, provided that the above+copyright notice and this permission notice appear in all copies.++THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.++The badge, outlined PDF lettering, colours and composition are original work+by the PdfCraft contributors. Copyright (c) 2026 PdfCraft contributors.+Licensed under either the MIT License or the Apache License, Version 2.0,+at your option. Full texts are LICENSE-MIT and LICENSE-APACHE at the+repository root, and beside this file in Windows distributions.++The icon uses no typeface or external image. Regenerate the ICO with+packaging/icons.sh; every asset and its SHA-256 is recorded in ATTRIBUTION.toml.diff --git a/assets/app-icon/README.md b/assets/app-icon/README.mdindex 64eb9a30e..10fb2d4cf 100644--- a/assets/app-icon/README.md+++ b/assets/app-icon/README.md@@ -33,6 +33,8 @@ Licence: [LICENSE.txt](LICENSE.txt) (`MIT OR Apache-2.0`, like the repo).| `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` |+| `pdfcraft-document.svg` | Windows PDF file icon master: a Lucide document outline, green badge and outlined PDF lettering; no font dependency |+| `pdfcraft-document.ico` | Windows PDF file icon (16–256 px), embedded as resource 2 in `pdfcraft.exe` || `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) |@@ -40,6 +42,12 @@ Where it shows: `apps/pdfcraft/src/main.rs` sets the window icon (Dock, taskbar,Wayland app id `ai.storyteller.pdfcraft`; `packaging/linux/ai.storyteller.pdfcraft.desktop` names thehicolor icon.+Windows PDF files use resource 2 (`"pdfcraft.exe",-2`) when PdfCraft is chosen as the default+reader; the app keeps resource 1. The document outline is adapted from Lucide `file-text`+1.49.0 (ISC); its badge and outlined lettering are original (`MIT OR Apache-2.0`), covered by+[LICENSE-document.txt](LICENSE-document.txt). Both icons are embedded, requiring no runtime+sidecar. This provides a file type icon; first-page thumbnails still need a thumbnail provider.+## Regenerate```shdiff --git a/assets/app-icon/pdfcraft-document.ico b/assets/app-icon/pdfcraft-document.iconew file mode 100644index 000000000..79967a800Binary files /dev/null and b/assets/app-icon/pdfcraft-document.ico differdiff --git a/assets/app-icon/pdfcraft-document.svg b/assets/app-icon/pdfcraft-document.svgnew file mode 100644index 000000000..603a74015--- /dev/null+++ b/assets/app-icon/pdfcraft-document.svg@@ -0,0 +1,16 @@+<!-- Document outline: Lucide file-text, lucide-static 1.49.0, ISC.+ PDF badge and outlined lettering: PdfCraft contributors, MIT OR Apache-2.0.+ No fonts or external images. See LICENSE-document.txt and ATTRIBUTION.toml. -->+<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">+ <g transform="translate(-2 -2) scale(2.8)" stroke="#0b0b0c" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">+ <path fill="#efe9dc" d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" />+ <path fill="#c8ece4" d="M14 2v5a1 1 0 0 0 1 1h5" />+ <path fill="none" stroke="#12a58a" d="M8 12h8M8 15h5" />+ </g>+ <rect x="3" y="34" width="56" height="23" rx="4" fill="#087f6b" />+ <g fill="none" stroke="#fff" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">+ <path d="M13 50V41h5a3 3 0 0 1 0 6h-5" />+ <path d="M27 41v9h3a4.5 4.5 0 0 0 0-9z" />+ <path d="M42 50V41h8M42 45h6" />+ </g>+</svg>diff --git a/packaging/icons.sh b/packaging/icons.shindex e8b2c9960..da8228ff5 100755--- a/packaging/icons.sh+++ b/packaging/icons.sh@@ -1,5 +1,6 @@#!/usr/bin/env bash-# Regenerate every app icon from assets/app-icon/pdfcraft.svg (the master vector).+# Regenerate the app icons from assets/app-icon/pdfcraft.svg and the Windows PDF file icon+# from assets/app-icon/pdfcraft-document.svg. Both are master vectors.## 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@@ -39,13 +40,15 @@ donemkdir -p "$DIR/hicolor/scalable/apps"cp "$SVG" "$DIR/hicolor/scalable/apps/$ID.svg"-# Windows .ico: PNG-compressed entries, 16-256 px.-ICO_PNGS=()-for s in 16 20 24 32 40 48 64 128 256; do- render "$SVG" "$s" "$TMP/ico-$s.png"- ICO_PNGS+=("$TMP/ico-$s.png")-done-python3 - "$DIR/pdfcraft.ico" "${ICO_PNGS[@]}" <<'PY'+# Windows .ico: PNG-compressed entries, 16-256 px. The document icon has its own resource+# in pdfcraft.exe; the app icon remains the first/default icon.+for name in pdfcraft pdfcraft-document; do+ ICO_PNGS=()+ for s in 16 20 24 32 40 48 64 128 256; do+ render "$DIR/$name.svg" "$s" "$TMP/$name-$s.png"+ ICO_PNGS+=("$TMP/$name-$s.png")+ done+ python3 - "$DIR/$name.ico" "${ICO_PNGS[@]}" <<'PY'import struct, sysout, pngs = sys.argv[1], sys.argv[2:]blobs = [open(p, "rb").read() for p in pngs]@@ -58,6 +61,7 @@ for b in blobs:offset += len(b)open(out, "wb").write(head + entries + data)PY+done# macOS .icns.if command -v iconutil >/dev/null; thendiff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1index c556652d9..524280b97 100644--- a/packaging/windows/package.ps1+++ b/packaging/windows/package.ps1@@ -87,6 +87,12 @@ $Stage = Join-Path $TargetDir "windows-package\$Arch"Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinueNew-Item -ItemType Directory -Force -Path $Stage | Out-NullCopy-Item (Join-Path $Bin 'pdfcraft.exe'), (Join-Path $Bin 'pdfcraft-cli.exe') $Stage+# The document icon embeds Lucide artwork: carry its ISC notice and the project licences+# beside the binaries in both distributions.+foreach ($f in 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE') {+ Copy-Item (Join-Path $Root $f) $Stage+}+Copy-Item (Join-Path $Root 'assets\app-icon\LICENSE-document.txt') $Stage& (Join-Path $PSScriptRoot 'sign.ps1') (Join-Path $Stage 'pdfcraft.exe') (Join-Path $Stage 'pdfcraft-cli.exe')@@ -122,6 +128,9 @@ $Portable = Join-Path $TargetDir "windows-package\pdfcraft-$Version-windows-$ArcRemove-Item -Recurse -Force $Portable -ErrorAction SilentlyContinueNew-Item -ItemType Directory -Force -Path $Portable | Out-NullCopy-Item (Join-Path $Stage '*.exe') $Portable+foreach ($f in 'NOTICE', 'LICENSE-document.txt') {+ Copy-Item (Join-Path $Stage $f) $Portable+}Copy-Item -Recurse $Models (Join-Path $Portable 'models')foreach ($f in 'README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE') {$p = Join-Path $Root $fdiff --git a/packaging/windows/pdfcraft.wxs b/packaging/windows/pdfcraft.wxsindex 200800af6..11d2e39ab 100644--- a/packaging/windows/pdfcraft.wxs+++ b/packaging/windows/pdfcraft.wxs@@ -70,10 +70,13 @@PdfCraft entry to pick was the advertised Start Menu shortcut, which Windows can'trun 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" />+ <!-- A negative index selects the stable icon resource ID, rather than its position.+ Resource 1 is the app's lion; resource 2 is the PDF document (build.rs). -->+ <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document\DefaultIcon" Value=""[#PdfcraftExe]",-2" 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\DefaultIcon" Value=""[#PdfcraftExe]",-2" 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" />@@ -136,6 +139,19 @@<Component Id="PdfcraftCli"><File Id="PdfcraftCliExe" Source="$(var.BinDir)\pdfcraft-cli.exe" KeyPath="yes" /></Component>+ <!-- The embedded PDF icon's ISC notice and project licences travel with the binaries. -->+ <Component Id="PdfcraftDocumentIconLicense">+ <File Id="PdfcraftDocumentIconLicenseFile" Source="$(var.BinDir)\LICENSE-document.txt" KeyPath="yes" />+ </Component>+ <Component Id="PdfcraftMitLicense">+ <File Id="PdfcraftMitLicenseFile" Source="$(var.BinDir)\LICENSE-MIT" KeyPath="yes" />+ </Component>+ <Component Id="PdfcraftApacheLicense">+ <File Id="PdfcraftApacheLicenseFile" Source="$(var.BinDir)\LICENSE-APACHE" KeyPath="yes" />+ </Component>+ <Component Id="PdfcraftNotice">+ <File Id="PdfcraftNoticeFile" Source="$(var.BinDir)\NOTICE" KeyPath="yes" />+ </Component></ComponentGroup><!-- OCR models (#103), with their licences and ATTRIBUTION.txt, in models\ beside pdfcraft.exediff --git a/parity/acrobat-features.toml b/parity/acrobat-features.tomlindex 2b7cff8dd..1d02aac64 100644--- a/parity/acrobat-features.toml+++ b/parity/acrobat-features.toml@@ -10011,7 +10011,7 @@ status = "planned"commands = []tools = []evidence = []-notes = "Windows MSI creates a Start menu shortcut and an optional (default on) desktop shortcut and confirms full-UI completion with Finish (#143); packaging/windows/test-msi.ps1 checks the compiled MSI and windows-arm64.yml checks installation/removal. Signed installers across platforms remain planned."+notes = "Windows MSI creates a Start menu shortcut and an optional (default on) desktop shortcut and confirms full-UI completion with Finish (#143); packaging/windows/test-msi.ps1 checks the compiled MSI and windows-arm64.yml checks installation/removal. PDF files use a dedicated embedded document icon when PdfCraft is chosen as the default reader (confirmed in Windows Explorer); first-page thumbnails remain unsupported. Signed installers across platforms remain planned."[[feature]]id = "misc.web-deploy"