Basics
Guides
API Reference
Basics
Guides
API Reference
[30:7] extends: object
Stores page size, orientation and margins for printing. 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 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
[ctor@Gtk.PageSetup.new] to get the defaults, or use
[func@Gtk.print_run_page_setup_dialog] to show the page setup dialog and
receive the resulting page setup. ## A page setup dialog c 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; }
PageSetup ()
Creates a new
GtkPageSetup.
toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.copy ()
Copies a
GtkPageSetup.
get_bottom_margin (string unit)
Gets the bottom margin in units of @unit.
unit is the unit for the return value.get_left_margin (string unit)
Gets the left margin in units of @unit.
unit is the unit for the return value.get_orientation ()
Gets the page orientation of the
GtkPageSetup.
get_page_height (string unit)
Returns the page height in units of @unit. Note that this function takes orientation and margins into consideration. See [method@Gtk.PageSetup.get_paper_height].
unit is the unit for the return value.get_page_width (string unit)
Returns the page width in units of @unit. Note that this function takes orientation and margins into consideration. See [method@Gtk.PageSetup.get_paper_width].
unit is the unit for the return value.get_paper_height (string unit)
Returns the paper height in units of @unit. Note that this function takes orientation, but not margins into consideration. See [method@Gtk.PageSetup.get_page_height].
unit is the unit for the return value.get_paper_size ()
Gets the paper size of the
GtkPageSetup.
get_paper_width (string unit)
Returns the paper width in units of @unit. Note that this function takes orientation, but not margins into consideration. See [method@Gtk.PageSetup.get_page_width].
unit is the unit for the return value.get_right_margin (string unit)
Gets the right margin in units of @unit.
unit is the unit for the return value.get_top_margin (string unit)
Gets the top margin in units of @unit.
unit is the unit for the return value.load_file (string file_name)
Reads the page setup from the file @file_name. See [method@Gtk.PageSetup.to_file].
file_name is the filename to read the page setup from.load_key_file (object key_file, string group_name)
Reads the page setup from the group @group_name in the key file
key_file is the GKeyFile to retrieve the page_setup from.group_name is the name of the group in the key_file to read to use the default name “Page Setup”.set_bottom_margin (double margin, string unit)
Sets the bottom margin of the
GtkPageSetup.
margin is the new bottom margin in units of @unit.unit is the units for @margin.None.set_left_margin (double margin, string unit)
Sets the left margin of the
GtkPageSetup.
margin is the new left margin in units of @unit.unit is the units for @margin.None.set_orientation (string orientation)
Sets the page orientation of the
GtkPageSetup.
orientation is a GtkPageOrientation value.None.set_paper_size (object size)
Sets the paper size of the
GtkPageSetupwithout changing the margins. See [method@Gtk.PageSetup.set_paper_size_and_default_margins].
size is a GtkPaperSize.None.set_paper_size_and_default_margins (object size)
Sets the paper size of the
GtkPageSetupand modifies the margins according to the new paper size.
size is a GtkPaperSize.None.set_right_margin (double margin, string unit)
Sets the right margin of the
GtkPageSetup.
margin is the new right margin in units of @unit.unit is the units for @margin.None.set_top_margin (double margin, string unit)
Sets the top margin of the
GtkPageSetup.
margin is the new top margin in units of @unit.unit is the units for @margin.None.to_file (string file_name)
This function saves the information from @setup to @file_name.
file_name is the file to save to.to_gvariant ()
Serialize page setup to an a{sv} variant.
to_key_file (object key_file, string group_name)
This function adds the page setup from @setup to @key_file.
key_file is the GKeyFile to save the page setup to.group_name is the group to add the settings to in @key_file, or %NULL to use the default name “Page Setup”.None.[377:14] static extends: object
Alternate constructors for PageSetup. Usage:
PageSetupCtors.<name>(...). The primary constructor lives
directly on PageSetup.
newFromFile (string file_name)
Reads the page setup from the file @file_name. Returns a new
GtkPageSetupobject with the restored page setup, or %NULL if an error occurred. See [method@Gtk.PageSetup.to_file].
file_name is the filename to read the page setup from.A new PageSetup.newFromGvariant (object variant)
Desrialize a page setup from an a{sv} variant. The variant must be in the format produced by [method@Gtk.PageSetup.to_gvariant].
variant is an a{sv} GVariant.A new PageSetup.newFromKeyFile (object key_file, string group_name)
Reads the page setup from the group @group_name in the key file
Returns a new GtkPageSetup object with the restored page setup, or %NULL if an error occurred.key_file is the GKeyFile to retrieve the page_setup from.group_name is the name of the group in the key_file to read to use the default name “Page Setup”.A new PageSetup.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.