PrintOperationPreview

class PrintOperationPreview(*args, **kwargs)

Implementations: PrintOperation

GtkPrintOperationPreview is the interface that is used to implement print preview.

A GtkPrintOperationPreview object is passed to the preview signal by PrintOperation.

Methods

class PrintOperationPreview
end_preview() None

Ends a preview.

This function must be called to finish a custom print preview.

is_selected(page_nr: int) bool

Returns whether the given page is included in the set of pages that have been selected for printing.

Parameters:

page_nr – a page number

render_page(page_nr: int) None

Renders a page to the preview.

This is using the print context that was passed to the preview handler together with preview.

A custom print preview should use this function to render the currently selected page.

Note that this function requires a suitable cairo context to be associated with the print context.

Parameters:

page_nr – the page to render

Signals

class PrintOperationPreview.signals
got_page_size(context: PrintContext, page_setup: PageSetup) None

Emitted once for each page that gets rendered to the preview.

A handler for this signal should update the context according to page_setup and set up a suitable cairo context, using set_cairo_context.

Parameters:
  • context – the current GtkPrintContext

  • page_setup – the GtkPageSetup for the current page

ready(context: PrintContext) None

The ::ready signal gets emitted once per preview operation, before the first page is rendered.

A handler for this signal can be used for setup tasks.

Parameters:

context – the current GtkPrintContext

Virtual Methods

class PrintOperationPreview
do_end_preview() None

Ends a preview.

This function must be called to finish a custom print preview.

do_got_page_size(context: PrintContext, page_setup: PageSetup) None
Parameters:
  • context

  • page_setup

do_is_selected(page_nr: int) bool

Returns whether the given page is included in the set of pages that have been selected for printing.

Parameters:

page_nr – a page number

do_ready(context: PrintContext) None
Parameters:

context

do_render_page(page_nr: int) None

Renders a page to the preview.

This is using the print context that was passed to the preview handler together with preview.

A custom print preview should use this function to render the currently selected page.

Note that this function requires a suitable cairo context to be associated with the print context.

Parameters:

page_nr – the page to render