Class

GtkPageSetup

Description [src]

final class Gtk.PageSetup : GObject.Object
{
  /* No available fields */
}

A GtkPageSetup object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to the GtkPrintOperation when printing. The benefit of splitting this out of the GtkPrintSettings is that these affect the actual layout of the page, and thus need to be set long before user prints.

Margins ## {#print-margins}

The margins specified in this object are the “print margins”, i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.

To obtain a GtkPageSetup use gtk_page_setup_new() to get the defaults, or use gtk_print_run_page_setup_dialog() to show the page setup dialog and receive the resulting page setup.

A page setup dialog

static GtkPrintSettings *settings = NULL;
static GtkPageSetup *page_setup = NULL;

static void
do_page_setup (void)
{
  GtkPageSetup *new_page_setup;

  if (settings == NULL)
    settings = gtk_print_settings_new ();

  new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window),
                                                    page_setup, settings);

  if (page_setup)
    g_object_unref (page_setup);

  page_setup = new_page_setup;
}

Printing support was added in GTK+ 2.10.

Hierarchy

hierarchy this GtkPageSetup ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

gtk_page_setup_new

Creates a new GtkPageSetup.

since: 2.10

gtk_page_setup_new_from_file

Reads the page setup from the file file_name. Returns a new GtkPageSetup object with the restored page setup, or NULL if an error occurred. See gtk_page_setup_to_file().

since: 2.12

gtk_page_setup_new_from_gvariant

Desrialize a page setup from an a{sv} variant in the format produced by gtk_page_setup_to_gvariant().

since: 3.22

gtk_page_setup_new_from_key_file

Reads the page setup from the group group_name in the key file key_file. Returns a new GtkPageSetup object with the restored page setup, or NULL if an error occurred.

since: 2.12

Instance methods

gtk_page_setup_copy

Copies a GtkPageSetup.

since: 2.10

gtk_page_setup_get_bottom_margin

Gets the bottom margin in units of unit.

since: 2.10

gtk_page_setup_get_left_margin

Gets the left margin in units of unit.

since: 2.10

gtk_page_setup_get_orientation

Gets the page orientation of the GtkPageSetup.

since: 2.10

gtk_page_setup_get_page_height

Returns the page height in units of unit.

since: 2.10

gtk_page_setup_get_page_width

Returns the page width in units of unit.

since: 2.10

gtk_page_setup_get_paper_height

Returns the paper height in units of unit.

since: 2.10

gtk_page_setup_get_paper_size

Gets the paper size of the GtkPageSetup.

since: 2.10

gtk_page_setup_get_paper_width

Returns the paper width in units of unit.

since: 2.10

gtk_page_setup_get_right_margin

Gets the right margin in units of unit.

since: 2.10

gtk_page_setup_get_top_margin

Gets the top margin in units of unit.

since: 2.10

gtk_page_setup_load_file

Reads the page setup from the file file_name. See gtk_page_setup_to_file().

since: 2.14

gtk_page_setup_load_key_file

Reads the page setup from the group group_name in the key file key_file.

since: 2.14

gtk_page_setup_set_bottom_margin

Sets the bottom margin of the GtkPageSetup.

since: 2.10

gtk_page_setup_set_left_margin

Sets the left margin of the GtkPageSetup.

since: 2.10

gtk_page_setup_set_orientation

Sets the page orientation of the GtkPageSetup.

since: 2.10

gtk_page_setup_set_paper_size

Sets the paper size of the GtkPageSetup without changing the margins. See gtk_page_setup_set_paper_size_and_default_margins().

since: 2.10

gtk_page_setup_set_paper_size_and_default_margins

Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.

since: 2.10

gtk_page_setup_set_right_margin

Sets the right margin of the GtkPageSetup.

since: 2.10

gtk_page_setup_set_top_margin

Sets the top margin of the GtkPageSetup.

since: 2.10

gtk_page_setup_to_file

This function saves the information from setup to file_name.

since: 2.12

gtk_page_setup_to_gvariant

Serialize page setup to an a{sv} variant.

since: 3.22

gtk_page_setup_to_key_file

This function adds the page setup from setup to key_file.

since: 2.12

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

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.