Files
craft-libs/crates/print/Cargo.toml
FredApps 60ede99985 print: xps_driver says whether a Windows printer's driver renders XPS itself (#804)
* print: xps_driver says whether a Windows printer's driver renders XPS itself

craft_print::xps_driver(printer) reads PRINTER_DRIVER_XPS through winprint's new
PrinterDevice::is_xps_driver (storytold/winprint.rs#21): Some(true) for v4 drivers and v3
drivers with an XPS rendering filter, Some(false) for GDI drivers, None when it can't be read and
on other systems. On a GDI driver, reached through Windows' XPS-to-GDI conversion, a page with
transparency prints with halos, as black boxes or not at all (storytold/pdfcraft#6155, #5838,
#5940), so PdfCraft will flatten it for those drivers only.

The Windows end-to-end test checks the CI queue's "Generic / Text Only" driver reads as GDI.

* Test: the GDI-driver check in a helper (keeps the end-to-end test under the complexity limit)

* winprint bc06a7c48b768eb27a828c7986f6d2868b245ee0: storytold/winprint.rs main with #21 (PrinterDevice::is_xps_driver)
2026-11-11 07:48:44 +01:00

52 lines
2.5 KiB
TOML

[package]
name = "craft-print"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
description = "System PDF print spooler for the Craft apps: CUPS and Windows"
[dependencies]
# Safe API; Win32 calls are isolated in this maintained MIT OR Apache-2.0 dependency.
# Keep the public rgb re-export at main's GDI revision: a different Git rev gives
# downstream GDI values a different Rust type identity even when the code is unchanged.
# PDF loader updates below are independent of this public transport API.
craft-winprint-gdi = { git = "https://github.com/storytold/winprint.rs", rev = "64e7afd4d1483512385012c340ecaaaf0f3beb7f" }
[lints]
workspace = true
[target.'cfg(unix)'.dependencies]
# Says why the printer list is empty when lpstat can't run (e.g. a Flatpak without CUPS tools).
log = "0.4"
[target.'cfg(windows)'.dependencies]
# Printing without starting anything (storytold/pdfcraft#1107): the printer list (EnumPrinters)
# and the job (Windows.Data.Pdf drawn with Direct2D into the XPS print API, options as a
# PrintTicket) are safe wrappers over Win32 and WinRT (BSD-3-Clause). Its default `pdfium`
# feature downloads PDFium at build time and is off. The maintained BSD-3-Clause fork
# preserves terminal failures/cancellation and bounds the completion notification wait, and
# creates the Direct2D factory multi-threaded, since Windows.Data.Pdf draws on its own worker
# threads (storytold/pdfcraft#5006). File-backed PDF loading avoids StorageFile access
# denial without whole-job buffering; includes the #15 test cleanup and explicit WinRT
# feature. It draws each page at the job's resolution rather than ~96 dpi (winprint.rs#19,
# storytold/pdfcraft#4941), writes QName values as prefix:local so drivers accept the merged
# ticket (winprint.rs#12, storytold/pdfcraft#3823), and reads whitespace-padded integers in
# PrintCapabilities (winprint.rs#3, storytold/pdfcraft#2430). Pinned to an immutable revision;
# review before bumping.
winprint = { git = "https://github.com/storytold/winprint.rs", rev = "bc06a7c48b768eb27a828c7986f6d2868b245ee0", default-features = false }
# GetDefaultPrinter (MIT).
winsafe = { version = "0.0.29", default-features = false, features = ["winspool"] }
# The job file's private folder.
tempfile = "3"
# Reading the PrintTicket and PrintCapabilities the driver hands back.
roxmltree = "0.21"
# Inflating the print-ready PDF's cross-reference and object streams (src/sheets.rs).
miniz_oxide = "0.9"
[dev-dependencies]
tempfile = "3"
roxmltree = "0.21"
miniz_oxide = "0.9"