gtk.page_setup
Module for [PageSetup] class
Types 3
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.PageSetup.new_] to get the defaults, or use [gtk.global.printRunPageSetupDialog] 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.
PageSetupGidBuilder builder()Get builder for [gtk.page_setup.PageSetup] Returns: New builder objectgtk.page_setup.PageSetup newFromFile(string fileName)Reads the page setup from the file filename. Returns a new #GtkPageSetup object with the restored page setup, or null if an error occurred. See [gtk.pagesetup.PageSetup.toFile].gtk.page_setup.PageSetup newFromGvariant(glib.variant.Variant variant)Desrialize a page setup from an a{sv} variant in the format produced by [gtk.page_setup.PageSetup.toGvariant].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. Returns a new #GtkPageSetup object with the restored page setup, or null if an error occurred.gtk.page_setup.PageSetup copy()Copies a #GtkPageSetup. Returns: a copy of otherdouble 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 #GtkPageSetup. Returns: the page orientationdouble 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 #GtkPageSetup. Returns: the paper sizedouble 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 filename. See [gtk.pagesetup.PageSetup.toFile].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 #GtkPageSetup.void setLeftMargin(double margin, gtk.types.Unit unit)Sets the left margin of the #GtkPageSetup.void setOrientation(gtk.types.PageOrientation orientation)Sets the page orientation of the #GtkPageSetup.void setPaperSize(gtk.paper_size.PaperSize size)Sets the paper size of the #GtkPageSetup without changing the margins. See [gtk.page_setup.PageSetup.setPaperSizeAndDefaultMargins].void setPaperSizeAndDefaultMargins(gtk.paper_size.PaperSize size)Sets the paper size of the #GtkPageSetup and modifies the margins according to the new paper size.void setRightMargin(double margin, gtk.types.Unit unit)Sets the right margin of the #GtkPageSetup.void setTopMargin(double margin, gtk.types.Unit unit)Sets the top margin of the #GtkPageSetup.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, #GVariantvoid toKeyFile(glib.key_file.KeyFile keyFile, string groupName = null)This function adds the page setup from setup to key_file.