Files
James Locke 754f4d70e0 Print on Windows in-process, without PowerShell
craft-print's Windows backend ran an embedded PowerShell script for the printer list and every
job. Under App Control for Business or AppLocker script enforcement that script runs in
Constrained Language Mode and every job fails (storytold/pdfcraft#1107). The backend now runs
in this process and starts no program:

- Printers come from EnumPrinters and the default from GetDefaultPrinter; Printer::two_sided
  from each driver's PrintCapabilities. The list is sorted, each name once.
- A job is drawn as vectors by the in-box Windows.Data.Pdf with Direct2D into the XPS print
  API (winprint). Copies, collation, duplex (left out for duplex: None), colour, orientation
  and the driver's own paper option go in a PrintTicket the driver validates; a ticket the
  driver changed (paper, orientation, scaling) is refused before anything is sent. The driver
  paper named like the standard size is preferred (pdfcraft#599).
- A job has one ticket, so one paper shape. A small lenient reader (sheets.rs) reads the
  print-ready PDF's sheets and, when needed, appends an incremental update: /Rotate for sheets
  of the other orientation, and for Scaling::ShrinkToFit a reframe onto the driver's matching
  or default paper (shrunk inside its widest hardware margin, never enlarged, centred).
  Exact size refuses mixed paper sizes and paper the driver lacks.
- command_preview describes the in-process job on Windows ("xps-print", key=value options).
- windows_print.ps1 and the PowerShell helpers are gone. open_printer_preferences (rundll32)
  and the CUPS path are unchanged, as is the public API.

The end-to-end test puts a paused Generic / Text Only printer on LPT1: (no port to remove
afterwards; a paused FILE: queue never takes the job) and checks a mixed-orientation exact job
and a shrink-to-fit job each land as one job with all sheets. The reader is tested on every
platform with classic and compressed cross-references and thousands of truncated and corrupted
files. Windows-only dependencies: winprint =0.2.1 (default features off), winsafe 0.0.29,
roxmltree 0.20, miniz_oxide 0.8.

Ported from PdfCraft's native printing branch (pdfcraft#1132), which carries #599's approach.

Co-authored-by: durtyrobbin <76844303+durtyrobbin@users.noreply.github.com>
Co-authored-by: Dimitar Klaturov <7221384+bulgariamitko@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:03:54 -07:00

65 lines
3.7 KiB
Plaintext

craft-libs
Copyright (c) 2026 ArtCraft Team and the craft-libs contributors.
Licensed under the MIT License or the Apache License, Version 2.0, at your option
(LICENSE-MIT, LICENSE-APACHE).
Third-party material
This product bundles third-party material under its own licenses, listed below. The per-file
list (author, source, license) is in ATTRIBUTION.md.
None: every bundled asset is original to craft-libs.
Source provenance
The SVG icon preparation in crates/ui is adapted from:
- PhotoCraft, crates/ui-egui/src/icons.rs, revision e7a83ca342cdff568254f85f442b9cc8afb08066.
https://github.com/storytold/photocraft
Copyright (c) 2026 ArtCraft Team and the PhotoCraft contributors.
- VectorCraft, crates/ui-egui/src/icons.rs, revision 825d4fdb8b527c597855d273fb4bcc1971855b6a.
https://github.com/storytold/vectorcraft
Copyright (c) 2026 ArtCraft Team and the VectorCraft contributors.
The icon-button interaction/style boundary is adapted from PhotoCraft (above) and:
- PdfCraft, crates/ui-egui/src/icons.rs, revision f626db25cca2c89f8fa3f7e30d22bf59faea65ec.
https://github.com/storytold/pdfcraft
Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors.
The tab fitting in crates/ui/src/tabs is adapted from PhotoCraft's tab_strip.rs (above).
Tab interaction adapters also use VectorCraft's dock.rs and floating.rs (above).
The pane sizing and resize boundaries in crates/ui/src/layout draw on:
- FilmCraft, crates/ui-egui/src/dock.rs, revision 7b6c134472287db4367fca80bcb498240ba36567.
https://github.com/storytold/filmcraft
Copyright (c) 2026 ArtCraft Team and the FilmCraft contributors.
- EffectCraft, crates/ui-egui/src/dock.rs, revision 2a460986ee7a4b32656a3d434849693904b486bc.
https://github.com/storytold/effectcraft
Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors.
The widget-state styling in crates/ui/src/theme is adapted from VectorCraft (above),
crates/ui-egui/src/theme.rs, and:
- DesignCraft, crates/ui-egui/src/theme.rs, revision 66c7ce7e96ec286a091878cc2541ee8369aa79d6.
https://github.com/storytold/designcraft
Copyright (c) 2026 ArtCraft Team and the DesignCraft contributors.
The transactional panel model and drop-zone semantics in crates/ui/src/docking draw on the
FilmCraft/EffectCraft split, tab and accordion layouts and VectorCraft floating groups listed
above. The generic transaction validation, optional renderer and workspace-location helpers
are implemented here without dependencies on application engines or native window helpers.
All sources listed above are licensed MIT OR Apache-2.0. No icon artwork is copied here.
The PDF spooler in crates/print is extracted from:
- PdfCraft, crates/print/src/spool.rs, windows_print.ps1 and spooler tests,
revision 33c14e07cfd742a82bf03baa6b103c01008fa68c.
https://github.com/storytold/pdfcraft
Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors.
Licensed MIT OR Apache-2.0. PDF composition and application code are not copied.
The Windows printer duplex-capability query and parser additionally draw on PdfCraft,
crates/print/src/spool.rs, revision fb97ce958dfe92b6762ce40615c7836551710139 (PR #1154), under the same licenses above.
The native Windows backend (crates/print/src/windows.rs, ticket.rs and the printer-list and
Windows spooler tests) is ported from PdfCraft's native printing work, which carries the
approach of PdfCraft PR #599 (Win32 printer list, Windows.Data.Pdf into the XPS print API, the
PrintTicket and its driver-paper preference):
- PdfCraft, crates/print/src/spool/windows.rs, spool.rs and tests.rs, branch
claude/native-windows-print-826c99 of PR #1132, revision a435117 (jcl-bit/printcraft).
https://github.com/storytold/pdfcraft
Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors.
Licensed MIT OR Apache-2.0.