GtkSource.PrintCompositor
Description: Reference for GtkSource.PrintCompositor

### Class

# GtkSourcePrintCompositor

#### Description [src]

    class GtkSource.PrintCompositor : GObject.Object
    {
      /* No available fields */
    }

Compose a `GtkSourceBuffer` for printing.

The `GtkSourcePrintCompositor` object is used to compose a `GtkSourceBuffer` for printing. You can set various configuration options to customize the printed output. `GtkSourcePrintCompositor` is designed to be used with the high-level printing API of gtk+, i.e. `GtkPrintOperation`.

The margins specified in this object are the layout margins: they define the blank space bordering the printed area of the pages. They must not be confused with the “print margins”, i.e. the parts of the page that the printer cannot print on, defined in the `GtkPageSetup` objects. If the specified layout margins are smaller than the “print margins”, the latter ones are used as a fallback by the `GtkSourcePrintCompositor` object, so that the printed area is not clipped.

#### Hierarchy

#### Ancestors

- GObject

#### Constructors

###### gtk_source_print_compositor_new

Creates a new print compositor that can be used to print `buffer`.

###### gtk_source_print_compositor_new_from_view

Creates a new print compositor that can be used to print the buffer associated with `view`.

#### Instance methods

###### gtk_source_print_compositor_draw_page

Draw page `page_nr` for printing on the the Cairo context encapsuled in `context`.

###### gtk_source_print_compositor_get_body_font_name

Returns the name of the font used to print the text body.

###### gtk_source_print_compositor_get_bottom_margin

Gets the bottom margin in units of `unit`.

###### gtk_source_print_compositor_get_buffer

Gets the `GtkSourceBuffer` associated with the compositor.

###### gtk_source_print_compositor_get_footer_font_name

Returns the name of the font used to print the page footer.

###### gtk_source_print_compositor_get_header_font_name

Returns the name of the font used to print the page header.

###### gtk_source_print_compositor_get_highlight_syntax

Determines whether the printed text will be highlighted according to the buffer rules.

###### gtk_source_print_compositor_get_left_margin

Gets the left margin in units of `unit`.

###### gtk_source_print_compositor_get_line_numbers_font_name

Returns the name of the font used to print line numbers on the left margin.

###### gtk_source_print_compositor_get_n_pages

Returns the number of pages in the document or `-1` if the document has not been completely paginated.

###### gtk_source_print_compositor_get_pagination_progress

Returns the current fraction of the document pagination that has been completed.

###### gtk_source_print_compositor_get_print_footer

Determines if a footer is set to be printed for each page.

###### gtk_source_print_compositor_get_print_header

Determines if a header is set to be printed for each page.

###### gtk_source_print_compositor_get_print_line_numbers

Returns the interval used for line number printing.

###### gtk_source_print_compositor_get_right_margin

Gets the right margin in units of `unit`.

###### gtk_source_print_compositor_get_tab_width

Returns the width of tabulation in characters for printed text.

###### gtk_source_print_compositor_get_top_margin

Gets the top margin in units of `unit`.

###### gtk_source_print_compositor_get_wrap_mode

Gets the line wrapping mode for the printed text.

###### gtk_source_print_compositor_ignore_tag

Specifies a tag whose style should be ignored when compositing the document to the printable page.

since: 5.2

###### gtk_source_print_compositor_paginate

Paginate the document associated with the `compositor`.

###### gtk_source_print_compositor_set_body_font_name

Sets the default font for the printed text.

###### gtk_source_print_compositor_set_bottom_margin

Sets the bottom margin used by `compositor`.

###### gtk_source_print_compositor_set_footer_font_name

Sets the font for printing the page footer.

###### gtk_source_print_compositor_set_footer_format

See `gtk_source_print_compositor_set_header_format()` for more information about the parameters.

###### gtk_source_print_compositor_set_header_font_name

Sets the font for printing the page header.

###### gtk_source_print_compositor_set_header_format

Sets strftime like header format strings, to be printed on the left, center and right of the top of each page.

###### gtk_source_print_compositor_set_highlight_syntax

Sets whether the printed text will be highlighted according to the buffer rules. Both color and font style are applied.

###### gtk_source_print_compositor_set_left_margin

Sets the left margin used by `compositor`.

###### gtk_source_print_compositor_set_line_numbers_font_name

Sets the font for printing line numbers on the left margin.

###### gtk_source_print_compositor_set_print_footer

Sets whether you want to print a footer in each page.

###### gtk_source_print_compositor_set_print_header

Sets whether you want to print a header in each page.

###### gtk_source_print_compositor_set_print_line_numbers

Sets the interval for printed line numbers.

###### gtk_source_print_compositor_set_right_margin

Sets the right margin used by `compositor`.

###### gtk_source_print_compositor_set_tab_width

Sets the width of tabulation in characters for printed text.

###### gtk_source_print_compositor_set_top_margin

Sets the top margin used by `compositor`.

###### gtk_source_print_compositor_set_wrap_mode

Sets the line wrapping mode for the printed text.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### GtkSource.PrintCompositor:body-font-name

Name of the font used for the text body.

###### GtkSource.PrintCompositor:buffer

The `GtkSourceBuffer` object to print.

###### GtkSource.PrintCompositor:footer-font-name

Name of the font used to print page footer. If this property is unspecified, the text body font is used.

###### GtkSource.PrintCompositor:header-font-name

Name of the font used to print page header. If this property is unspecified, the text body font is used.

###### GtkSource.PrintCompositor:highlight-syntax

Whether to print the document with highlighted syntax.

###### GtkSource.PrintCompositor:line-numbers-font-name

Name of the font used to print line numbers on the left margin. If this property is unspecified, the text body font is used.

###### GtkSource.PrintCompositor:n-pages

The number of pages in the document or `-1` if the document has not been completely paginated.

###### GtkSource.PrintCompositor:print-footer

Whether to print a footer in each page.

###### GtkSource.PrintCompositor:print-header

Whether to print a header in each page.

###### GtkSource.PrintCompositor:print-line-numbers

Interval of printed line numbers.

###### GtkSource.PrintCompositor:tab-width

Width of a tab character expressed in spaces.

###### GtkSource.PrintCompositor:wrap-mode

Whether to wrap lines never, at word boundaries, or at character boundaries.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GtkSourcePrintCompositorClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.