Module ashpd::desktop::print[][src]

Expand description

Print a document.

Examples

Print a file

use ashpd::desktop::print::PrintProxy;
use std::fs::File;
use std::os::unix::io::AsRawFd;
use zvariant::Fd;

async fn run() -> Result<(), ashpd::Error> {
    let connection = zbus::azync::Connection::new_session().await?;
    let proxy = PrintProxy::new(&connection).await?;

    let file = File::open("/home/bilelmoussaoui/gitlog.pdf").expect("file to print was not found");
    let pre_print = proxy
        .prepare_print(
            Default::default(),
            "prepare print ",
            Default::default(),
            Default::default(),
            true,
        )
        .await?;
    proxy
        .print(
            Default::default(),
            "test",
            Fd::from(file.as_raw_fd()),
            &pre_print.token,
            true,
        )
        .await?;

    Ok(())
}

Structs

PageSetup

Setup the printed pages.

PreparePrint

A response to a PrintProxy::prepare_print request.

PrintProxy

The interface lets sandboxed applications print.

Settings

Print settings to set in the print dialog.

Enums

Orientation

The page orientation.

Quality

The print quality.