gtk.page_setup

Module for [PageSetup] class

Types 3

A [gtk.page_setup.PageSetup] 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 [gtk.print_operation.PrintOperation] when printing. The benefit of splitting this out of the [gtk.print_settings.PrintSettings] 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 [gtk.page_setup.PageSetup] use [gtk.page_setup.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

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;
}

Methods
GType _gType() @property
PageSetup self()Returns `this`, for use in `with` statements.
PageSetupGidBuilder builder()Get builder for [gtk.page_setup.PageSetup] Returns: New builder object
gtk.page_setup.PageSetup newFromFile(string fileName)Reads the page setup from the file file_name.
gtk.page_setup.PageSetup newFromGvariant(glib.variant.Variant variant)Desrialize a page setup from an a{sv} variant.
gtk.page_setup.PageSetup newFromKeyFile(glib.key_file.KeyFile keyFile, string groupName = null)Reads the page setup from the group groupname in the key file keyfile.
gtk.page_setup.PageSetup copy()Copies a [gtk.page_setup.PageSetup]. Returns: a copy of other
double getBottomMargin(gtk.types.Unit unit)Gets the bottom margin in units of unit.
double getLeftMargin(gtk.types.Unit unit)Gets the left margin in units of unit.
gtk.types.PageOrientation getOrientation()Gets the page orientation of the [gtk.page_setup.PageSetup]. Returns: the page orientation
double getPageHeight(gtk.types.Unit unit)Returns the page height in units of unit.
double getPageWidth(gtk.types.Unit unit)Returns the page width in units of unit.
double getPaperHeight(gtk.types.Unit unit)Returns the paper height in units of unit.
gtk.paper_size.PaperSize getPaperSize()Gets the paper size of the [gtk.page_setup.PageSetup]. Returns: the paper size
double getPaperWidth(gtk.types.Unit unit)Returns the paper width in units of unit.
double getRightMargin(gtk.types.Unit unit)Gets the right margin in units of unit.
double getTopMargin(gtk.types.Unit unit)Gets the top margin in units of unit.
bool loadFile(string fileName)Reads the page setup from the file file_name.
bool loadKeyFile(glib.key_file.KeyFile keyFile, string groupName = null)Reads the page setup from the group groupname in the key file keyfile.
void setBottomMargin(double margin, gtk.types.Unit unit)Sets the bottom margin of the [gtk.page_setup.PageSetup].
void setLeftMargin(double margin, gtk.types.Unit unit)Sets the left margin of the [gtk.page_setup.PageSetup].
void setOrientation(gtk.types.PageOrientation orientation)Sets the page orientation of the [gtk.page_setup.PageSetup].
void setPaperSize(gtk.paper_size.PaperSize size)Sets the paper size of the [gtk.page_setup.PageSetup] without changing the margins.
void setPaperSizeAndDefaultMargins(gtk.paper_size.PaperSize size)Sets the paper size of the [gtk.page_setup.PageSetup] and modifies the margins according to the new paper size.
void setRightMargin(double margin, gtk.types.Unit unit)Sets the right margin of the [gtk.page_setup.PageSetup].
void setTopMargin(double margin, gtk.types.Unit unit)Sets the top margin of the [gtk.page_setup.PageSetup].
bool toFile(string fileName)This function saves the information from setup to file_name.
glib.variant.Variant toGvariant()Serialize page setup to an a{sv} variant. Returns: a new, floating, [glib.variant.Variant]
void toKeyFile(glib.key_file.KeyFile keyFile, string groupName = null)This function adds the page setup from setup to key_file.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.pagesetup.PageSetup]. Returns: a new [gtk.pagesetup.PageSetup].

Fluent builder for [gtk.page_setup.PageSetup]

Methods