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 _getGType() static nothrow
GType _gType() @property nothrow
PageSetup self() nothrowReturns `this`, for use in `with` statements.
PageSetupGidBuilder builder() static nothrowGet builder for [gtk.page_setup.PageSetup] Returns: New builder object
gtk.page_setup.PageSetup newFromFile(string fileName) staticReads the page setup from the file file_name.
gtk.page_setup.PageSetup newFromGvariant(glib.variant.Variant variant) static nothrowDesrialize a page setup from an a{sv} variant.
gtk.page_setup.PageSetup newFromKeyFile(glib.key_file.KeyFile keyFile, string groupName = null) staticReads the page setup from the group group_name in the key file key_file.
gtk.page_setup.PageSetup copy() nothrowCopies a [gtk.page_setup.PageSetup]. Returns: a copy of other
double getBottomMargin(gtk.types.Unit unit) nothrowGets the bottom margin in units of unit.
double getLeftMargin(gtk.types.Unit unit) nothrowGets the left margin in units of unit.
gtk.types.PageOrientation getOrientation() nothrowGets the page orientation of the [gtk.page_setup.PageSetup]. Returns: the page orientation
double getPageHeight(gtk.types.Unit unit) nothrowReturns the page height in units of unit.
double getPageWidth(gtk.types.Unit unit) nothrowReturns the page width in units of unit.
double getPaperHeight(gtk.types.Unit unit) nothrowReturns the paper height in units of unit.
gtk.paper_size.PaperSize getPaperSize() nothrowGets the paper size of the [gtk.page_setup.PageSetup]. Returns: the paper size
double getPaperWidth(gtk.types.Unit unit) nothrowReturns the paper width in units of unit.
double getRightMargin(gtk.types.Unit unit) nothrowGets the right margin in units of unit.
double getTopMargin(gtk.types.Unit unit) nothrowGets 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 group_name in the key file key_file.
void setBottomMargin(double margin, gtk.types.Unit unit) nothrowSets the bottom margin of the [gtk.page_setup.PageSetup].
void setLeftMargin(double margin, gtk.types.Unit unit) nothrowSets the left margin of the [gtk.page_setup.PageSetup].
void setOrientation(gtk.types.PageOrientation orientation) nothrowSets the page orientation of the [gtk.page_setup.PageSetup].
void setPaperSize(gtk.paper_size.PaperSize size) nothrowSets the paper size of the [gtk.page_setup.PageSetup] without changing the margins.
void setPaperSizeAndDefaultMargins(gtk.paper_size.PaperSize size) nothrowSets 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) nothrowSets the right margin of the [gtk.page_setup.PageSetup].
void setTopMargin(double margin, gtk.types.Unit unit) nothrowSets 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() nothrowSerialize page setup to an a{sv} variant. Returns: a new, floating, [glib.variant.Variant]
void toKeyFile(glib.key_file.KeyFile keyFile, string groupName = null) nothrowThis function adds the page setup from setup to key_file.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.page_setup.PageSetup]. Returns: a new [gtk.page_setup.PageSetup].

Fluent builder for gtk.page_setup.PageSetup

Methods
PageSetup build() nothrowCreate object from builder. Returns: New object