collective

Browse / github.com/storytold/pdfcraft / patch

M14: experimental Windows 7 x64 portable build

M14: experimental Windows 7 x64 portable build ## What this changes Ports VectorCraft's experimental, unsupported Windows 7 SP1 x64 build (`docs/windows7.md`): - New default features `wgpu` and `accessibility` on `pdfcraft` and `pdfcraft-ui-egui` (the workspace dependency on `pdfcraft-ui-egui` drops default features; `pdfcraft-web` now enables both explicitly, so normal and web builds are unchanged). A `windows7` feature with compile-time guards requires the `x86_64-win7-windows-msvc` target and no wgpu/accessibility. - On the win7 target: OpenGL only, no AccessKit adapter, no WinRT `UISettings` animation lookup (`motion.rs`), and p

Status
open
Score
0.00
Adopters
0 other operators
Author
fragtion (imported from pull request #5024, open)
Base
1889690bfa65c908654cf3fe9a1e5f2f37dcbe02
Size
+1020 −20 in 25 files
Review
pending
Shared
2026-10-28
Id
5373a217b047bd7ccf7bf030

How it went

No other operator has reported using it yet.

Diff

raw · .github/workflows/windows7.yml Cargo.lock Cargo.toml NOTICE README.md ROADMAP.md apps/pdfcraft-web/Cargo.toml apps/pdfcraft/Cargo.toml apps/pdfcraft/src/main.rs apps/pdfcraft/src/tests.rs crates/print/README.md crates/print/src/spool.rs crates/print/src/spool/windows7.rs crates/ui-egui/Cargo.toml crates/ui-egui/src/canvas/image_pick.rs docs/roadmap.md docs/windows7.md packaging/windows/windows7.ps1 vendor/README.md vendor/windows-link/Cargo.toml vendor/windows-link/PDFCRAFT-PATCH.md vendor/windows-link/license-apache-2.0 vendor/windows-link/license-mit vendor/windows-link/readme.md vendor/windows-link/src/lib.rs

diff --git a/.github/workflows/windows7.yml b/.github/workflows/windows7.ymlnew file mode 100644--- /dev/null+++ b/.github/workflows/windows7.yml@@ -0,0 +1,65 @@+# Experimental, unsupported Windows 7 SP1 x64 portable build (docs/windows7.md), ported from+# VectorCraft's. It runs by hand and weekly and for changes to the compatibility path; the weekly run+# shows when a dependency update starts importing a post-Windows-7 API.+# packaging/windows/windows7.ps1 does the work: it is the only build that uses the patched+# vendor/windows-link. A modern Windows runner proves compilation and host smoke tests only: run the+# checklist in docs/windows7.md on actual Windows 7 before claiming support.+name: Windows 7 x64 compatibility++on:+  pull_request:+    paths:+      - "Cargo.toml"+      - "Cargo.lock"+      - "apps/pdfcraft/Cargo.toml"+      - "apps/pdfcraft/src/main.rs"+      - "apps/pdfcraft/src/motion.rs"+      - "apps/pdfcraft/src/tests.rs"+      - "crates/ui-egui/src/canvas/image_pick.rs"+      - "apps/pdfcraft-cli/Cargo.toml"+      - "crates/ui-egui/Cargo.toml"+      - "crates/print/Cargo.toml"+      - "crates/print/src/spool.rs"+      - "crates/print/src/spool/**"+      - "vendor/windows-link/**"+      - "packaging/windows/windows7.ps1"+      - ".github/workflows/windows7.yml"+  schedule:+    - cron: "29 5 * * 1" # weekly+  workflow_dispatch:++concurrency:+  group: windows7-${{ github.ref }}+  cancel-in-progress: true++permissions:+  contents: read++env:+  CARGO_TERM_COLOR: always+  CARGO_INCREMENTAL: 0++jobs:+  build:+    runs-on: windows-2022+    timeout-minutes: 120+    steps:+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+      - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0+        with:+          arch: x64+      - uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master+        with:+          toolchain: nightly-2026-10-01+          components: rust-src+      - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3+        with:+          key: windows7-x64+      - name: Build, check and test the portable package+        shell: pwsh+        run: ./packaging/windows/windows7.ps1 -Test+      - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2+        with:+          name: pdfcraft-windows7-x64-portable+          path: dist/release/pdfcraft-windows7-x64-portable.zip+          if-no-files-found: errordiff --git a/Cargo.lock b/Cargo.lock--- a/Cargo.lock+++ b/Cargo.lock@@ -4491,6 +4491,7 @@ dependencies = [  "block2 0.6.2",  "bytemuck",  "chrono",+ "clipboard-win",  "craft-keymap",  "craft-menu",  "craft-quit",diff --git a/Cargo.toml b/Cargo.toml--- a/Cargo.toml+++ b/Cargo.toml@@ -56,7 +56,9 @@ pdfcraft-xfa = { path = "crates/xfa", version = "0.14.0" } pdfcraft-render = { path = "crates/render", version = "0.14.0" } pdfcraft-engine = { path = "crates/engine", version = "0.14.0" } pdfcraft-platform = { path = "crates/platform", version = "0.14.0" }-pdfcraft-ui-egui = { path = "crates/ui-egui", version = "0.14.0" }+# Without default features: each app chooses wgpu and the AccessKit adapter (the Windows 7 build+# leaves both out, docs/windows7.md).+pdfcraft-ui-egui = { path = "crates/ui-egui", version = "0.14.0", default-features = false } pdfcraft-automation = { path = "crates/automation", version = "0.14.0", default-features = false }  # pdfdiff --git a/NOTICE b/NOTICE--- a/NOTICE+++ b/NOTICE@@ -59,6 +59,11 @@ Vendored (vendor/, patched; see vendor/README.md): - hayro 0.7.1 — Apache-2.0 OR MIT, Copyright the hayro authors (licence files kept in vendor/hayro). - hayro-interpret 0.7.0 — Apache-2.0 OR MIT, Copyright the hayro authors (LICENSE-APACHE, LICENSE-MIT kept in vendor/hayro-interpret). +The experimental Windows 7 build (packaging/windows/windows7.ps1) compiles a modified copy of the+windows-link crate 0.2.1 (vendor/windows-link; Microsoft, MIT OR Apache-2.0) that binds CoTaskMemFree+through ole32.dll. Its license texts are in vendor/windows-link and ship in that build's ZIP; every+other build uses the unmodified crate from crates.io.+ Bundled egui font icons  The pinned egui dependency includes egui-icons.ttf, a small subset of John Slegers'diff --git a/README.md b/README.md--- a/README.md+++ b/README.md@@ -455,6 +455,8 @@ The summary is in **[ROADMAP.md](ROADMAP.md)**; the full assessment by dimension  Installers and executables are code-signed. +For the experimental, unsupported 64-bit Windows 7 build, see [Windows 7 instructions](docs/windows7.md).+ The portable zip runs from any folder, a USB stick included. Its `portable.txt` keeps the settings, logs and crash recovery in a `PdfCraftData` folder next to `pdfcraft.exe`, so nothing is written to `%APPDATA%`; delete that file to use the normal per-user folders.diff --git a/ROADMAP.md b/ROADMAP.md--- a/ROADMAP.md+++ b/ROADMAP.md@@ -2,6 +2,7 @@  **Stage: alpha** · next: beta, ~25% (ready for real work 50% → 75%) and ~400–700 h away +> **Last reviewed:** 2026-10-25 | **Last updated:** 2026-10-27 | **Change:** minor (M14: experimental, unsupported Windows 7 SP1 x64 portable build, docs/windows7.md; not runtime-verified; estimates unchanged) > **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: OCR model downloads use verified ONNX pairs with legacy discovery fallback; estimates unchanged) > **Last reviewed:** 2026-10-25 | **Last updated:** 2026-10-25 | **Change:** minor (M14 localization current state: Arabic logical catalog, explicit RTL label direction and mirrored stock chrome; native/browser RTL workflows unqualified. Native release Hans face via LXGW WenKai Lite; estimates unchanged) > **Last reviewed:** 2026-10-23 · **Last updated:** 2026-10-23 · **Change:** minor (M7, #2636 partial: pasting added text boxes and images in the engine and through `content_copy`; estimates unchanged)@@ -200,6 +201,7 @@ Ranked; detail and the full milestone table in [docs/roadmap.md](docs/roadmap.md  ## Progress log +- **2026-10-27 (M14, Windows 7):** An experimental, unsupported Windows 7 SP1 x64 portable build, ported from VectorCraft's ([`docs/windows7.md`](docs/windows7.md)): the win7 Rust target with a rebuilt standard library, OpenGL only (new default `wgpu` and `accessibility` features the build turns off), printing through the PDF viewer's print verb instead of craft-print's Windows Runtime renderer, and the vendored `windows-link` patch that imports `CoTaskMemFree` from `ole32.dll`. `packaging/windows/windows7.ps1` builds it and checks its imports; a weekly workflow builds it. Not yet run on Windows 7. Estimates unchanged. - **2026-10-27 (M10, OCR models):** Model staging downloads and verifies the ONNX pair after the upstream RTEN URL brownout; runtime discovery prefers complete ONNX pairs per directory, retains complete RTEN fallback and preserves directory precedence. - **2026-10-24 (M10, #4158 partial):** Word, HTML, RTF and PowerPoint export keep a block that continues another on its line (an italic case name, a link, a superscript) as a run in its own style inside that paragraph, with the source's word space, instead of a paragraph of its own. Style changes that wrap onto the next line still split paragraphs (the reading blocks keep style boundaries). Estimates unchanged. - **2026-10-24 (M3, window move on Wayland, #3970 follow-up):** After a move or resize by PdfCraft's own title bar or edges, the button release given back to egui goes before the pointer leaving the window, so hover no longer sticks at the old place until the pointer moves. Found by CodeRabbit in review of #3970; a unit test covers it. Estimates unchanged.diff --git a/apps/pdfcraft-web/Cargo.toml b/apps/pdfcraft-web/Cargo.toml--- a/apps/pdfcraft-web/Cargo.toml+++ b/apps/pdfcraft-web/Cargo.toml@@ -10,7 +10,7 @@ publish = false workspace = true  [dependencies]-pdfcraft-ui-egui = { workspace = true }+pdfcraft-ui-egui = { workspace = true, features = ["wgpu", "accessibility"] } eframe = { workspace = true, features = ["default_fonts", "glow", "persistence", "accesskit"] } egui = { workspace = true, features = ["default_fonts", "monochrome_emoji_fonts"] } diff --git a/apps/pdfcraft/Cargo.toml b/apps/pdfcraft/Cargo.toml--- a/apps/pdfcraft/Cargo.toml+++ b/apps/pdfcraft/Cargo.toml@@ -8,15 +8,24 @@ license.workspace = true [lints] workspace = true +[features]+default = ["wgpu", "accessibility"]+wgpu = ["eframe/wgpu", "pdfcraft-ui-egui/wgpu"]+accessibility = ["eframe/accesskit", "pdfcraft-ui-egui/accessibility"]+# The experimental, unsupported Windows 7 build (docs/windows7.md): OpenGL only, no AccessKit+# adapter. Build with --no-default-features --features windows7 and the win7 Rust target+# (packaging/windows/windows7.ps1).+windows7 = []+ [dependencies] # Help ▸ Check for updates (issue #28): one HTTPS request to GitHub, over rustls with the OS's # trusted roots. No bundled root list (webpki-roots and webpki-root-certs are CDLA-licensed). pdfcraft-ui-egui = { workspace = true } # `build_info`: the version and compile-time build label for `--version` and the log. pdfcraft-engine = { workspace = true }-# wgpu draws; OpenGL (glow) is the fallback when wgpu can't start on an old or unusual GPU or-# driver (#461, #435, #392), and can be chosen with PDFCRAFT_RENDERER=gl.-eframe = { workspace = true, features = ["default_fonts", "wgpu", "glow", "accesskit", "wayland", "x11", "persistence", "links", "clipboard"] }+# wgpu draws (the `wgpu` feature); OpenGL (glow) is the fallback when wgpu can't start on an old or+# unusual GPU or driver (#461, #435, #392), and can be chosen with PDFCRAFT_RENDERER=gl.+eframe = { workspace = true, features = ["default_fonts", "glow", "wayland", "x11", "persistence", "links", "clipboard"] } egui = { workspace = true, features = ["default_fonts", "monochrome_emoji_fonts"] } serde_json = { workspace = true } # Records from every crate go to standard error and the log file (src/logging.rs).@@ -54,15 +63,18 @@ winit = { version = "0.30", default-features = false, features = ["wayland"] } # shows it (issue #378). Safe wrappers over Win32; only the `user` feature (which brings `kernel` with it), # and `advapi` for the session id that names the single-instance socket (#3338). winsafe = { version = "0.0.29", default-features = false, features = ["user", "advapi"] }-# Settings ▸ Accessibility ▸ Visual effects ▸ Animation effects (src/motion.rs), through WinRT's-# `UISettings`, whose bindings are safe to call (winsafe's `SystemParametersInfo` is an unsafe-# fn). Already in the tree through wgpu's DX12 backend; this adds one small namespace to it.-windows = { version = "0.62", default-features = false, features = ["std", "UI_ViewManagement"] } # Single instance (#282): later launches hand their files to the running app over a Unix domain # socket. `std` has no Unix sockets on Windows, and calling Winsock directly needs unsafe, which # our workspace forbids. Already in the lockfile through zbus; pinned exactly, review before bumping. uds_windows = "=1.2.1" +# Settings ▸ Accessibility ▸ Visual effects ▸ Animation effects (src/motion.rs), through WinRT's+# `UISettings`, whose bindings are safe to call (winsafe's `SystemParametersInfo` is an unsafe+# fn). Already in the tree through wgpu's DX12 backend; this adds one small namespace to it.+# Windows 7 has no WinRT: the win7 target leaves it out (docs/windows7.md).+[target.'cfg(all(windows, not(target_vendor = "win7")))'.dependencies]+windows = { version = "0.62", default-features = false, features = ["std", "UI_ViewManagement"] }+ [build-dependencies] # Icon + VERSIONINFO for pdfcraft.exe; build.rs only uses it when targeting Windows. winresource = "0.1"diff --git a/apps/pdfcraft/src/main.rs b/apps/pdfcraft/src/main.rs--- a/apps/pdfcraft/src/main.rs+++ b/apps/pdfcraft/src/main.rs@@ -25,6 +25,15 @@ #![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)] +// The experimental Windows 7 build (docs/windows7.md) is OpenGL only, on the win7 Rust target:+// the ordinary Windows target's standard library itself needs Windows 10.+#[cfg(all(feature = "windows7", any(feature = "wgpu", feature = "accessibility")))]+compile_error!("windows7 requires --no-default-features (wgpu and accessibility must be disabled)");+#[cfg(all(windows, feature = "windows7", not(target_vendor = "win7")))]+compile_error!("windows7 requires --target x86_64-win7-windows-msvc; the ordinary Windows target still imports newer APIs");+#[cfg(all(target_vendor = "win7", not(feature = "windows7")))]+compile_error!("the win7 target requires --no-default-features --features windows7");+ use std::cell::Cell; use std::rc::Rc; @@ -32,10 +41,11 @@ use pdfcraft_ui_egui::PdfCraftApp;  #[cfg(target_os = "macos")] mod apple_events;+#[cfg(feature = "wgpu")] mod compositor_gpu; mod decorations; mod logging;-#[cfg(target_os = "windows")]+#[cfg(all(windows, not(target_vendor = "win7")))] mod motion; mod reopen; mod settings;@@ -269,6 +279,7 @@ fn main() -> eframe::Result {         single_instance::Claim::Primary(server) => Some(server),         single_instance::Claim::Alone => None,     };+    #[cfg(feature = "wgpu")]     let choice = renderer_choice(std::env::var("PDFCRAFT_RENDERER").ok().as_deref());     let launch = Launch { files, options, control_file, create_images, integrated, window_controls };     // Finder, Open With and the Dock deliver files as Apple events, not arguments; catch the one@@ -277,7 +288,11 @@ fn main() -> eframe::Result {     let apple_events = apple_events::AppleEvents::install();     // Set once the app is created, which is after the renderer has started.     let started = Rc::new(Cell::new(false));+    #[cfg(feature = "wgpu")]     let first = if choice == RendererChoice::Gl { eframe::Renderer::Glow } else { eframe::Renderer::Wgpu };+    // Built without wgpu (the Windows 7 build): OpenGL is the only renderer.+    #[cfg(not(feature = "wgpu"))]+    let first = eframe::Renderer::Glow;     let result = eframe::run_native(         "PdfCraft",         native_options(launch.integrated, launch.window_controls.is_some(), first),@@ -292,6 +307,7 @@ fn main() -> eframe::Result {     match result {         // Only a renderer that couldn't start: without a window or display at all, OpenGL can't         // help either, and winit's own error says more.+        #[cfg(feature = "wgpu")]         Err(e @ eframe::Error::Wgpu(_)) if retry_with_gl(choice, started.get()) => {             // Old or unusual GPUs and drivers (#461, #435, #392) can't give wgpu a device; OpenGL             // usually still works there, so that's better than quitting.@@ -313,6 +329,7 @@ fn main() -> eframe::Result { }  /// Which renderer to start with, from `PDFCRAFT_RENDERER`.+#[cfg(feature = "wgpu")] #[derive(Clone, Copy, Debug, PartialEq, Eq)] enum RendererChoice {     /// wgpu, then OpenGL if wgpu can't start (unset, or anything unrecognised).@@ -323,6 +340,7 @@ enum RendererChoice {     Gl, } +#[cfg(feature = "wgpu")] fn renderer_choice(value: Option<&str>) -> RendererChoice {     match value.map(|v| v.trim().to_ascii_lowercase()).as_deref() {         Some("wgpu") => RendererChoice::Wgpu,@@ -333,6 +351,7 @@ fn renderer_choice(value: Option<&str>) -> RendererChoice {  /// Whether a failed run should be retried with OpenGL: only when wgpu was tried first by choice of /// nobody, and it failed before the app was created (so while starting the renderer, not later).+#[cfg(feature = "wgpu")] fn retry_with_gl(choice: RendererChoice, app_started: bool) -> bool {     choice == RendererChoice::Auto && !app_started }@@ -364,6 +383,7 @@ fn native_options(integrated: bool, app_frame: bool, renderer: eframe::Renderer)     // PdfCraft installs its own last-resort system face (`PDFCRAFT_SYSTEM_FONTS`); eframe's     // provider would read every installed face, including proprietary ones, into every UI pass.     native.system_font_fallback = false;+    #[cfg(feature = "wgpu")]     if renderer == eframe::Renderer::Wgpu {         configure_gpu(&mut native);     }@@ -419,7 +439,8 @@ fn app_creator<'a>(         app.system_text_scale = text_scale::system();         // Windows' Animation effects setting, which Preferences ▸ Animation effects follows unless         // it is set to On or Off.-        #[cfg(target_os = "windows")]+        // Windows 7 has no WinRT to ask (docs/windows7.md): there the preference alone decides.+        #[cfg(all(windows, not(target_vendor = "win7")))]         {             app.motion.source = Some(motion::source());         }@@ -447,6 +468,7 @@ fn app_creator<'a>(         if let Some(dir) = pdfcraft_ui_egui::RecoveryStore::default_dir() {             app.enable_recovery(pdfcraft_ui_egui::RecoveryStore::new(dir));         }+        #[cfg(feature = "wgpu")]         if let Some(state) = &cc.wgpu_render_state {             let adapter = state.adapter.get_info();             let max_texture_dimension_2d = state.device.limits().max_texture_dimension_2d;@@ -460,6 +482,8 @@ fn app_creator<'a>(         } else {             log::info!("renderer: OpenGL (glow)");         }+        #[cfg(not(feature = "wgpu"))]+        log::info!("renderer: OpenGL (glow)");         // A portable marker whose data folder can't be written (#157): say where settings went.         if let Some(w) = &pdfcraft_ui_egui::portable::current().unwritable {             app.notify_fmt(@@ -492,6 +516,7 @@ fn app_creator<'a>( /// a GPU, which makes everything slower. egui-wgpu only logs it, so the reporter of #519 had to find /// it in pdfcraft.log. The OpenGL fallback isn't covered: glow only reports its renderer through /// `unsafe` calls.+#[cfg(feature = "wgpu")] fn notify_software_renderer(app: &mut PdfCraftApp, device_type: eframe::wgpu::DeviceType) {     if device_type == eframe::wgpu::DeviceType::Cpu {         app.notify_tr("PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help.");@@ -596,6 +621,7 @@ fn write_control_file(path: &str, port: u16, token: &str) -> std::io::Result<()> ///   is being resized, Windows stretched the window's swap chain, still at the old size, to the ///   new one, so the text shimmered and the left panel's width bounced for as long as the drag ///   lasted (issue #2738). A visual's last frame is shown at its own size instead.+#[cfg(feature = "wgpu")] fn configure_gpu(native: &mut eframe::NativeOptions) {     let eframe::egui_wgpu::WgpuSetup::CreateNew(setup) = &mut native.wgpu_options.wgpu_setup else { return };     // Nothing draws or dispatches indirectly, so wgpu's check of indirect arguments only costs a@@ -650,12 +676,14 @@ fn configure_gpu(native: &mut eframe::NativeOptions) {  /// How Direct3D 12 presents on Windows: through a DirectComposition visual (issue #2738), unless /// `WGPU_DX12_PRESENTATION_SYSTEM` asked for something else (`asked`).+#[cfg(feature = "wgpu")] fn dx12_presentation(asked: Option<eframe::wgpu::Dx12SwapchainKind>) -> eframe::wgpu::Dx12SwapchainKind {     asked.unwrap_or(eframe::wgpu::Dx12SwapchainKind::DxgiFromVisual) }  /// Surface textures must fit the device's enabled limits, not just the physical GPU's limits. /// Clamp egui-wgpu's backend-specific requirements before enabling the adapter's full 2D extent.+#[cfg(feature = "wgpu")] fn surface_texture_limits(mut required: eframe::wgpu::Limits, supported: &eframe::wgpu::Limits) -> eframe::wgpu::Limits {     required = required.or_worse_values_from(supported);     required.max_texture_dimension_2d = supported.max_texture_dimension_2d;@@ -663,6 +691,7 @@ fn surface_texture_limits(mut required: eframe::wgpu::Limits, supported: &eframe }  /// A GPU with a connected monitor.+#[cfg(feature = "wgpu")] #[derive(Clone, Copy, Debug, PartialEq, Eq)] struct DisplayGpu {     /// PCI `(vendor, device)` ids.@@ -674,6 +703,7 @@ struct DisplayGpu {  /// The GPUs with a connected monitor, as far as the system says: Linux reads the DRM connectors /// in sysfs, Windows asks for the display devices attached to the desktop. Empty elsewhere.+#[cfg(feature = "wgpu")] fn display_gpus() -> Vec<DisplayGpu> {     #[cfg(target_os = "linux")]     {@@ -690,6 +720,7 @@ fn display_gpus() -> Vec<DisplayGpu> { }  /// Records one display of GPU `pci`; a GPU driving several displays is one entry.+#[cfg(feature = "wgpu")] #[cfg_attr(not(any(target_os = "linux", target_os = "windows")), allow(dead_code))] fn add_display_gpu(gpus: &mut Vec<DisplayGpu>, pci: (u32, u32), primary: bool) {     match gpus.iter_mut().find(|g| g.pci == pci) {@@ -703,6 +734,7 @@ fn add_display_gpu(gpus: &mut Vec<DisplayGpu>, pci: (u32, u32), primary: bool) { /// adapter's PCI ids in its device id (`PCI\VEN_10DE&DEV_2204&SUBSYS_40421458&REV_A1`); a GPU with /// no monitor lists its devices as not attached. Issue #378: a Ryzen desktop with the monitors on /// an NVIDIA card, where the integrated GPU would otherwise be chosen.+#[cfg(feature = "wgpu")] #[cfg(target_os = "windows")] fn windows_display_gpus() -> Vec<DisplayGpu> {     use winsafe::co::DISPLAY_DEVICE as Flags;@@ -728,6 +760,7 @@ fn windows_display_gpus() -> Vec<DisplayGpu> {  /// The PCI `(vendor, device)` ids in a Windows device id such as /// `PCI\VEN_10DE&DEV_2204&SUBSYS_40421458&REV_A1`; `None` for any other kind of device.+#[cfg(feature = "wgpu")] #[cfg_attr(not(target_os = "windows"), allow(dead_code))] fn pci_ids(device_id: &str) -> Option<(u32, u32)> {     let field = |key: &str| {@@ -740,6 +773,7 @@ fn pci_ids(device_id: &str) -> Option<(u32, u32)> { }  /// Whether a DRM connector name (`eDP-1`, `LVDS-1`, `DSI-1`) is a laptop's built-in panel.+#[cfg(feature = "wgpu")] #[cfg_attr(not(target_os = "linux"), allow(dead_code))] fn is_internal_panel(connector: &str) -> bool {     ["eDP", "LVDS", "DSI"].iter().any(|kind| connector.starts_with(kind))@@ -747,6 +781,7 @@ fn is_internal_panel(connector: &str) -> bool {  /// The GPUs with a connected monitor, read from the DRM connectors under `drm` (`card1-DP-3/status` /// is `connected`, `card1/device/{vendor,device}` hold `0x10de`).+#[cfg(feature = "wgpu")] #[cfg(target_os = "linux")] fn linux_display_gpus(drm: &std::path::Path) -> Vec<DisplayGpu> {     let read_hex = |p: std::path::PathBuf| -> Option<u32> {@@ -775,6 +810,7 @@ fn linux_display_gpus(drm: &std::path::Path) -> Vec<DisplayGpu> { /// primary display (a hybrid laptop's panel, #8; the primary display on Windows, #378), or else, /// with no primary display known (a Linux desktop with a monitor on each GPU, #445), the discrete /// one. Otherwise the most frugal kind: integrated, discrete, other, virtual, software.+#[cfg(feature = "wgpu")] fn pick_adapter(adapters: &[(u32, u32, eframe::wgpu::DeviceType)], displays: &[DisplayGpu], compositor: Option<(u32, u32)>) -> Option<usize> {     use eframe::wgpu::DeviceType;     let display = |pci: (u32, u32)| displays.iter().find(|g| g.pci == pci);diff --git a/apps/pdfcraft/src/tests.rs b/apps/pdfcraft/src/tests.rs--- a/apps/pdfcraft/src/tests.rs+++ b/apps/pdfcraft/src/tests.rs@@ -45,8 +45,10 @@ fn endpoint() -> std::io::Result<Endpoint> { /// the first device was still being set up when the second test began its own. The UI /// tests take turns the same way (`crates/ui-egui/tests/it/main.rs`). Hold it for the whole /// test (declared before the instance, so it's released after the device is dropped).+#[cfg(feature = "wgpu")] static GPU: std::sync::Mutex<()> = std::sync::Mutex::new(()); +#[cfg(feature = "wgpu")] fn gpu() -> std::sync::MutexGuard<'static, ()> {     // A test that panicked while holding it leaves nothing to clean up.     GPU.lock().unwrap_or_else(std::sync::PoisonError::into_inner)@@ -110,6 +112,7 @@ fn path_from_arg_leaves_plain_paths_and_other_schemes_alone() {     assert_eq!(super::path_from_arg("file://".to_string()), "file://"); } +#[cfg(feature = "wgpu")] #[test] fn opengl_is_the_fallback_unless_a_renderer_was_chosen() {     use super::{RendererChoice, native_options, renderer_choice, retry_with_gl};@@ -137,6 +140,7 @@ fn the_desktop_frame_is_turned_off_only_when_the_app_draws_one() {     assert_eq!(native_options(false, true, eframe::Renderer::Glow).viewport.decorations, Some(false)); } +#[cfg(feature = "wgpu")] #[test] fn a_software_renderer_is_shown_to_the_user() {     use eframe::wgpu::DeviceType;@@ -152,6 +156,7 @@ fn a_software_renderer_is_shown_to_the_user() {     } } +#[cfg(feature = "wgpu")] #[test] fn gpu_setup_avoids_vulkan_and_stretched_resizes_on_windows_and_prefers_low_power() {     let mut native = eframe::NativeOptions::default();@@ -183,6 +188,7 @@ fn gpu_setup_avoids_vulkan_and_stretched_resizes_on_windows_and_prefers_low_powe     } } +#[cfg(feature = "wgpu")] #[test] fn restored_hidpi_window_fits_the_adapters_surface_limit() {     // The Outlook launch crash: 3440 x 1369 saved points at 250% DPI requested this surface.@@ -195,6 +201,7 @@ fn restored_hidpi_window_fits_the_adapters_surface_limit() {     assert!(height <= enabled.max_texture_dimension_2d); } +#[cfg(feature = "wgpu")] #[test] fn surface_limits_preserve_other_requirements_and_never_overrequest() {     for required in [eframe::wgpu::Limits::default(), eframe::wgpu::Limits::downlevel_webgl2_defaults()] {@@ -216,6 +223,7 @@ fn surface_limits_preserve_other_requirements_and_never_overrequest() {     } } +#[cfg(feature = "wgpu")] #[test] fn surface_limits_fit_v3d_shader_variable_limit() {     // Issue #2383: V3D supports 15 variables, below the default request of 16.@@ -227,6 +235,7 @@ fn surface_limits_fit_v3d_shader_variable_limit() {     assert_eq!(enabled, expected); } +#[cfg(feature = "wgpu")] #[test] fn surface_limits_fit_downlevel_maxima_and_minimum_alignments() {     let required = eframe::wgpu::Limits::downlevel_webgl2_defaults();@@ -244,6 +253,7 @@ fn surface_limits_fit_downlevel_maxima_and_minimum_alignments() {     assert_eq!(enabled, supported); } +#[cfg(feature = "wgpu")] #[test] fn a_window_larger_than_the_gpu_limit_gets_a_surface_within_it() {     use eframe::egui_wgpu::winit::surface_fit;@@ -262,6 +272,7 @@ fn a_window_larger_than_the_gpu_limit_gets_a_surface_within_it() {     assert_eq!(surface_fit(600, 8193, 8192).1, 8192); } +#[cfg(feature = "wgpu")] #[test] fn surface_fit_never_empties_or_overflows_a_surface() {     use eframe::egui_wgpu::winit::surface_fit;@@ -305,6 +316,7 @@ fn vendor_provenance_egui_wgpu_surface_fit_identity() {     assert!(root.join("vendor/egui-wgpu/src/winit.rs").exists(), "the vendor copy and its provenance stay until the fork revision is pinned"); } +#[cfg(feature = "wgpu")] #[test] fn a_gpu_error_while_a_window_is_set_up_is_returned_not_a_panic() {     // Issue #519: on a 2015 Intel GPU, wgpu's GL backend couldn't configure the window's@@ -372,6 +384,7 @@ fn vendor_provenance_egui_wgpu_catch_errors_identity() {     assert!(root.join("vendor/egui-wgpu/src/winit.rs").exists(), "the vendor copy and its provenance stay until the fork revision is pinned"); } +#[cfg(feature = "wgpu")] #[test] fn pipeline_creation_error_is_returned_and_device_remains_usable() {     use eframe::{egui_wgpu, wgpu};@@ -432,25 +445,33 @@ fn winit_carries_the_windows_11_monitor_scale_fix() {     assert!(provenance.contains("e9809ef54b18499bb4f2cac945719ecc2a61061b"), "vendor/winit keeps its upstream base provenance"); } +#[cfg(feature = "wgpu")] const NVIDIA: (u32, u32) = (0x10de, 0x2684);+#[cfg(feature = "wgpu")] const NVIDIA_3090: (u32, u32) = (0x10de, 0x2204);+#[cfg(feature = "wgpu")] const AMD_IGPU: (u32, u32) = (0x1002, 0x164e); +#[cfg(feature = "wgpu")] fn adapters() -> Vec<(u32, u32, eframe::wgpu::DeviceType)> {     use eframe::wgpu::DeviceType;     vec![(NVIDIA.0, NVIDIA.1, DeviceType::DiscreteGpu), (AMD_IGPU.0, AMD_IGPU.1, DeviceType::IntegratedGpu), (0, 0, DeviceType::Cpu)] } +#[cfg(feature = "wgpu")] const INTEL_IGPU: (u32, u32) = (0x8086, 0xa780); +#[cfg(feature = "wgpu")] fn monitor(pci: (u32, u32)) -> super::DisplayGpu {     super::DisplayGpu { pci, primary: false } } +#[cfg(feature = "wgpu")] fn panel(pci: (u32, u32)) -> super::DisplayGpu {     super::DisplayGpu { pci, primary: true } } +#[cfg(feature = "wgpu")] #[test] fn pick_adapter_prefers_the_gpu_driving_the_monitors() {     // A desktop whose monitors are all on the discrete GPU: the integrated one shows black.@@ -460,6 +481,7 @@ fn pick_adapter_prefers_the_gpu_driving_the_monitors() {     assert_eq!(super::pick_adapter(&adapters(), &[panel(NVIDIA)], None), Some(0)); } +#[cfg(feature = "wgpu")] #[test] fn pick_adapter_prefers_the_gpu_driving_the_primary_display() {     // A Windows desktop with a monitor on each GPU: the window opens on the primary display.@@ -467,6 +489,7 @@ fn pick_adapter_prefers_the_gpu_driving_the_primary_display() {     assert_eq!(super::pick_adapter(&adapters(), &[panel(AMD_IGPU), monitor(NVIDIA)], None), Some(1)); } +#[cfg(feature = "wgpu")] #[test] fn pci_ids_come_from_windows_device_ids() {     assert_eq!(super::pci_ids("PCI\\VEN_10DE&DEV_2204&SUBSYS_40421458&REV_A1"), Some(NVIDIA_3090));@@ -480,6 +503,7 @@ fn pci_ids_come_from_windows_device_ids() {     assert_eq!(super::pci_ids(""), None); } +#[cfg(feature = "wgpu")] #[cfg(target_os = "windows")] #[test] fn windows_display_gpus_lists_pci_gpus_with_a_monitor() {@@ -493,6 +517,7 @@ fn windows_display_gpus_lists_pci_gpus_with_a_monitor() {     } } +#[cfg(feature = "wgpu")] #[test] fn pick_adapter_keeps_the_integrated_gpu_on_hybrid_laptops() {     // Issue #8: the panel is on the integrated GPU, an external monitor on the discrete one.@@ -502,6 +527,7 @@ fn pick_adapter_keeps_the_integrated_gpu_on_hybrid_laptops() {     assert_eq!(super::pick_adapter(&adapters(), &[monitor(AMD_IGPU)], None), Some(1)); } +#[cfg(feature = "wgpu")] #[test] fn pick_adapter_prefers_the_discrete_gpu_on_desktops_with_a_monitor_on_each() {     // Issue #445: one monitor on the Intel iGPU, one on the NVIDIA card, no built-in panel.@@ -513,6 +539,7 @@ fn pick_adapter_prefers_the_discrete_gpu_on_desktops_with_a_monitor_on_each() {     assert_eq!(super::pick_adapter(&adapters(), &[monitor(AMD_IGPU), monitor(INTEL_IGPU)], None), Some(1)); } +#[cfg(feature = "wgpu")] #[test] fn pick_adapter_prefers_the_gpu_the_compositor_draws_with() {     // A hybrid laptop whose Wayland compositor runs on the discrete GPU (Hyprland with@@ -528,6 +555,7 @@ fn pick_adapter_prefers_the_gpu_the_compositor_draws_with() {     assert_eq!(super::pick_adapter(&adapters(), &[panel(AMD_IGPU)], Some((0x1af4, 0x1050))), Some(1)); } +#[cfg(feature = "wgpu")] #[test] fn pick_adapter_falls_back_to_low_power_without_a_match() {     assert_eq!(super::pick_adapter(&adapters(), &[monitor((0x8086, 0x1234))], None), Some(1));@@ -535,6 +563,7 @@ fn pick_adapter_falls_back_to_low_power_without_a_match() {     assert_eq!(super::pick_adapter(&[], &[monitor(NVIDIA)], None), None); } +#[cfg(feature = "wgpu")] #[test] fn internal_panels_are_edp_lvds_and_dsi_connectors() {     for name in ["eDP-1", "LVDS-1", "DSI-1"] {@@ -545,6 +574,7 @@ fn internal_panels_are_edp_lvds_and_dsi_connectors() {     } } +#[cfg(feature = "wgpu")] #[cfg(target_os = "linux")] #[test] fn linux_display_gpus_reads_connected_connectors() -> std::io::Result<()> {diff --git a/crates/print/README.md b/crates/print/README.md--- a/crates/print/README.md+++ b/crates/print/README.md@@ -51,6 +51,10 @@ CUPS jobs stream through stdin with `fit-to-page=false`. Windows renders sheets orientation, zero added margins and hardware-edge clipping. Long-edge and short-edge duplex use the corresponding Windows binding edges. Random, exclusively created Windows job files are removed on success and failure. Other targets offer the print-ready PDF instead.+The experimental Windows 7 build (`docs/windows7.md`) has no `Windows.Data.Pdf`: there+`spool/windows7.rs` lists printers through craft-print's Win32 `rgb` module and hands the+print-ready PDF to the installed PDF viewer's Print / PrintTo verb, which prints with its own+settings (copies, duplex and scaling don't reach it).  The shared dependency requires Rust 1.95. Transport and native Windows regression tests live in craft-libs; local tests retain composition, facade, engine, automation and UI coverage.diff --git a/crates/print/src/spool.rs b/crates/print/src/spool.rs--- a/crates/print/src/spool.rs+++ b/crates/print/src/spool.rs@@ -1,10 +1,18 @@ //! System print spooler supplied by craft-print. PDF composition and permission checks //! stay in PdfCraft; these adapters retain the application's print-error surface. +#[cfg(not(target_vendor = "win7"))]+pub use craft_print::printers; pub use craft_print::{     Duplex, HANDLED_OPTIONS, HAS_PRINTER_PREFERENCES, Job, Printer, PrinterOption, Scaling, lp_args, lpstat_command, parse_lpoptions, parse_lpstat,-    parse_lpstat_e, parse_ppd, parse_windows_printers, ppd_text, printers, printers_parsed,+    parse_lpstat_e, parse_ppd, parse_windows_printers, ppd_text, printers_parsed, };+#[cfg(target_vendor = "win7")]+pub use windows7::printers;++/// The experimental Windows 7 build's spooler: the PDF viewer's print verb (docs/windows7.md).+#[cfg(any(test, target_vendor = "win7"))]+mod windows7;  /// The driver's job options for a printer (CUPS: its PPD, with the queue's current defaults); /// empty when it has none or on other platforms. Reads files and runs `lpoptions`, so call it@@ -34,14 +42,14 @@ pub fn printer_options_in(printer: &str, lang: &str) -> Vec<PrinterOption> { const LPOPTIONS_LIMIT: std::time::Duration = std::time::Duration::from_secs(10);  /// The most of a command's output that is kept (`lpoptions -l` is a few kilobytes).-#[cfg(any(test, all(unix, not(target_arch = "wasm32"))))]+#[cfg(any(test, target_vendor = "win7", all(unix, not(target_arch = "wasm32"))))] const OUTPUT_CAP: u64 = 4 << 20;  /// Run `command` and collect its standard output, giving it `limit`: a command still running /// then is killed and reaped, and the error is `TimedOut`. Standard input and error are not /// connected. The exit status is not checked, as `Command::output` leaves it to the caller.-/// Only CUPS runs a command today; the tests cover every desktop platform.-#[cfg(any(test, all(unix, not(target_arch = "wasm32"))))]+/// CUPS and the Windows 7 build's print verb run commands; the tests cover every desktop platform.+#[cfg(any(test, target_vendor = "win7", all(unix, not(target_arch = "wasm32"))))] pub(crate) fn output_within(command: &mut std::process::Command, limit: std::time::Duration) -> std::io::Result<Vec<u8>> {     use std::io::Read as _;     use std::process::Stdio;@@ -144,13 +152,20 @@ pub(crate) fn printer_options_via_within( }  pub fn submit(pdf: &[u8], job: &Job) -> Result<String, crate::PrintError> {-    craft_print::submit(pdf, job).map_err(|e| crate::PrintError::Spool(e.to_string()))+    submit_with_progress(pdf, job, &mut |_, _| {}) }  /// [`submit`], told `(sent, sheets)` as each sheet reaches the spooler (Windows; CUPS takes the /// whole PDF at once and reports nothing). pub fn submit_with_progress(pdf: &[u8], job: &Job, progress: &mut dyn FnMut(usize, usize)) -> Result<String, crate::PrintError> {-    craft_print::submit_with_progress(pdf, job, progress).map_err(|e| crate::PrintError::Spool(e.to_string()))+    #[cfg(not(target_vendor = "win7"))]+    {+        craft_print::submit_with_progress(pdf, job, progress).map_err(|e| crate::PrintError::Spool(e.to_string()))+    }+    #[cfg(target_vendor = "win7")]+    {+        windows7::submit_with_progress(pdf, job, progress)+    } }  pub fn open_printer_preferences(printer: &str) -> Result<(), crate::PrintError> {diff --git a/crates/print/src/spool/windows7.rs b/crates/print/src/spool/windows7.rsnew file mode 100644--- /dev/null+++ b/crates/print/src/spool/windows7.rs@@ -0,0 +1,192 @@+//! The experimental Windows 7 build's spooler (docs/windows7.md). craft-print draws jobs with+//! `Windows.Data.Pdf`, a Windows Runtime API Windows 7 doesn't have, so this build hands the+//! print-ready PDF to the installed PDF viewer's Print / PrintTo verb instead, as VectorCraft's+//! Windows 7 build does. The printer list still comes from the spooler (EnumPrinters, through+//! craft-print's Win32 `rgb` module). The viewer prints with its own settings: copies, two-sided+//! and scaling chosen here don't reach it, and the result says so.++use super::Job;+#[cfg(target_vendor = "win7")]+use super::Printer;+#[cfg(target_vendor = "win7")]+use crate::PrintError;++/// Where a job's PDF waits for the viewer: a fresh file in `dir`. The viewer reads it after the+/// verb returns, so it can't be removed then; files of jobs more than an hour old are removed+/// first instead. Never truncates an existing file, and removes one it couldn't finish.+pub(crate) fn job_file(dir: &std::path::Path, pdf: &[u8]) -> Result<std::path::PathBuf, String> {+    use std::io::Write as _;+    std::fs::create_dir_all(dir).map_err(|e| format!("can't make {}: {e}", dir.display()))?;+    sweep(dir);+    let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_nanos()).unwrap_or_default();+    let path = dir.join(format!("job-{}-{stamp}.pdf", std::process::id()));+    let mut file =+        std::fs::OpenOptions::new().write(true).create_new(true).open(&path).map_err(|e| format!("can't create {}: {e}", path.display()))?;+    if let Err(e) = file.write_all(pdf).and_then(|()| file.flush()) {+        drop(file);+        let _ = std::fs::remove_file(&path);+        return Err(format!("can't write {}: {e}", path.display()));+    }+    Ok(path)+}++/// Removes the job files in `dir` more than an hour old: their viewer has long read them. Runs+/// before each job and whenever the printers are listed (the Print dialog opens), so a job's file+/// outlives it by about an hour of using PdfCraft's printing. A file still in use stays for the+/// next sweep; the folder is the user's own temp folder.+pub(crate) fn sweep(dir: &std::path::Path) {+    // A folder of a few files; the cap only bounds a runaway listing.+    for entry in std::fs::read_dir(dir).into_iter().flatten().flatten().take(4096) {+        let old = entry.metadata().and_then(|m| m.modified()).ok().and_then(|t| t.elapsed().ok()).is_some_and(|age| age.as_secs() > 3600);+        if old {+            let _ = std::fs::remove_file(entry.path());+        }+    }+}++/// The environment variables that carry the job's file and printer into PowerShell. A value in+/// the environment is data to PowerShell, never parsed as script, whatever quotes it contains+/// (PowerShell also ends a single-quoted string at ‘ ’ ‚ ‛), so neither is ever written into the+/// script's source.+const FILE_VAR: &str = "PDFCRAFT_PRINT_FILE";+const PRINTER_VAR: &str = "PDFCRAFT_PRINT_PRINTER";++/// The fixed scripts: Print on the default printer, PrintTo on a named one. Each writes `ok`+/// once the viewer has been started; `$ErrorActionPreference = 'Stop'` turns a failure into no `ok`.+const PRINT_SCRIPT: &str = "Start-Process -FilePath $env:PDFCRAFT_PRINT_FILE -Verb Print -WindowStyle Hidden; 'ok'";+const PRINT_TO_SCRIPT: &str =+    "Start-Process -FilePath $env:PDFCRAFT_PRINT_FILE -Verb PrintTo -ArgumentList $env:PDFCRAFT_PRINT_PRINTER -WindowStyle Hidden; 'ok'";++/// The script and environment that print `file` on `printer` (the default printer when `None` or+/// blank) through the PDF viewer's verb. PrintTo takes the printer name in double quotes, which a+/// Windows printer name can't contain.+pub(crate) fn print_invocation(file: &str, printer: Option<&str>) -> (&'static str, Vec<(&'static str, String)>) {+    let mut env = vec![(FILE_VAR, file.to_string())];+    match printer.map(str::trim).filter(|p| !p.is_empty()) {+        Some(p) => {+            env.push((PRINTER_VAR, format!("\"{}\"", p.replace('"', ""))));+            (PRINT_TO_SCRIPT, env)+        }+        None => (PRINT_SCRIPT, env),+    }+}++/// How long PowerShell may take to start the viewer before the job is given up: a viewer whose+/// print handler hangs must not leave the job pending for ever.+#[cfg(target_vendor = "win7")]+const LAUNCH_LIMIT: std::time::Duration = std::time::Duration::from_secs(60);++/// What the dialog is told once the viewer has the job: the settings the viewer decides.+pub(crate) fn handed_over(job: &Job) -> String {+    let mut note = String::from("handed to the PDF viewer's print command, which prints with its own settings");+    if job.copies > 1 {+        note.push_str(&format!(" (one copy, not {})", job.copies));+    }+    note+}++/// Windows PowerShell (2.0 on Windows 7 SP1) running `script`, without a console window.+#[cfg(target_vendor = "win7")]+fn powershell(script: &str) -> std::process::Command {+    use std::os::windows::process::CommandExt as _;+    const CREATE_NO_WINDOW: u32 = 0x0800_0000;+    let root = std::path::PathBuf::from(std::env::var_os("SystemRoot").unwrap_or_else(|| "C:\\Windows".into()));+    let mut c = std::process::Command::new(root.join("System32").join("WindowsPowerShell").join("v1.0").join("powershell.exe"));+    c.args([+        "-NoProfile",+        "-NonInteractive",+        "-Command",+        &format!("$ErrorActionPreference = 'Stop'; [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false); {script}"),+    ])+    .creation_flags(CREATE_NO_WINDOW);+    c+}++/// The spooler's printers, the default first; empty when it can't be asked.+#[cfg(target_vendor = "win7")]+pub fn printers() -> Vec<Printer> {+    sweep(&std::env::temp_dir().join("pdfcraft-print"));+    let list = craft_print::rgb::printers().unwrap_or_default();+    list.into_iter().map(|p| Printer { name: p.name, description: String::new(), default: p.default, two_sided: None }).collect()+}++/// Print `pdf` through the PDF viewer's verb. Progress is reported once, when the viewer has it.+#[cfg(target_vendor = "win7")]+pub fn submit_with_progress(pdf: &[u8], job: &Job, progress: &mut dyn FnMut(usize, usize)) -> Result<String, PrintError> {+    let file = job_file(&std::env::temp_dir().join("pdfcraft-print"), pdf).map_err(PrintError::Spool)?;+    let (script, env) = print_invocation(&file.to_string_lossy(), job.printer.as_deref());+    let mut command = powershell(script);+    command.envs(env);+    let failed = match super::output_within(&mut command, LAUNCH_LIMIT) {+        Ok(out) if String::from_utf8_lossy(&out).trim() == "ok" => None,+        Ok(_) => Some("PowerShell couldn't start it".to_string()),+        Err(e) => Some(format!("PowerShell: {e}")),+    };+    if let Some(e) = failed {+        // No viewer took the job, so nothing will read the file.+        let _ = std::fs::remove_file(&file);+        return Err(PrintError::Spool(format!(+            "no app prints PDF files here; install a PDF viewer that can print, or save the print-ready PDF ({e})"+        )));+    }+    progress(1, 1);+    Ok(handed_over(job))+}++#[cfg(test)]+mod tests {+    use super::*;++    #[test]+    fn file_and_printer_reach_powershell_as_data_never_as_script() {+        // Quotes PowerShell would end a single-quoted string at, ASCII and typographic.+        let hostile = "Office \"Laser\" 'B' ‘x’ ‚y‛; Remove-Item C:\\ $(calc)";+        let (script, env) = print_invocation(r"C:\Bob's ‘dir’\job.pdf", Some(hostile));+        assert_eq!(script, PRINT_TO_SCRIPT);+        assert!(!script.contains("Bob") && !script.contains("Laser"));+        assert_eq!(+            env,+            [(FILE_VAR, r"C:\Bob's ‘dir’\job.pdf".to_string()), (PRINTER_VAR, "\"Office Laser 'B' ‘x’ ‚y‛; Remove-Item C:\\ $(calc)\"".to_string())]+        );+        // The scripts read the variables they are given.+        assert!(PRINT_TO_SCRIPT.contains(&format!("$env:{FILE_VAR}")) && PRINT_TO_SCRIPT.contains(&format!("$env:{PRINTER_VAR}")));+        assert!(PRINT_SCRIPT.contains(&format!("$env:{FILE_VAR}")));+        for blank in [None, Some(""), Some("  ")] {+            assert_eq!(print_invocation("job.pdf", blank), (PRINT_SCRIPT, vec![(FILE_VAR, "job.pdf".to_string())]));+        }+    }++    #[test]+    fn the_sweep_removes_job_files_older_than_an_hour_only() {+        let dir = std::env::temp_dir().join(format!("pdfcraft-print-sweep-{}", std::process::id()));+        std::fs::create_dir_all(&dir).unwrap();+        let (old, new) = (dir.join("old.pdf"), dir.join("new.pdf"));+        std::fs::write(&old, b"a").unwrap();+        std::fs::write(&new, b"b").unwrap();+        let two_hours_ago = std::time::SystemTime::now() - std::time::Duration::from_secs(7200);+        std::fs::File::options().write(true).open(&old).unwrap().set_modified(two_hours_ago).unwrap();+        sweep(&dir);+        assert!(!old.exists());+        assert!(new.exists());+        std::fs::remove_dir_all(dir).unwrap();+    }++    #[test]+    fn job_files_hold_the_pdf_for_the_viewer_and_never_overwrite() {+        let dir = std::env::temp_dir().join(format!("pdfcraft-print-test-{}", std::process::id()));+        let a = job_file(&dir, b"%PDF-1.7 a").unwrap();+        let b = job_file(&dir, b"%PDF-1.7 b").unwrap();+        assert_ne!(a, b);+        assert_eq!(std::fs::read(&a).unwrap(), b"%PDF-1.7 a");+        assert_eq!(std::fs::read(&b).unwrap(), b"%PDF-1.7 b");+        std::fs::remove_dir_all(dir).unwrap();+    }++    #[test]+    fn the_result_says_the_viewer_decides_and_copies_are_not_applied() {+        let one = Job::default();+        assert!(!handed_over(&one).contains("copy"));+        let three = Job { copies: 3, ..Job::default() };+        assert!(handed_over(&three).ends_with("(one copy, not 3)"), "{}", handed_over(&three));+    }+}diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml--- a/crates/ui-egui/Cargo.toml+++ b/crates/ui-egui/Cargo.toml@@ -9,6 +9,14 @@ rust-version = "1.95" [lints] workspace = true +[features]+default = ["wgpu", "accessibility"]+# The wgpu renderer and the platform accessibility adapter (AccessKit). The experimental Windows 7+# build leaves both out: wgpu's Direct3D 12 backend and AccessKit's Windows adapter need newer+# Windows (docs/windows7.md). The control channel reads egui's own AccessKit tree either way.+wgpu = ["eframe/wgpu"]+accessibility = ["eframe/accesskit"]+ [dependencies] craft-ui = { workspace = true } # The menus: native on macOS, an egui bar elsewhere, from one definition (menus.rs).@@ -25,7 +33,7 @@ pdfcraft-model = { workspace = true } pdfcraft-platform = { workspace = true } egui = { workspace = true, features = ["bytemuck", "default_fonts", "monochrome_emoji_fonts"] } egui_extras = { workspace = true }-eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "persistence", "links", "clipboard"] }+eframe = { workspace = true, features = ["default_fonts", "persistence", "links", "clipboard"] } serde = { workspace = true } serde_json = { workspace = true } log = { workspace = true }@@ -79,6 +87,12 @@ sys-locale = "0.3" # where the pointer is while files are dragged over the window (winit doesn't say). winsafe = { version = "0.0.29", default-features = false, features = ["advapi", "user"] } +# The Windows 7 build (docs/windows7.md) puts a copied image file on the clipboard through+# clipboard-win: arboard's file list calls PathCchStripPrefix, which needs Windows 8. Already in the+# tree through arboard, at this version.+[target.'cfg(target_vendor = "win7")'.dependencies]+clipboard-win = "5.4"+ [target.'cfg(target_arch = "wasm32")'.dependencies] rfd = { workspace = true, features = ["file-handle-inner"] } wasm-bindgen-futures = "0.4"diff --git a/crates/ui-egui/src/canvas/image_pick.rs b/crates/ui-egui/src/canvas/image_pick.rs--- a/crates/ui-egui/src/canvas/image_pick.rs+++ b/crates/ui-egui/src/canvas/image_pick.rs@@ -213,7 +213,18 @@ impl PdfCraftApp {         }         let dir = clipboard_dir().ok_or("there is no folder for the copied file")?;         let path = write_clipboard_file(&dir, name, bytes)?;-        arboard::Clipboard::new().and_then(|mut c| c.set().file_list(&[path])).map_err(|e| e.to_string())+        #[cfg(not(target_vendor = "win7"))]+        {+            arboard::Clipboard::new().and_then(|mut c| c.set().file_list(&[path])).map_err(|e| e.to_string())+        }+        // arboard's file list needs Windows 8 (PathCchStripPrefix); the Windows 7 build+        // (docs/windows7.md) writes the same CF_HDROP list through clipboard-win.+        #[cfg(target_vendor = "win7")]+        {+            let path = path.to_str().ok_or("the copied file's path isn't valid Unicode")?;+            let _open = clipboard_win::Clipboard::new_attempts(10).map_err(|e| e.to_string())?;+            clipboard_win::raw::set_file_list_with(&[path], clipboard_win::options::DoClear).map_err(|e| e.to_string())+        }     }      #[cfg(target_arch = "wasm32")]diff --git a/docs/roadmap.md b/docs/roadmap.md--- a/docs/roadmap.md+++ b/docs/roadmap.md@@ -1,5 +1,6 @@ # PdfCraft roadmap: milestones and what's next +> **Last reviewed:** 2026-10-25 | **Last updated:** 2026-10-27 | **Change:** minor (M14: experimental, unsupported Windows 7 SP1 x64 portable build, docs/windows7.md; not runtime-verified; estimates unchanged) > **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: OCR model downloads use verified ONNX pairs with legacy discovery fallback; estimates unchanged) > **Last reviewed:** 2026-10-25 | **Last updated:** 2026-10-25 | **Change:** minor (M14 localization current state: Arabic logical catalog, explicit RTL label direction and mirrored stock chrome; native/browser RTL workflows unqualified. Native release Hans face via LXGW WenKai Lite; estimates unchanged) > **Last reviewed:** 2026-10-23 · **Last updated:** 2026-10-23 · **Change:** minor (M7, #2636 partial: pasting added text boxes and images in the engine and through `content_copy`; estimates unchanged)@@ -200,7 +201,7 @@ total matches the parity estimate. | M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers<br>Done since: CLI run and MCP reject missing, empty, repeated and option-valued --root arguments before any tool/script execution or MCP initialization. A single-hyphen directory name remains valid; synthetic CLI regressions preserve a would-be overwritten file. `text_find` also caps the per-page match ranges it materializes at the remaining result limit plus one continuation match. CLI robustness scans visit each directory once through overlapping roots and symlink aliases. | | M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds. Character encoding accepts Identity-H/V with Adobe CJK collections and predefined CJK CMaps independently (#3673); per-glyph validation and embedded-font extraction remain separate.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded text-only auto-tag proposal tool; text-only Apply writes marked content, paragraph tags and a parent tree, then opens the Tags panel for review. Missing: mixed-content and field autotag, heading/list/table/figure classification, Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA<br>Done since: CLI info, text and render use dynamic XFA layout pages, with synthetic count/text/pixel and copy-permission regressions (#1645).<br>Reading colours: pending page backgrounds follow the configured colour (#2059). | | M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers<br>Done since: CLI run and MCP reject missing, empty, repeated and option-valued --root arguments before any tool/script execution or MCP initialization. A single-hyphen directory name remains valid; synthetic CLI regressions preserve a would-be overwritten file. `text_find` also caps the per-page match ranges it materializes at the remaining result limit plus one continuation match. |-| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian and Arabic (logical catalog; explicit right-to-left labels and mirrored stock chrome; end-to-end RTL workflows unqualified); the 2,674-entry Brazilian Portuguese catalog covers the current key union; Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Lithuanian adds a 2,578-entry catalog and date names, reviewed by a native-speaking contributor. Norwegian Bokmål adds a catalog and date names (terminology reviewed by a native speaker). Validated candidate (macOS raster probe; Windows runtime unverified): the Windows policy changes only embedded JetBrains Mono; horizontal alpha-edge energy per ink improves 2.78%, 3.87% and 1.59% at 100%, 125% and 150%, and is down 0.79% at 200%. Inter is pixel-identical; layout hashes, glyph coverage and the 8 MiB atlas are unchanged. Timing and RSS ranges overlap, with no improvement claimed. Estimates unchanged. Candidate #2383 clamps GPU requests to supported limits while retaining the adapter texture extent; synthetic V3D/downlevel and Windows GPU-required tests pass, but Raspberry Pi startup is unverified. Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation Linux/Unix UI fallback fonts also use Fontconfig directories, including Nix store paths, with bounded discovery and the existing candidate allowlist; relative includes and digit-prefixed config filtering have isolated regressions. Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation XDG desktops use the configuration base for preferences with non-overwriting migration and original-data preservation (#1395). Traditional Chinese accessibility statuses, rule semantics and Taiwan form/table terms have catalog regressions. Long main-menu lists scroll in short windows (#3373). Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation. Candidate #3558: bounded-worker macOS per-file PDFCraft association recovery after desktop open/save/sign; metadata-only watcher handling and upstream #3042 shared-writer preservation; recovery parser limits do not narrow save limits. Native workflow qualified on macOS 27.0.1; other versions and physical SMB/FUSE volumes remain unqualified. Estimates unchanged. Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean/Vietnamese, file-backed input and global memory budgets, performance budgets, keyboard-only operation. |+| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian and Arabic (logical catalog; explicit right-to-left labels and mirrored stock chrome; end-to-end RTL workflows unqualified); the 2,674-entry Brazilian Portuguese catalog covers the current key union; Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64) and an experimental, unsupported Windows 7 x64 portable build (`windows7.md`; built in CI, not runtime-verified), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Lithuanian adds a 2,578-entry catalog and date names, reviewed by a native-speaking contributor. Norwegian Bokmål adds a catalog and date names (terminology reviewed by a native speaker). Validated candidate (macOS raster probe; Windows runtime unverified): the Windows policy changes only embedded JetBrains Mono; horizontal alpha-edge energy per ink improves 2.78%, 3.87% and 1.59% at 100%, 125% and 150%, and is down 0.79% at 200%. Inter is pixel-identical; layout hashes, glyph coverage and the 8 MiB atlas are unchanged. Timing and RSS ranges overlap, with no improvement claimed. Estimates unchanged. Candidate #2383 clamps GPU requests to supported limits while retaining the adapter texture extent; synthetic V3D/downlevel and Windows GPU-required tests pass, but Raspberry Pi startup is unverified. Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation Linux/Unix UI fallback fonts also use Fontconfig directories, including Nix store paths, with bounded discovery and the existing candidate allowlist; relative includes and digit-prefixed config filtering have isolated regressions. Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation XDG desktops use the configuration base for preferences with non-overwriting migration and original-data preservation (#1395). Traditional Chinese accessibility statuses, rule semantics and Taiwan form/table terms have catalog regressions. Long main-menu lists scroll in short windows (#3373). Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation. Candidate #3558: bounded-worker macOS per-file PDFCraft association recovery after desktop open/save/sign; metadata-only watcher handling and upstream #3042 shared-writer preservation; recovery parser limits do not narrow save limits. Native workflow qualified on macOS 27.0.1; other versions and physical SMB/FUSE volumes remain unqualified. Estimates unchanged. Missing: end-to-end RTL workflow qualification, a Chinese web UI face, Hindi/Indonesian/Korean/Vietnamese, file-backed input and global memory budgets, performance budgets, keyboard-only operation. | | M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers | | | **Total** | **2,085–3,840** | **≈ 49% ready** | **≈ 770–1,400** | Area view of the same work: [target-app-parity.md](target-app-parity.md#by-feature-area) | diff --git a/docs/windows7.md b/docs/windows7.mdnew file mode 100644--- /dev/null+++ b/docs/windows7.md@@ -0,0 +1,104 @@+# Windows 7 x64 compatibility build (experimental, unsupported)++> **Status:** experimental, not runtime-verified · **Last updated:** 2026-10-27 · **Change:** new (ported from VectorCraft's Windows 7 build)++Windows 7 is not a supported platform. This build is experimental and community-maintained,+and the PdfCraft maintainers have not verified it on Windows 7. It follows VectorCraft's Windows 7+build (storytold/vectorcraft `docs/windows7.md`), with the same toolchain, patch and checks.++This separate build targets **64-bit Windows 7 SP1**. Compared with the regular Windows build:++- It draws with **OpenGL** only. wgpu (Direct3D 12) is left out, so `PDFCRAFT_RENDERER` and the+  GPU selection described in the regular build don't apply. A vendor graphics driver providing+  **OpenGL 3.3 or newer** is required; Windows' built-in generic display driver is insufficient.+- The native **AccessKit** accessibility adapter is left out: screen readers don't see the UI.+  The UI control channel (`--control`) still works; it reads egui's own accessibility tree.+- **Printing** hands the print-ready PDF to the installed PDF viewer's Print / PrintTo verb.+  The regular build draws jobs with `Windows.Data.Pdf`, a Windows Runtime API Windows 7 doesn't+  have. The printer list still comes from the spooler, but the viewer prints with its own+  settings: copies, two-sided and scaling chosen in PdfCraft's Print dialog don't reach it (the+  result says so). A PDF viewer that can print must be installed, and it can't be PdfCraft itself.+- Windows' **Animation effects** setting isn't read (it is a Windows Runtime API too):+  Preferences ▸ Animation effects decides.+- Handing files to an already running PdfCraft (single instance) needs Unix domain sockets,+  which Windows 7 lacks: each launch opens a window of its own, as `--new-window` does.++The `windows7` feature and the win7 Rust target must be selected together; compile-time guards+in `apps/pdfcraft/src/main.rs` reject mixing this feature with the ordinary Windows target, and+with the `wgpu` and `accessibility` features. The normal desktop and web builds keep their+existing defaults.++## Build or download++In your GitHub fork, open **Actions → Windows 7 x64 compatibility → Run workflow** (it also runs+weekly and on pull requests changing the compatibility path). When it succeeds, download the+`pdfcraft-windows7-x64-portable` artifact, extract the contained portable ZIP, then run+`pdfcraft.exe` on Windows 7. The CLI is included, and the OCR models when their download+succeeded (see below). No MSI is provided: the existing installer remains for modern Windows.++To build locally, use a **Windows 10/11 build computer**, with Rust/rustup and Visual Studio 2022+C++ build tools (x64 compiler and Windows SDK). Open an **x64 Native Tools Command Prompt for+VS 2022**, change to your clone's repository root (the directory containing `Cargo.toml`), and run:++```powershell+powershell -ExecutionPolicy Bypass -File packaging/windows/windows7.ps1+```++Add `-Test` to also run the app, CLI and print tests on the build computer.++Output: `dist/release/pdfcraft-windows7-x64-portable.zip`. The script installs the pinned nightly+compiler and `rust-src`, rebuilds the standard library for `x86_64-win7-windows-msvc`, and links+the C runtime statically. It never installs Rust on the Windows 7 machine. It fetches the OCR+models with `cargo xtask models`, so it needs the network; when the model host refuses the+download, it warns and builds the ZIP without a `models` folder, so OCR won't run. The optional `CRAFT_FONTS_DIR` setting+works as in the normal build. Without it, install fonts for the languages you need on the+destination machine.++The Windows 7 target matters: modern Rust's ordinary `x86_64-pc-windows-msvc` target requires+Windows 10, including standard-library and random-number APIs. Selecting OpenGL alone or changing+an installer version check cannot fix that.++References: [Rust's Windows 7 target](https://doc.rust-lang.org/rustc/platform-support/win7-windows-msvc.html)+and [Windows baseline change](https://blog.rust-lang.org/2024/02/26/Windows-7/).++The packaging script checks x64 PE headers, the subsystem version, and known incompatible imports+(including `GetSystemTimePreciseAsFileTime`, `combase.dll` and the Windows Runtime's+`api-ms-win-core-winrt-*`) before creating the ZIP. This is a regression check, not an exhaustive+audit of every Windows API. craft-print stays in the dependency tree for its job and printer+types; its Windows Runtime spooler is never called on this target+(`crates/print/src/spool/windows7.rs`), and the import check guards that it isn't linked.++The small vendored `windows-link` patch routes `CoTaskMemFree` to its documented `ole32.dll`+export on the Windows 7 target; the newer binding otherwise imports `combase.dll`, which is absent+on Windows 7. Only this script uses it: it passes+`--config "patch.crates-io.windows-link.path='vendor/windows-link'"` to Cargo, so every other+build, including the normal Windows one, keeps the checksum-verified crates.io crate. Cargo+records the patch in `Cargo.lock`, so the script resolves once, fails if anything other than+windows-link's source changed, builds with `--locked`, and then restores `Cargo.lock`.++## Runtime validation++None yet. A successful build on the Windows 2022 CI runner does **not** prove Windows 7 runtime+compatibility.++## Runtime acceptance checklist++Before declaring support, test on a Windows 7 SP1 x64 machine and record its GPU, driver version,+Windows updates and any missing-DLL/entry-point error:++- Start `pdfcraft.exe`; verify a visible window and page, resizing, minimize/restore and exit.+- Open a PDF, scroll, zoom and search; add a comment, save, close and reopen it.+- Fill a form field, sign with a new self-signed digital ID, and validate the signature.+- Export a page as PNG and the document as text; run OCR on a scanned page.+- Exercise native Open/Save dialogs, clipboard text/images and drag-and-drop.+- Print to a printer (or Microsoft XPS Document Writer) with a PDF viewer installed.+- Change a preference, exit and verify it survives restarting.+- Run `pdfcraft-cli.exe --version` and `pdfcraft-cli.exe tools` from a Command Prompt in the+  extracted application folder.++This build is experimental until that checklist passes. New dependency versions can add newer+Windows imports, so retain Cargo.lock and repeat runtime QA after dependency updates.++## Revision history++- 2026-10-27: First version, ported from VectorCraft's Windows 7 build. Review: OCR models are optional in the ZIP; the print verb runs with a time limit and gets the file and printer as data.diff --git a/packaging/windows/windows7.ps1 b/packaging/windows/windows7.ps1new file mode 100644--- /dev/null+++ b/packaging/windows/windows7.ps1@@ -0,0 +1,130 @@+<# Experimental, unsupported Windows 7 SP1 x64 build (docs/windows7.md), ported from VectorCraft's.+   Build on Windows 10/11 with the VS 2022 x64 C++ tools and Windows SDK.+   From the repository root: powershell -File packaging/windows/windows7.ps1 [-Test]+   The resulting portable ZIP targets Windows 7 SP1 x64 with an OpenGL 3.3 driver.+   The compiler runs on the build host, not on Windows 7. -Test also runs the app, CLI and print+   tests on the build host. #>+param([string] $Toolchain = 'nightly-2026-10-01', [switch] $Test)+$ErrorActionPreference = 'Stop'+$Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path+$Target = 'x86_64-win7-windows-msvc'+function Invoke-Checked([scriptblock] $Command) {+  & $Command+  if ($LASTEXITCODE -ne 0) { throw "Command failed with exit code $LASTEXITCODE" }+}+# Cargo.lock without windows-link's registry source and checksum lines (and with LF line endings),+# so the lock files with and without the patch below compare equal.+function Get-LockWithoutWindowsLinkSource([string] $Text) {+  ($Text -replace "`r`n", "`n") -replace '(?m)^(name = "windows-link"\nversion = "[^"]*"\n)source = "[^"]*"\nchecksum = "[^"]*"\n', '$1'+}+Push-Location $Root+$FlagName = 'CARGO_TARGET_X86_64_WIN7_WINDOWS_MSVC_RUSTFLAGS'+$OldFlags = [Environment]::GetEnvironmentVariable($FlagName)+$OldWinres = $env:PDFCRAFT_REQUIRE_WINRES+$OldAwsLcBuilder = $env:AWS_LC_SYS_CMAKE_BUILDER+$Lock = Join-Path $Root 'Cargo.lock'+$LockBytes = [IO.File]::ReadAllBytes($Lock)+try {+  Invoke-Checked { rustup toolchain install $Toolchain --profile minimal --component rust-src }+  # windows-sys imports CoTaskMemFree from combase.dll, which Windows 7 lacks. Only this build uses+  # the patched copy in vendor/windows-link (see its PDFCRAFT-PATCH.md); every other build keeps+  # the crates.io crate. Cargo records the patch in Cargo.lock, so resolve once, check that nothing+  # but windows-link's source moved, then build --locked. The finally block restores Cargo.lock.+  $Patch = @('--config', "patch.crates-io.windows-link.path='vendor/windows-link'")+  Invoke-Checked { cargo "+$Toolchain" metadata --format-version 1 @Patch | Out-Null }+  $Before = Get-LockWithoutWindowsLinkSource ([Text.Encoding]::UTF8.GetString($LockBytes))+  $After = Get-LockWithoutWindowsLinkSource ([IO.File]::ReadAllText($Lock))+  if ($Before -cne $After) { throw 'Cargo.lock is out of date: applying the windows-link patch changed other entries' }+  # --no-default-features drops wgpu and the AccessKit adapter from the app, and the CLI's default+  # MCP server with them, so the CLI asks for it back.+  $CargoArgs = @('--locked') + $Patch + @('--target', $Target, '--no-default-features', '--features', 'pdfcraft/windows7,pdfcraft-cli/mcp')+  $Tree = cargo "+$Toolchain" tree @CargoArgs -p pdfcraft -p pdfcraft-cli -e normal --prefix none+  if ($LASTEXITCODE -ne 0) { throw 'dependency inspection failed' }+  # craft-print stays for its job and printer types, but its Windows.Data.Pdf spooler is never+  # called on this target (crates/print/src/spool/windows7.rs); the import check below guards that.+  if ($Tree -match '^(wgpu|wgpu-core|wgpu-hal|accesskit_windows) v') { throw 'unsupported Windows backend in compatibility build' }+  if (-not ($Tree -match '^windows-link v[^ ]+ \(.*vendor[\\/]windows-link\)')) { throw 'the patched windows-link is not in use' }+  # The ordinary pc-windows-msvc standard library requires Windows 10. Rebuild std for win7.+  [Environment]::SetEnvironmentVariable($FlagName, '-C target-feature=+crt-static')+  # aws-lc picks its random source at compile time: built for Windows 8+ it looks up ProcessPrng at+  # run time and aborts when it is missing. Its cc builder targets Windows 7 on a win7 triple (and+  # so uses BCryptGenRandom); its CMake builder doesn't, so never let it fall back to CMake.+  $env:AWS_LC_SYS_CMAKE_BUILDER = '0'+  $env:PDFCRAFT_REQUIRE_WINRES = '1'+  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') }+  $BuildArgs = $CargoArgs + @('-p', 'pdfcraft', '-p', 'pdfcraft-cli')+  Invoke-Checked { cargo "+$Toolchain" build -Z build-std=std,panic_unwind @BuildArgs --release }+  $TargetDir = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { 'target' }+  $Bin = Join-Path $TargetDir "$Target\release"+  # PE subsystem: 2 = Windows GUI (the app opens no console), 3 = console (the CLI's output reaches it).+  foreach ($Check in @(@('pdfcraft.exe', 2), @('pdfcraft-cli.exe', 3))) {+    $Name = $Check[0]+    $Exe = Join-Path $Bin $Name+    $Bytes = [IO.File]::ReadAllBytes($Exe)+    $Pe = [BitConverter]::ToInt32($Bytes, 0x3c)+    if ([BitConverter]::ToUInt16($Bytes, $Pe + 4) -ne 0x8664) { throw "$Name is not x64" }+    $Major = [BitConverter]::ToUInt16($Bytes, $Pe + 0x48)+    $Minor = [BitConverter]::ToUInt16($Bytes, $Pe + 0x4a)+    if ($Major -gt 6 -or ($Major -eq 6 -and $Minor -gt 1)) { throw "$Name requires subsystem $Major.$Minor" }+    $Subsystem = [BitConverter]::ToUInt16($Bytes, $Pe + 0x5c)+    if ($Subsystem -ne $Check[1]) { throw "$Name has PE subsystem $Subsystem, expected $($Check[1])" }+    $Imports = & dumpbin /nologo /imports $Exe+    if ($LASTEXITCODE -ne 0) { throw "Could not inspect $Name imports" }+    # Regression gate for known loader failures; actual Win7 runtime QA remains necessary.+    # combase.dll and api-ms-win-core-winrt-* are the Windows Runtime (Windows 8+), dcomp.dll is+    # DirectComposition (Windows 8+) and d3d12.dll is Direct3D 12 (Windows 10).+    # The DLLs are listed every time, so a run records what the build imports.+    Write-Output "$Name imports:" ($Imports | Where-Object { $_ -match '^\s+\S+\.dll\s*$' } | ForEach-Object { '  ' + $_.Trim() })+    $Bad = @($Imports | Where-Object { $_ -match '(?i)\b(GetSystemTimePreciseAsFileTime|ProcessPrng|WaitOnAddress|WakeByAddressSingle|WakeByAddressAll)\b|combase\.dll|bcryptprimitives\.dll|d3d12\.dll|dcomp\.dll|api-ms-win-core-path-|api-ms-win-core-winrt-' })+    if ($Bad.Count -gt 0) {+      throw "$Name directly imports a known post-Windows-7 API: $(($Bad | ForEach-Object { $_.Trim() }) -join ', ')"+    }+  }+  Invoke-Checked { & (Join-Path $Bin 'pdfcraft-cli.exe') --version }+  $Stage = Join-Path $TargetDir ('windows7-portable-' + [Guid]::NewGuid().ToString('N'))+  New-Item -ItemType Directory -Force $Stage | Out-Null+  Copy-Item (Join-Path $Bin 'pdfcraft.exe'), (Join-Path $Bin 'pdfcraft-cli.exe') $Stage+  # The same notices as the regular portable zip (package.ps1), plus windows-link's licences.+  Copy-Item README.md, LICENSE-MIT, LICENSE-APACHE, NOTICE, assets/app-icon/LICENSE-document.txt $Stage+  Copy-Item vendor/windows-link/license-mit (Join-Path $Stage 'LICENSE-windows-link-MIT')+  Copy-Item vendor/windows-link/license-apache-2.0 (Join-Path $Stage 'LICENSE-windows-link-Apache-2.0')+  Copy-Item docs/windows7.md (Join-Path $Stage 'WINDOWS7.md')+  # OCR models (#103), as in the regular packages: models\ beside pdfcraft.exe.+  $Models = Join-Path $Stage 'models'+  New-Item -ItemType Directory -Force $Models | Out-Null+  # With the patch and --locked too, so the lock file stays as the build and the tests need it.+  # Best effort in this experimental build: when the model host refuses the download, the ZIP+  # ships without models\ (OCR then can't run) rather than not at all.+  cargo "+$Toolchain" @Patch --locked xtask models $Models+  if ($LASTEXITCODE -ne 0) {+    Write-Warning "the OCR models couldn't be fetched (exit code $LASTEXITCODE): this ZIP has no models folder, so OCR won't run"+    Remove-Item -Recurse -Force $Models+  } else {+    Remove-Item -Force (Join-Path $Models '*.part') -ErrorAction SilentlyContinue+  }+  if ($env:CRAFT_FONTS_DIR) {+    . (Join-Path $PSScriptRoot 'font-notices.ps1')+    foreach ($ofl in @(Get-CraftFontNotices $env:CRAFT_FONTS_DIR (Test-Path Env:CRAFT_FONTS_REQUIRED))) {+      Copy-Item -LiteralPath $ofl.FullName -Destination (Join-Path $Stage "OFL-$($ofl.Directory.Name).txt")+    }+  }+  # portable.txt switches on portable mode, as in the regular portable zip (#157).+  Copy-Item (Join-Path $PSScriptRoot 'portable.txt') $Stage+  New-Item -ItemType Directory -Force dist/release | Out-Null+  $Zip = Join-Path $Root 'dist/release/pdfcraft-windows7-x64-portable.zip'+  Compress-Archive -Path (Join-Path $Stage '*') -DestinationPath $Zip -Force+  Remove-Item -Recurse -Force $Stage+  Get-Item $Zip+  if ($Test) {+    # Exercises the Windows code paths on the build host only; it doesn't prove Windows 7 runtime support.+    $TestArgs = $CargoArgs + @('-p', 'pdfcraft', '-p', 'pdfcraft-cli', '-p', 'pdfcraft-print')+    Invoke-Checked { cargo "+$Toolchain" test -Z build-std=std,panic_unwind,test @TestArgs }+  }+} finally {+  [IO.File]::WriteAllBytes($Lock, $LockBytes)+  [Environment]::SetEnvironmentVariable($FlagName, $OldFlags)+  $env:PDFCRAFT_REQUIRE_WINRES = $OldWinres+  $env:AWS_LC_SYS_CMAKE_BUILDER = $OldAwsLcBuilder+  Pop-Location+}diff --git a/vendor/README.md b/vendor/README.md--- a/vendor/README.md+++ b/vendor/README.md@@ -22,6 +22,14 @@ including its `surface_fit` tests exercised by PdfCraft's behavioral tests. Keep both copies while their provenance tests remain in use. Renderer and security vendors below retain their independent path patches and licenses. +## windows-link (the Windows 7 build only)++`vendor/windows-link` is windows-link 0.2.1 with one `PdfCraft patch:`: on the win7 target its+`link!` macro imports `CoTaskMemFree` from `ole32.dll` instead of `combase.dll`, which Windows 7+lacks. It is not in the root `[patch.crates-io]`: only `packaging/windows/windows7.ps1` applies it,+with `--config`, so every other build uses the checksum-verified crates.io crate. See+`vendor/windows-link/PDFCRAFT-PATCH.md` and `docs/windows7.md`.+ Permissively licensed crates we carry small patches for. Each directory keeps the upstream 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 releasesdiff --git a/vendor/windows-link/Cargo.toml b/vendor/windows-link/Cargo.tomlnew file mode 100644--- /dev/null+++ b/vendor/windows-link/Cargo.toml@@ -0,0 +1,39 @@+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO+#+# When uploading crates to the registry Cargo will automatically+# "normalize" Cargo.toml files for maximal compatibility+# with all versions of Cargo and also rewrite `path` dependencies+# to registry (e.g., crates.io) dependencies.+#+# If you are reading this file be aware that the original Cargo.toml+# will likely look very different (and much more reasonable).+# See Cargo.toml.orig for the original contents.++[package]+edition = "2021"+rust-version = "1.71"+name = "windows-link"+version = "0.2.1"+build = false+autolib = false+autobins = false+autoexamples = false+autotests = false+autobenches = false+description = "Linking for Windows"+readme = "readme.md"+categories = ["os::windows-apis"]+license = "MIT OR Apache-2.0"+repository = "https://github.com/microsoft/windows-rs"++[lib]+name = "windows_link"+path = "src/lib.rs"++[lints.rust]+missing_unsafe_on_extern = "warn"++[lints.rust.unexpected_cfgs]+level = "warn"+priority = 0+check-cfg = ["cfg(windows_raw_dylib, windows_slim_errors)"]diff --git a/vendor/windows-link/PDFCRAFT-PATCH.md b/vendor/windows-link/PDFCRAFT-PATCH.mdnew file mode 100644--- /dev/null+++ b/vendor/windows-link/PDFCRAFT-PATCH.md@@ -0,0 +1,22 @@+# Windows 7 x64 import compatibility++Upstream: Microsoft windows-link 0.2.1, from crates.io, MIT OR Apache-2.0.+Source: https://crates.io/crates/windows-link/0.2.1+The original license texts are retained here. The same patch is carried by VectorCraft's+Windows 7 build (storytold/vectorcraft `vendor/windows-link`).++Only the non-x86 win7-target macro differs: CoTaskMemFree is imported from+ole32.dll rather than combase.dll. windows-sys 0.61.2 otherwise causes native+file dialogs to introduce a DLL absent on Windows 7. Ordinary targets retain+upstream behavior. This is a binding correction, not a replacement allocator.++Microsoft documents Ole32.dll and Windows 2000 as the API's minimum:+https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemfree++Only the experimental Windows 7 build uses this copy: packaging/windows/windows7.ps1+passes `--config "patch.crates-io.windows-link.path='vendor/windows-link'"`. The+workspace has no windows-link entry in `[patch]`, so every other build uses the crates.io+crate, verified by the checksum in Cargo.lock.++The Windows 7 packaging check rejects combase.dll to guard this fix. Remove this+patch when upstream bindings provide the same compatibility and recheck imports.diff --git a/vendor/windows-link/license-apache-2.0 b/vendor/windows-link/license-apache-2.0new file mode 100644--- /dev/null+++ b/vendor/windows-link/license-apache-2.0@@ -0,0 +1,201 @@+                                 Apache License+                           Version 2.0, January 2004+                        http://www.apache.org/licenses/++   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++   1. Definitions.++      "License" shall mean the terms and conditions for use, reproduction,+      and distribution as defined by Sections 1 through 9 of this document.++      "Licensor" shall mean the copyright owner or entity authorized by+      the copyright owner that is granting the License.++      "Legal Entity" shall mean the union of the acting entity and all+      other entities that control, are controlled by, or are under common+      control with that entity. For the purposes of this definition,+      "control" means (i) the power, direct or indirect, to cause the+      direction or management of such entity, whether by contract or+      otherwise, or (ii) ownership of fifty percent (50%) or more of the+      outstanding shares, or (iii) beneficial ownership of such entity.++      "You" (or "Your") shall mean an individual or Legal Entity+      exercising permissions granted by this License.++      "Source" form shall mean the preferred form for making modifications,+      including but not limited to software source code, documentation+      source, and configuration files.++      "Object" form shall mean any form resulting from mechanical+      transformation or translation of a Source form, including but+      not limited to compiled object code, generated documentation,+      and conversions to other media types.++      "Work" shall mean the work of authorship, whether in Source or+      Object form, made available under the License, as indicated by a+      copyright notice that is included in or attached to the work+      (an example is provided in the Appendix below).++      "Derivative Works" shall mean any work, whether in Source or Object+      form, that is based on (or derived from) the Work and for which the+      editorial revisions, annotations, elaborations, or other modifications+      represent, as a whole, an original work of authorship. For the purposes+      of this License, Derivative Works shall not include works that remain+      separable from, or merely link (or bind by name) to the interfaces of,+      the Work and Derivative Works thereof.++      "Contribution" shall mean any work of authorship, including+      the original version of the Work and any modifications or additions+      to that Work or Derivative Works thereof, that is intentionally+      submitted to Licensor for inclusion in the Work by the copyright owner+      or by an individual or Legal Entity authorized to submit on behalf of+      the copyright owner. For the purposes of this definition, "submitted"+      means any form of electronic, verbal, or written communication sent+      to the Licensor or its representatives, including but not limited to+      communication on electronic mailing lists, source code control systems,+      and issue tracking systems that are managed by, or on behalf of, the+      Licensor for the purpose of discussing and improving the Work, but+      excluding communication that is conspicuously marked or otherwise+      designated in writing by the copyright owner as "Not a Contribution."++      "Contributor" shall mean Licensor and any individual or Legal Entity+      on behalf of whom a Contribution has been received by Licensor and+      subsequently incorporated within the Work.++   2. Grant of Copyright License. Subject to the terms and conditions of+      this License, each Contributor hereby grants to You a perpetual,+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable+      copyright license to reproduce, prepare Derivative Works of,+      publicly display, publicly perform, sublicense, and distribute the+      Work and such Derivative Works in Source or Object form.++   3. Grant of Patent License. Subject to the terms and conditions of+      this License, each Contributor hereby grants to You a perpetual,+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable+      (except as stated in this section) patent license to make, have made,+      use, offer to sell, sell, import, and otherwise transfer the Work,+      where such license applies only to those patent claims licensable+      by such Contributor that are necessarily infringed by their+      Contribution(s) alone or by combination of their Contribution(s)+      with the Work to which such Contribution(s) was submitted. If You+      institute patent litigation against any entity (including a+      cross-claim or counterclaim in a lawsuit) alleging that the Work+      or a Contribution incorporated within the Work constitutes direct+      or contributory patent infringement, then any patent licenses+      granted to You under this License for that Work shall terminate+      as of the date such litigation is filed.++   4. Redistribution. You may reproduce and distribute copies of the+      Work or Derivative Works thereof in any medium, with or without+      modifications, and in Source or Object form, provided that You+      meet the following conditions:++      (a) You must give any other recipients of the Work or+          Derivative Works a copy of this License; and++      (b) You must cause any modified files to carry prominent notices+          stating that You changed the files; and++      (c) You must retain, in the Source form of any Derivative Works+          that You distribute, all copyright, patent, trademark, and+          attribution notices from the Source form of the Work,+          excluding those notices that do not pertain to any part of+          the Derivative Works; and++      (d) If the Work includes a "NOTICE" text file as part of its+          distribution, then any Derivative Works that You distribute must+          include a readable copy of the attribution notices contained+          within such NOTICE file, excluding those notices that do not+          pertain to any part of the Derivative Works, in at least one+          of the following places: within a NOTICE text file distributed+          as part of the Derivative Works; within the Source form or+          documentation, if provided along with the Derivative Works; or,+          within a display generated by the Derivative Works, if and+          wherever such third-party notices normally appear. The contents+          of the NOTICE file are for informational purposes only and+          do not modify the License. You may add Your own attribution+          notices within Derivative Works that You distribute, alongside+          or as an addendum to the NOTICE text from the Work, provided+          that such additional attribution notices cannot be construed+          as modifying the License.++      You may add Your own copyright statement to Your modifications and+      may provide additional or different license terms and conditions+      for use, reproduction, or distribution of Your modifications, or+      for any such Derivative Works as a whole, provided Your use,+      reproduction, and distribution of the Work otherwise complies with+      the conditions stated in this License.++   5. Submission of Contributions. Unless You explicitly state otherwise,+      any Contribution intentionally submitted for inclusion in the Work+      by You to the Licensor shall be under the terms and conditions of+      this License, without any additional terms or conditions.+      Notwithstanding the above, nothing herein shall supersede or modify+      the terms of any separate license agreement you may have executed+      with Licensor regarding such Contributions.++   6. Trademarks. This License does not grant permission to use the trade+      names, trademarks, service marks, or product names of the Licensor,+      except as required for reasonable and customary use in describing the+      origin of the Work and reproducing the content of the NOTICE file.++   7. Disclaimer of Warranty. Unless required by applicable law or+      agreed to in writing, Licensor provides the Work (and each+      Contributor provides its Contributions) on an "AS IS" BASIS,+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+      implied, including, without limitation, any warranties or conditions+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+      PARTICULAR PURPOSE. You are solely responsible for determining the+      appropriateness of using or redistributing the Work and assume any+      risks associated with Your exercise of permissions under this License.++   8. Limitation of Liability. In no event and under no legal theory,+      whether in tort (including negligence), contract, or otherwise,+      unless required by applicable law (such as deliberate and grossly+      negligent acts) or agreed to in writing, shall any Contributor be+      liable to You for damages, including any direct, indirect, special,+      incidental, or consequential damages of any character arising as a+      result of this License or out of the use or inability to use the+      Work (including but not limited to damages for loss of goodwill,+      work stoppage, computer failure or malfunction, or any and all+      other commercial damages or losses), even if such Contributor+      has been advised of the possibility of such damages.++   9. Accepting Warranty or Additional Liability. While redistributing+      the Work or Derivative Works thereof, You may choose to offer,+      and charge a fee for, acceptance of support, warranty, indemnity,+      or other liability obligations and/or rights consistent with this+      License. However, in accepting such obligations, You may act only+      on Your own behalf and on Your sole responsibility, not on behalf+      of any other Contributor, and only if You agree to indemnify,+      defend, and hold each Contributor harmless for any liability+      incurred by, or claims asserted against, such Contributor by reason+      of your accepting any such warranty or additional liability.++   END OF TERMS AND CONDITIONS++   APPENDIX: How to apply the Apache License to your work.++      To apply the Apache License to your work, attach the following+      boilerplate notice, with the fields enclosed by brackets "[]"+      replaced with your own identifying information. (Don't include+      the brackets!)  The text should be enclosed in the appropriate+      comment syntax for the file format. We also recommend that a+      file or class name and description of purpose be included on the+      same "printed page" as the copyright notice for easier+      identification within third-party archives.++   Copyright (c) Microsoft Corporation.++   Licensed under the Apache License, Version 2.0 (the "License");+   you may not use this file except in compliance with the License.+   You may obtain a copy of the License at++       http://www.apache.org/licenses/LICENSE-2.0++   Unless required by applicable law or agreed to in writing, software+   distributed under the License is distributed on an "AS IS" BASIS,+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+   See the License for the specific language governing permissions and+   limitations under the License.diff --git a/vendor/windows-link/license-mit b/vendor/windows-link/license-mitnew file mode 100644--- /dev/null+++ b/vendor/windows-link/license-mit@@ -0,0 +1,21 @@+    MIT License++    Copyright (c) Microsoft Corporation.++    Permission is hereby granted, free of charge, to any person obtaining a copy+    of this software and associated documentation files (the "Software"), to deal+    in the Software without restriction, including without limitation the rights+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+    copies of the Software, and to permit persons to whom the Software is+    furnished to do so, subject to the following conditions:++    The above copyright notice and this permission notice shall be included in all+    copies or substantial portions of the Software.++    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+    SOFTWAREdiff --git a/vendor/windows-link/readme.md b/vendor/windows-link/readme.mdnew file mode 100644--- /dev/null+++ b/vendor/windows-link/readme.md@@ -0,0 +1,26 @@+## Linking for Windows++The [windows-link](https://crates.io/crates/windows-link) crate provides the `link` macro that simplifies linking. The `link` macro is much the same as the one provided by [windows-targets](https://crates.io/crates/windows-targets) but uses `raw-dylib` and thus does not require import lib files.++* [Getting started](https://kennykerr.ca/rust-getting-started/)+* [Samples](https://github.com/microsoft/windows-rs/tree/master/crates/samples)+* [Releases](https://github.com/microsoft/windows-rs/releases)++Start by adding the following to your Cargo.toml file:++```toml+[dependencies.windows-link]+version = "0.2"+```++Use the `link` macro to define the external functions you wish to call:++```rust+windows_link::link!("kernel32.dll" "system" fn SetLastError(code: u32));+windows_link::link!("kernel32.dll" "system" fn GetLastError() -> u32);++unsafe {+    SetLastError(1234);+    assert_eq!(GetLastError(), 1234);+}+```diff --git a/vendor/windows-link/src/lib.rs b/vendor/windows-link/src/lib.rsnew file mode 100644--- /dev/null+++ b/vendor/windows-link/src/lib.rs@@ -0,0 +1,57 @@+#![doc = include_str!("../readme.md")]+#![no_std]++/// Defines an external function to import.+#[cfg(all(windows, target_arch = "x86"))]+#[macro_export]+macro_rules! link {+    ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (+        #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated")]+        extern $abi {+            $(#[link_name=$link_name])?+            pub fn $($function)*;+        }+    )+}++/// Defines an external function to import.+#[cfg(all(windows, not(target_arch = "x86"), not(target_vendor = "win7")))]+#[macro_export]+macro_rules! link {+    ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (+        #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")]+        extern $abi {+            $(#[link_name=$link_name])?+            pub fn $($function)*;+        }+    )+}++/// Defines an external function to import.+#[cfg(not(windows))]+#[macro_export]+macro_rules! link {+    ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (+        extern $abi {+            pub fn $($function)*;+        }+    )+}++// PdfCraft patch (Windows 7 build): windows-sys 0.61.2 binds CoTaskMemFree to+// combase.dll (Windows 8+). The same API is exported by ole32.dll on Windows 7.+// Redirect only this known API; leave every other binding unchanged.+#[cfg(all(windows, not(target_arch = "x86"), target_vendor = "win7"))]+#[macro_export]+macro_rules! link {+    ("combase.dll" $abi:literal fn CoTaskMemFree $($signature:tt)*) => (+        $crate::link!("ole32.dll" $abi fn CoTaskMemFree $($signature)*);+    );+    ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (+        #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")]+        extern $abi {+            $(#[link_name=$link_name])?+            pub fn $($function)*;+        }+    )+}