winprint-kit
Windows printing / conversion toolkit: direct printing of PDF / image / XPS, and HTML / Office via PDF conversion (optional features). Includes file download and type detection.
Windows only.
Features
| Feature | Description | Default |
|---|---|---|
html |
HTML → PDF (WebView2) | off |
office |
Office → PDF (PowerShell + COM, requires MS Office 2010+) | off |
Usage
[]
= { = "0.1", = ["html", "office"] }
use Arc;
use ;
;
Print progress is reported via StatusSink::on_status (Printing → Success / Failed; error is non-empty only on failure). The event sink is implemented by the caller (e.g. tauri emit).
Environment checks
HTML / Office depend on local components; probe them in advance:
use webview2_available;
use ;
let wv2 = webview2_available;
let status = office_install_status.await;
let has_word = is_office_installed.await;
A failed probe is treated as not installed.
Notes
The WebView2 user-data folder used for HTML printing can be set with PrintPipeline::with_html_user_data_folder(...); defaults to %LOCALAPPDATA%\winprint-kit\webview2_print.