## GtkSourcePrintCompositor GtkSourcePrintCompositor — Compose a GtkSourceBuffer for printing |

## Functions

GtkSourcePrintCompositor * | gtk_source_print_compositor_new ()
GtkSourcePrintCompositor * | gtk_source_print_compositor_new_from_view ()
GtkSourceBuffer * | gtk_source_print_compositor_get_buffer ()
void | gtk_source_print_compositor_set_tab_width ()
guint | gtk_source_print_compositor_get_tab_width ()
void | gtk_source_print_compositor_set_wrap_mode ()
GtkWrapMode | gtk_source_print_compositor_get_wrap_mode ()
void | gtk_source_print_compositor_set_highlight_syntax ()
gboolean | gtk_source_print_compositor_get_highlight_syntax ()
void | gtk_source_print_compositor_set_print_line_numbers ()
guint | gtk_source_print_compositor_get_print_line_numbers ()
void | gtk_source_print_compositor_set_body_font_name ()
gchar * | gtk_source_print_compositor_get_body_font_name ()
void | gtk_source_print_compositor_set_line_numbers_font_name ()
gchar * | gtk_source_print_compositor_get_line_numbers_font_name ()
void | gtk_source_print_compositor_set_header_font_name ()
gchar * | gtk_source_print_compositor_get_header_font_name ()
void | gtk_source_print_compositor_set_footer_font_name ()
gchar * | gtk_source_print_compositor_get_footer_font_name ()
gdouble | gtk_source_print_compositor_get_top_margin ()
void | gtk_source_print_compositor_set_top_margin ()
gdouble | gtk_source_print_compositor_get_bottom_margin ()
void | gtk_source_print_compositor_set_bottom_margin ()
gdouble | gtk_source_print_compositor_get_left_margin ()
void | gtk_source_print_compositor_set_left_margin ()
gdouble | gtk_source_print_compositor_get_right_margin ()
void | gtk_source_print_compositor_set_right_margin ()
void | gtk_source_print_compositor_set_print_header ()
gboolean | gtk_source_print_compositor_get_print_header ()
void | gtk_source_print_compositor_set_print_footer ()
gboolean | gtk_source_print_compositor_get_print_footer ()
void | gtk_source_print_compositor_set_header_format ()
void | gtk_source_print_compositor_set_footer_format ()
gint | gtk_source_print_compositor_get_n_pages ()
gboolean | gtk_source_print_compositor_paginate ()
gdouble | gtk_source_print_compositor_get_pagination_progress ()
void | gtk_source_print_compositor_draw_page ()

## Properties

gchar * | body-font-name | Read / Write
GtkSourceBuffer * | buffer | Read / Write / Construct Only
gchar * | footer-font-name | Read / Write
gchar * | header-font-name | Read / Write
gboolean | highlight-syntax | Read / Write
gchar * | line-numbers-font-name | Read / Write
gint | n-pages | Read
gboolean | print-footer | Read / Write
gboolean | print-header | Read / Write
guint | print-line-numbers | Read / Write
guint | tab-width | Read / Write
GtkWrapMode | wrap-mode | Read / Write

## Types and Values

| GtkSourcePrintCompositor

## Object Hierarchy

        GObject
        ╰── GtkSourcePrintCompositor

## Includes

    #include <gtksourceview/gtksource.h>

## Description

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.

## Functions

### gtk_source_print_compositor_new ()

    GtkSourcePrintCompositor *
    gtk_source_print_compositor_new (GtkSourceBuffer *buffer);

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

#### Parameters

buffer | the GtkSourceBuffer to print. |

#### Returns

a new print compositor object.

Since 2.2

### gtk_source_print_compositor_new_from_view ()

    GtkSourcePrintCompositor *
    gtk_source_print_compositor_new_from_view
                                   (GtkSourceView *view);

Creates a new print compositor that can be used to print the buffer associated with `view` . This constructor sets some configuration properties to make the printed output match `view` as much as possible. The properties set are “tab-width”, “highlight-syntax”, “wrap-mode”, “body-font-name” and “print-line-numbers”.

#### Parameters

view | a GtkSourceView to get configuration from. |

#### Returns

a new print compositor object.

Since 2.2

### gtk_source_print_compositor_get_buffer ()

    GtkSourceBuffer *
    gtk_source_print_compositor_get_buffer
                                   (GtkSourcePrintCompositor *compositor);

Gets the GtkSourceBuffer associated with the compositor. The returned object reference is owned by the compositor object and should not be unreferenced.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

the GtkSourceBuffer associated with the compositor.

[transfer none]

Since 2.2

### gtk_source_print_compositor_set_tab_width ()

    void
    gtk_source_print_compositor_set_tab_width
                                   (GtkSourcePrintCompositor *compositor,
                                    guint width);

Sets the width of tabulation in characters for printed text.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
width | width of tab in characters. |

Since 2.2

### gtk_source_print_compositor_get_tab_width ()

    guint
    gtk_source_print_compositor_get_tab_width
                                   (GtkSourcePrintCompositor *compositor);

Returns the width of tabulation in characters for printed text.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

width of tab.

Since 2.2

### gtk_source_print_compositor_set_wrap_mode ()

    void
    gtk_source_print_compositor_set_wrap_mode
                                   (GtkSourcePrintCompositor *compositor,
                                    GtkWrapMode wrap_mode);

Sets the line wrapping mode for the printed text.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
wrap_mode | a GtkWrapMode. |

Since 2.2

### gtk_source_print_compositor_get_wrap_mode ()

    GtkWrapMode
    gtk_source_print_compositor_get_wrap_mode
                                   (GtkSourcePrintCompositor *compositor);

Gets the line wrapping mode for the printed text.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

the line wrap mode.

Since 2.2

### gtk_source_print_compositor_set_highlight_syntax ()

    void
    gtk_source_print_compositor_set_highlight_syntax
                                   (GtkSourcePrintCompositor *compositor,
                                    gboolean highlight);

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

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
highlight | whether syntax should be highlighted. |

Since 2.2

### gtk_source_print_compositor_get_highlight_syntax ()

    gboolean
    gtk_source_print_compositor_get_highlight_syntax
                                   (GtkSourcePrintCompositor *compositor);

Determines whether the printed text will be highlighted according to the buffer rules. Note that highlighting will happen only if the buffer to print has highlighting activated.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

`TRUE` if the printed output will be highlighted.

Since 2.2

### gtk_source_print_compositor_set_print_line_numbers ()

    void
    gtk_source_print_compositor_set_print_line_numbers
                                   (GtkSourcePrintCompositor *compositor,
                                    guint interval);

Sets the interval for printed line numbers. If `interval` is 0 no numbers will be printed. If greater than 0, a number will be printed every `interval` lines (i.e. 1 will print all line numbers).

Maximum accepted value for `interval` is 100.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
interval | interval for printed line numbers. |

Since 2.2

### gtk_source_print_compositor_get_print_line_numbers ()

    guint
    gtk_source_print_compositor_get_print_line_numbers
                                   (GtkSourcePrintCompositor *compositor);

Returns the interval used for line number printing. If the value is 0, no line numbers will be printed. The default value is 1 (i.e. numbers printed in all lines).

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

the interval of printed line numbers.

Since 2.2

### gtk_source_print_compositor_set_body_font_name ()

    void
    gtk_source_print_compositor_set_body_font_name
                                   (GtkSourcePrintCompositor *compositor,
                                    const gchar *font_name);

Sets the default font for the printed text.

`font_name` should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
font_name | the name of the default font for the body text. |

Since 2.2

### gtk_source_print_compositor_get_body_font_name ()

    gchar *
    gtk_source_print_compositor_get_body_font_name
                                   (GtkSourcePrintCompositor *compositor);

Returns the name of the font used to print the text body. The returned string must be freed with `g_free()`.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

a new string containing the name of the font used to print the text body.

Since 2.2

### gtk_source_print_compositor_set_line_numbers_font_name ()

    void
    gtk_source_print_compositor_set_line_numbers_font_name
                                   (GtkSourcePrintCompositor *compositor,
                                    const gchar *font_name);

Sets the font for printing line numbers on the left margin. If `NULL` is supplied, the default font (i.e. the one being used for the text) will be used instead.

`font_name` should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
font_name | the name of the font for line numbers, or `NULL`. | [allow-none]

Since 2.2

### gtk_source_print_compositor_get_line_numbers_font_name ()

    gchar *
    gtk_source_print_compositor_get_line_numbers_font_name
                                   (GtkSourcePrintCompositor *compositor);

Returns the name of the font used to print line numbers on the left margin. The returned string must be freed with `g_free()`.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

a new string containing the name of the font used to print line numbers on the left margin.

Since 2.2

### gtk_source_print_compositor_set_header_font_name ()

    void
    gtk_source_print_compositor_set_header_font_name
                                   (GtkSourcePrintCompositor *compositor,
                                    const gchar *font_name);

Sets the font for printing the page header. If `NULL` is supplied, the default font (i.e. the one being used for the text) will be used instead.

`font_name` should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
font_name | the name of the font for header text, or `NULL`. | [allow-none]

Since 2.2

### gtk_source_print_compositor_get_header_font_name ()

    gchar *
    gtk_source_print_compositor_get_header_font_name
                                   (GtkSourcePrintCompositor *compositor);

Returns the name of the font used to print the page header. The returned string must be freed with `g_free()`.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

a new string containing the name of the font used to print the page header.

Since 2.2

### gtk_source_print_compositor_set_footer_font_name ()

    void
    gtk_source_print_compositor_set_footer_font_name
                                   (GtkSourcePrintCompositor *compositor,
                                    const gchar *font_name);

Sets the font for printing the page footer. If `NULL` is supplied, the default font (i.e. the one being used for the text) will be used instead.

`font_name` should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
font_name | the name of the font for the footer text, or `NULL`. | [allow-none]

Since 2.2

### gtk_source_print_compositor_get_footer_font_name ()

    gchar *
    gtk_source_print_compositor_get_footer_font_name
                                   (GtkSourcePrintCompositor *compositor);

Returns the name of the font used to print the page footer. The returned string must be freed with `g_free()`.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

a new string containing the name of the font used to print the page footer.

Since 2.2

### gtk_source_print_compositor_get_top_margin ()

    gdouble
    gtk_source_print_compositor_get_top_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    GtkUnit unit);

Gets the top margin in units of `unit` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
unit | the unit for the return value. |

#### Returns

the top margin.

Since 2.2

### gtk_source_print_compositor_set_top_margin ()

    void
    gtk_source_print_compositor_set_top_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    gdouble margin,
                                    GtkUnit unit);

Sets the top margin used by `compositor` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
margin | the new top margin in units of `unit` |
unit | the units for `margin` |

Since 2.2

### gtk_source_print_compositor_get_bottom_margin ()

    gdouble
    gtk_source_print_compositor_get_bottom_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    GtkUnit unit);

Gets the bottom margin in units of `unit` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
unit | the unit for the return value. |

#### Returns

the bottom margin.

Since 2.2

### gtk_source_print_compositor_set_bottom_margin ()

    void
    gtk_source_print_compositor_set_bottom_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    gdouble margin,
                                    GtkUnit unit);

Sets the bottom margin used by `compositor` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
margin | the new bottom margin in units of `unit` . |
unit | the units for `margin` . |

Since 2.2

### gtk_source_print_compositor_get_left_margin ()

    gdouble
    gtk_source_print_compositor_get_left_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    GtkUnit unit);

Gets the left margin in units of `unit` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
unit | the unit for the return value. |

#### Returns

the left margin

Since 2.2

### gtk_source_print_compositor_set_left_margin ()

    void
    gtk_source_print_compositor_set_left_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    gdouble margin,
                                    GtkUnit unit);

Sets the left margin used by `compositor` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
margin | the new left margin in units of `unit` . |
unit | the units for `margin` . |

Since 2.2

### gtk_source_print_compositor_get_right_margin ()

    gdouble
    gtk_source_print_compositor_get_right_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    GtkUnit unit);

Gets the right margin in units of `unit` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
unit | the unit for the return value. |

#### Returns

the right margin.

Since 2.2

### gtk_source_print_compositor_set_right_margin ()

    void
    gtk_source_print_compositor_set_right_margin
                                   (GtkSourcePrintCompositor *compositor,
                                    gdouble margin,
                                    GtkUnit unit);

Sets the right margin used by `compositor` .

#### Parameters

compositor | a GtkSourcePrintCompositor. |
margin | the new right margin in units of `unit` . |
unit | the units for `margin` . |

Since 2.2

### gtk_source_print_compositor_set_print_header ()

    void
    gtk_source_print_compositor_set_print_header
                                   (GtkSourcePrintCompositor *compositor,
                                    gboolean print);

Sets whether you want to print a header in each page. The header consists of three pieces of text and an optional line separator, configurable with `gtk_source_print_compositor_set_header_format()`.

Note that by default the header format is unspecified, and if it's empty it will not be printed, regardless of this setting.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
print | `TRUE` if you want the header to be printed. |

Since 2.2

### gtk_source_print_compositor_get_print_header ()

    gboolean
    gtk_source_print_compositor_get_print_header
                                   (GtkSourcePrintCompositor *compositor);

Determines if a header is set to be printed for each page. A header will be printed if this function returns `TRUE` and some format strings have been specified with `gtk_source_print_compositor_set_header_format()`.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

`TRUE` if the header is set to be printed.

Since 2.2

### gtk_source_print_compositor_set_print_footer ()

    void
    gtk_source_print_compositor_set_print_footer
                                   (GtkSourcePrintCompositor *compositor,
                                    gboolean print);

Sets whether you want to print a footer in each page. The footer consists of three pieces of text and an optional line separator, configurable with `gtk_source_print_compositor_set_footer_format()`.

Note that by default the footer format is unspecified, and if it's empty it will not be printed, regardless of this setting.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
print | `TRUE` if you want the footer to be printed. |

Since 2.2

### gtk_source_print_compositor_get_print_footer ()

    gboolean
    gtk_source_print_compositor_get_print_footer
                                   (GtkSourcePrintCompositor *compositor);

Determines if a footer is set to be printed for each page. A footer will be printed if this function returns `TRUE` and some format strings have been specified with `gtk_source_print_compositor_set_footer_format()`.

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

`TRUE` if the footer is set to be printed.

Since 2.2

### gtk_source_print_compositor_set_header_format ()

    void
    gtk_source_print_compositor_set_header_format
                                   (GtkSourcePrintCompositor *compositor,
                                    gboolean separator,
                                    const gchar *left,
                                    const gchar *center,
                                    const gchar *right);

Sets strftime like header format strings, to be printed on the left, center and right of the top of each page. The strings may include strftime(3) codes which will be expanded at print time. All `strftime()` codes are accepted, with the addition of #N for the page number and #Q for the page count.

`separator` specifies if a solid line should be drawn to separate the header from the document text.

If `NULL` is given for any of the three arguments, that particular string will not be printed.

For the header to be printed, in addition to specifying format strings, you need to enable header printing with `gtk_source_print_compositor_set_print_header()`.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
separator | `TRUE` if you want a separator line to be printed. |
left | a format string to print on the left of the header. | [allow-none]
center | a format string to print on the center of the header. | [allow-none]
right | a format string to print on the right of the header. | [allow-none]

Since 2.2

### gtk_source_print_compositor_set_footer_format ()

    void
    gtk_source_print_compositor_set_footer_format
                                   (GtkSourcePrintCompositor *compositor,
                                    gboolean separator,
                                    const gchar *left,
                                    const gchar *center,
                                    const gchar *right);

Sets strftime like header format strings, to be printed on the left, center and right of the bottom of each page. The strings may include strftime(3) codes which will be expanded at print time. All `strftime()` codes are accepted, with the addition of #N for the page number and #Q for the page count.

`separator` specifies if a solid line should be drawn to separate the footer from the document text.

If `NULL` is given for any of the three arguments, that particular string will not be printed.

For the footer to be printed, in addition to specifying format strings, you need to enable footer printing with `gtk_source_print_compositor_set_print_footer()`.

This function cannot be called anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

#### Parameters

compositor | a GtkSourcePrintCompositor. |
separator | `TRUE` if you want a separator line to be printed. |
left | a format string to print on the left of the footer. | [allow-none]
center | a format string to print on the center of the footer. | [allow-none]
right | a format string to print on the right of the footer. | [allow-none]

Since 2.2

### gtk_source_print_compositor_get_n_pages ()

    gint
    gtk_source_print_compositor_get_n_pages
                                   (GtkSourcePrintCompositor *compositor);

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

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

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

Since 2.2

### gtk_source_print_compositor_paginate ()

    gboolean
    gtk_source_print_compositor_paginate (GtkSourcePrintCompositor *compositor,
                                          GtkPrintContext *context);

Paginate the document associated with the `compositor` .

In order to support non-blocking pagination, document is paginated in small chunks. Each time `gtk_source_print_compositor_paginate()` is invoked, a chunk of the document is paginated. To paginate the entire document, `gtk_source_print_compositor_paginate()` must be invoked multiple times. It returns `TRUE` if the document has been completely paginated, otherwise it returns `FALSE`.

This method has been designed to be invoked in the handler of the “paginate” signal, as shown in the following example:

    // Signal handler for the GtkPrintOperation::paginate signal

    static gboolean
    paginate (GtkPrintOperation *operation,
              GtkPrintContext   *context,
              gpointer           user_data)
    {
        GtkSourcePrintCompositor *compositor;

        compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);

        if (gtk_source_print_compositor_paginate (compositor, context))
        {
            gint n_pages;

            n_pages = gtk_source_print_compositor_get_n_pages (compositor);
            gtk_print_operation_set_n_pages (operation, n_pages);

            return TRUE;
        }

        return FALSE;
    }

If you don't need to do pagination in chunks, you can simply do it all in the “begin-print” handler, and set the number of pages from there, like in the following example:

    // Signal handler for the GtkPrintOperation::begin-print signal

    static void
    begin_print (GtkPrintOperation *operation,
                 GtkPrintContext   *context,
                 gpointer           user_data)
    {
        GtkSourcePrintCompositor *compositor;
        gint n_pages;

        compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);

        while (!gtk_source_print_compositor_paginate (compositor, context));

        n_pages = gtk_source_print_compositor_get_n_pages (compositor);
        gtk_print_operation_set_n_pages (operation, n_pages);
    }

#### Parameters

compositor | a GtkSourcePrintCompositor. |
context | the GtkPrintContext whose parameters (e.g. paper size, print margins, etc.) are used by the the `compositor` to paginate the document. |

#### Returns

`TRUE` if the document has been completely paginated, `FALSE` otherwise.

Since 2.2

### gtk_source_print_compositor_get_pagination_progress ()

    gdouble
    gtk_source_print_compositor_get_pagination_progress
                                   (GtkSourcePrintCompositor *compositor);

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

#### Parameters

compositor | a GtkSourcePrintCompositor. |

#### Returns

a fraction from 0.0 to 1.0 inclusive.

Since 2.2

### gtk_source_print_compositor_draw_page ()

    void
    gtk_source_print_compositor_draw_page (GtkSourcePrintCompositor *compositor,
                                           GtkPrintContext *context,
                                           gint page_nr);

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

This method has been designed to be called in the handler of the “draw_page” signal as shown in the following example:

    // Signal handler for the GtkPrintOperation::draw_page signal

    static void
    draw_page (GtkPrintOperation *operation,
               GtkPrintContext   *context,
               gint               page_nr,
               gpointer           user_data)
    {
        GtkSourcePrintCompositor *compositor;

        compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);

        gtk_source_print_compositor_draw_page (compositor,
                                               context,
                                               page_nr);
    }

#### Parameters

compositor | a GtkSourcePrintCompositor. |
context | the GtkPrintContext encapsulating the context information that is required when drawing the page for printing. |
page_nr | the number of the page to print. |

## Types and Values

### GtkSourcePrintCompositor

    typedef struct _GtkSourcePrintCompositor GtkSourcePrintCompositor;

## Property Details

### The `“body-font-name”` property

      “body-font-name”           gchar *

Name of the font used for the text body.

Accepted values are strings representing a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: NULL

Since 2.2

### The `“buffer”` property

      “buffer”                   GtkSourceBuffer *

The GtkSourceBuffer object to print.

Flags: Read / Write / Construct Only

Since 2.2

### The `“footer-font-name”` property

      “footer-font-name”         gchar *

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

Accepted values are strings representing a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: NULL

Since 2.2

### The `“header-font-name”` property

      “header-font-name”         gchar *

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

Accepted values are strings representing a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: NULL

Since 2.2

### The `“highlight-syntax”` property

      “highlight-syntax”         gboolean

Whether to print the document with highlighted syntax.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: TRUE

Since 2.2

### The `“line-numbers-font-name”` property

      “line-numbers-font-name”   gchar *

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

Accepted values are strings representing a font description Pango can understand. (e.g. "Monospace 10"). See `pango_font_description_from_string()` for a description of the format of the string representation.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: NULL

Since 2.2

### The `“n-pages”` property

      “n-pages”                  gint

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

Flags: Read

Allowed values: >= -1

Default value: -1

Since 2.2

### The `“print-footer”` property

      “print-footer”             gboolean

Whether to print a footer in each page.

Note that by default the footer format is unspecified, and if it is unspecified the footer will not be printed, regardless of the value of this property.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: FALSE

Since 2.2

### The `“print-header”` property

      “print-header”             gboolean

Whether to print a header in each page.

Note that by default the header format is unspecified, and if it is unspecified the header will not be printed, regardless of the value of this property.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: FALSE

Since 2.2

### The `“print-line-numbers”` property

      “print-line-numbers”       guint

Interval of printed line numbers. If this property is set to 0 no numbers will be printed. If greater than 0, a number will be printed every "print-line-numbers" lines (i.e. 1 will print all line numbers).

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Allowed values: <= 100

Default value: 1

Since 2.2

### The `“tab-width”` property

      “tab-width”                guint

Width of a tab character expressed in spaces.

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Allowed values: [1,32]

Default value: 8

Since 2.2

### The `“wrap-mode”` property

      “wrap-mode”                GtkWrapMode

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

The value of this property cannot be changed anymore after the first call to the `gtk_source_print_compositor_paginate()` function.

Flags: Read / Write

Default value: GTK_WRAP_NONE

Since 2.2