Chapter 80. Creating print jobs

#include <x/cups/job.H>

x::w::job print_job=info->create_job();

print_job->set_option("copies", 2);
print_job->add_document_file("letter", "letter.pdf");

int job_id=print_job->submit("Letter");

x::cups::destination's create_job() creates an x::cups::job object. This object represents a new print job. This object's set_option()'s methods set the new print job's options and properties. See CUPS's documentation for more information on the available options. The options set here must take into account what x::cups::destination defines for this print destination.

The actual content to be printed gets specified by add_document_file(). As an alternative, add_document() specifies an arbitrary data source for the document.

submit() prepares and schedules the actual print job. submit() does the actual work, the other methods merely collect the required information, and save it internally for submit()'s use.