Gtk.PrintJob¶
class — extends GObject.Object
Represents a job that is sent to a printer.
You only need to deal directly with print jobs if you use the
non-portable PrintUnixDialog API.
Use PrintJob.get_surface to obtain the cairo surface
onto which the pages must be drawn. Use PrintJob.send
to send the finished job to the printer. If you don’t use cairo
GtkPrintJob also supports printing of manually generated PostScript,
via PrintJob.set_source_file.
Constructors¶
new¶
@classmethod
def new(cls, title: str, printer: Printer, settings: PrintSettings, page_setup: PageSetup) -> PrintJob
Creates a new GtkPrintJob.
Parameters:
title— the job titleprinter— aGtkPrintersettings— aGtkPrintSettingspage_setup— aGtkPageSetup
Methods¶
get_collate¶
Gets whether this job is printed collated.
get_n_up¶
Gets the n-up setting for this job.
get_n_up_layout¶
Gets the n-up layout setting for this job.
get_num_copies¶
Gets the number of copies of this job.
get_page_ranges¶
Gets the page ranges for this job.
get_page_set¶
Gets the GtkPageSet setting for this job.
get_pages¶
Gets the GtkPrintPages setting for this job.
get_printer¶
Gets the GtkPrinter of the print job.
get_reverse¶
Gets whether this job is printed reversed.
get_rotate¶
Gets whether the job is printed rotated.
get_scale¶
Gets the scale for this job.
get_settings¶
Gets the GtkPrintSettings of the print job.
get_status¶
Gets the status of the print job.
get_surface¶
Gets a cairo surface onto which the pages of the print job should be rendered.
get_title¶
Gets the job title.
get_track_print_status¶
Returns whether jobs will be tracked after printing.
For details, see PrintJob.set_track_print_status.
send¶
Sends the print job off to the printer.
Parameters:
callback— function to call when the job completes or an error occurs
set_collate¶
Sets whether this job is printed collated.
Parameters:
collate— whether the job is printed collated
set_n_up¶
Sets the n-up setting for this job.
Parameters:
n_up— the n-up value
set_n_up_layout¶
Sets the n-up layout setting for this job.
Parameters:
layout— the n-up layout setting
set_num_copies¶
Sets the number of copies for this job.
Parameters:
num_copies— the number of copies
set_page_ranges¶
Sets the page ranges for this job.
Parameters:
ranges— pointer to an array ofGtkPageRangestructs
set_page_set¶
Sets the GtkPageSet setting for this job.
Parameters:
page_set— aGtkPageSetsetting
set_pages¶
Sets the GtkPrintPages setting for this job.
Parameters:
pages— theGtkPrintPagessetting
set_reverse¶
Sets whether this job is printed reversed.
Parameters:
reverse— whether the job is printed reversed
set_rotate¶
Sets whether this job is printed rotated.
Parameters:
rotate— whether to print rotated
set_scale¶
Sets the scale for this job.
1.0 means unscaled.
Parameters:
scale— the scale
set_source_fd¶
Make the GtkPrintJob send an existing document to the
printing system.
The file can be in any format understood by the platforms
printing system (typically PostScript, but on many platforms
PDF may work too). See Printer.accepts_pdf and
Printer.accepts_ps.
This is similar to PrintJob.set_source_file,
but takes expects an open file descriptor for the file,
instead of a filename.
Parameters:
fd— a file descriptor
set_source_file¶
Make the GtkPrintJob send an existing document to the
printing system.
The file can be in any format understood by the platforms
printing system (typically PostScript, but on many platforms
PDF may work too). See Printer.accepts_pdf and
Printer.accepts_ps.
Parameters:
filename— the file to be printed
set_track_print_status¶
If track_status is True, the print job will try to continue report
on the status of the print job in the printer queues and printer.
This can allow your application to show things like “out of paper” issues, and when the print job actually reaches the printer.
This function is often implemented using some form of polling, so it should not be enabled unless needed.
Parameters:
track_status—Trueto track status after printing
Properties¶
page_setup¶
Page setup.
printer¶
The printer to send the job to.
settings¶
Printer settings.
title¶
The title of the print job.
track_print_status¶
True if the print job will continue to emit status-changed
signals after the print data has been setn to the printer.
Signals¶
status-changed¶
Emitted when the status of a job changes.
The signal handler can use PrintJob.get_status
to obtain the new status.