1.141 <GtkPageSetup>

Class: <GtkPageSetup>

It derives from <GObject>.

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 page-setup:new to get the defaults, or use 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;
}

Procedures

Method: page-setup:copy self ⇒ %return
Method: copy self ⇒ %return

Copies a <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

the <GtkPageSetup> to copy

%return

Returned: a <GtkPageSetup>.

a copy of self

Method: page-setup:get-bottom-margin self unit ⇒ %return
Method: get-bottom-margin self unit ⇒ %return

Gets the bottom margin in units of unit.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the bottom margin

Method: page-setup:get-left-margin self unit ⇒ %return
Method: get-left-margin self unit ⇒ %return

Gets the left margin in units of unit.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the left margin

Method: page-setup:get-orientation self ⇒ %return
Method: get-orientation self ⇒ %return

Gets the page orientation of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

%return

Returned: a <GtkPageOrientation>.

the page orientation

Method: page-setup:get-page-height self unit ⇒ %return
Method: get-page-height self unit ⇒ %return

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See page-setup:get-paper-height.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the page height.

Method: page-setup:get-page-width self unit ⇒ %return
Method: get-page-width self unit ⇒ %return

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See page-setup:get-paper-width.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the page width.

Method: page-setup:get-paper-height self unit ⇒ %return
Method: get-paper-height self unit ⇒ %return

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See page-setup:get-page-height.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the paper height.

Method: page-setup:get-paper-size self ⇒ %return
Method: get-paper-size self ⇒ %return

Gets the paper size of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

%return

Returned: a <GtkPaperSize>.

the paper size

Method: page-setup:get-paper-width self unit ⇒ %return
Method: get-paper-width self unit ⇒ %return

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See page-setup:get-page-width.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the paper width.

Method: page-setup:get-right-margin self unit ⇒ %return
Method: get-right-margin self unit ⇒ %return

Gets the right margin in units of unit.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the right margin

Method: page-setup:get-top-margin self unit ⇒ %return
Method: get-top-margin self unit ⇒ %return

Gets the top margin in units of unit.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

unit

Passed: a <GtkUnit>, or one of its symbols.

the unit for the return value

%return

Returned: a real number.

the top margin

Method: page-setup:load-file? self file-name ⇒ %return
Method: load-file? self file-name ⇒ %return

Reads the page setup from the file file-name.

See page-setup:to-file?.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

file-name

Passed: a file name, as a string.

the filename to read the page setup from

%return

Returned: a boolean.

#t on success

Method: page-setup:load-key-file? self key-file [group-name] ⇒ %return
Method: load-key-file? self key-file [group-name] ⇒ %return

Reads the page setup from the group group-name in the key file key-file.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

key-file

Passed: a <GKeyFile>.

the <GKeyFile> to retrieve the page_setup from

group-name

Passed, or left out: a string, or #f.

the name of the group in the key_file to read to use the default name “Page Setup”

%return

Returned: a boolean.

#t on success

Procedure: page-setup:new ⇒ %return

Creates a new <GtkPageSetup>.

%return

Returned: a <GtkPageSetup>.

a new <GtkPageSetup>.

Procedure: page-setup:new-from-file file-name ⇒ %return

Reads the page setup from the file file-name.

Returns a new <GtkPageSetup> object with the restored page setup, or #f if an error occurred. See page-setup:to-file?.

file-name

Passed: a file name, as a string.

the filename to read the page setup from

%return

Returned: a <GtkPageSetup>.

the restored <GtkPageSetup>

Procedure: page-setup:new-from-gvariant variant ⇒ %return

Desrialize a page setup from an a{sv} variant.

The variant must be in the format produced by page-setup:to-gvariant.

variant

Passed: a <GVariant>.

an a{sv} <GVariant>

%return

Returned: a <GtkPageSetup>.

a new <GtkPageSetup> object

Procedure: page-setup:new-from-key-file key-file [group-name] ⇒ %return

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 #f if an error occurred.

key-file

Passed: a <GKeyFile>.

the <GKeyFile> to retrieve the page_setup from

group-name

Passed, or left out: a string, or #f.

the name of the group in the key_file to read to use the default name “Page Setup”

%return

Returned: a <GtkPageSetup>.

the restored <GtkPageSetup>

Method: page-setup:set-bottom-margin self margin unit
Method: set-bottom-margin self margin unit

Sets the bottom margin of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

margin

Passed: a real number.

the new bottom margin in units of unit

unit

Passed: a <GtkUnit>, or one of its symbols.

the units for margin

Method: page-setup:set-left-margin self margin unit
Method: set-left-margin self margin unit

Sets the left margin of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

margin

Passed: a real number.

the new left margin in units of unit

unit

Passed: a <GtkUnit>, or one of its symbols.

the units for margin

Method: page-setup:set-orientation self orientation
Method: set-orientation self orientation

Sets the page orientation of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

orientation

Passed: a <GtkPageOrientation>, or one of its symbols.

a <GtkPageOrientation> value

Method: page-setup:set-paper-size self size
Method: set-paper-size self size

Sets the paper size of the <GtkPageSetup> without changing the margins.

See page-setup:set-paper-size-and-default-margins.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

size

Passed: a <GtkPaperSize>.

a <GtkPaperSize>

Method: page-setup:set-paper-size-and-default-margins self size
Method: set-paper-size-and-default-margins self size

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

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

size

Passed: a <GtkPaperSize>.

a <GtkPaperSize>

Method: page-setup:set-right-margin self margin unit
Method: set-right-margin self margin unit

Sets the right margin of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

margin

Passed: a real number.

the new right margin in units of unit

unit

Passed: a <GtkUnit>, or one of its symbols.

the units for margin

Method: page-setup:set-top-margin self margin unit
Method: set-top-margin self margin unit

Sets the top margin of the <GtkPageSetup>.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

margin

Passed: a real number.

the new top margin in units of unit

unit

Passed: a <GtkUnit>, or one of its symbols.

the units for margin

Method: page-setup:to-file? self file-name ⇒ %return
Method: to-file? self file-name ⇒ %return

This function saves the information from self to file-name.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

file-name

Passed: a file name, as a string.

the file to save to

%return

Returned: a boolean.

#t on success

Method: page-setup:to-gvariant self ⇒ %return
Method: to-gvariant self ⇒ %return

Serialize page setup to an a{sv} variant.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

%return

Returned: a <GVariant>.

a new, floating, <GVariant>

Method: page-setup:to-key-file self key-file [group-name]
Method: to-key-file self key-file [group-name]

This function adds the page setup from self to key-file.

self

Passed: a <GtkPageSetup>.

a <GtkPageSetup>

key-file

Passed: a <GKeyFile>.

the <GKeyFile> to save the page setup to

group-name

Passed, or left out: a string, or #f.

the group to add the settings to in key-file, or #f to use the default name “Page Setup”