Skip to main content

print_with_default

Function print_with_default 

Source
pub fn print_with_default(target: impl AsRef<Path>) -> Result<()>
Expand description

Prints a file using its registered default print shell verb.

Not every file type has a registered print verb; unsupported handlers are reported as Windows shell errors.

§Errors

Returns Error::InvalidInput if target is empty or contains NUL bytes. Returns Error::PathDoesNotExist if the target path does not exist. Returns Error::WindowsApi if ShellExecuteW reports failure.

§Examples

win_desktop_utils::print_with_default(r"C:\Users\Public\Documents\sample.txt")?;