Next: , Previous: GtkPrintSettings, Up: Top


112 GtkPageSetup

Stores page setup information

112.1 Overview

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 <gtk-print-operation> when printing. The benefit of splitting this out of the <gtk-print-settings> is that these affect the actual layout of the page, and thus need to be set long before user prints.

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> use gtk-page-setup-new to get the defaults, or use gtk-print-run-page-setup-dialog to show the page setup dialog and receive the resulting page setup.

     
     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.

112.2 Usage

— Class: <gtk-page-setup>

Derives from <gobject>.

This class defines no direct slots.

— Function: gtk-page-setup-new ⇒  (ret <gtk-page-setup>)

Creates a new <gtk-page-setup>.

ret
a new <gtk-page-setup>.

Since 2.10

— Function: gtk-page-setup-get-orientation (self <gtk-page-setup>) ⇒  (ret <gtk-page-orientation>)
— Method: get-orientation

Gets the page orientation of the <gtk-page-setup>.

setup
a <gtk-page-setup>
ret
the page orientation

Since 2.10

— Function: gtk-page-setup-set-orientation (self <gtk-page-setup>) (orientation <gtk-page-orientation>)
— Method: set-orientation

Sets the page orientation of the <gtk-page-setup>.

setup
a <gtk-page-setup>
orientation
a <gtk-page-orientation> value

Since 2.10

— Function: gtk-page-setup-get-paper-size (self <gtk-page-setup>) ⇒  (ret <gtk-paper-size>)
— Method: get-paper-size

Gets the paper size of the <gtk-page-setup>.

setup
a <gtk-page-setup>
ret
the paper size

Since 2.10

— Function: gtk-page-setup-set-paper-size (self <gtk-page-setup>) (size <gtk-paper-size>)
— Method: set-paper-size

Sets the paper size of the <gtk-page-setup> without changing the margins. See gtk-page-setup-set-paper-size-and-default-margins.

setup
a <gtk-page-setup>
size
a <gtk-paper-size>

Since 2.10

— Function: gtk-page-setup-get-top-margin (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-top-margin

Gets the top margin in units of unit.

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the top margin

Since 2.10

— Function: gtk-page-setup-set-top-margin (self <gtk-page-setup>) (margin double) (unit <gtk-unit>)
— Method: set-top-margin

Sets the top margin of the <gtk-page-setup>.

setup
a <gtk-page-setup>
margin
the new top margin in units of unit
unit
the units for margin

Since 2.10

— Function: gtk-page-setup-get-bottom-margin (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-bottom-margin

Gets the bottom margin in units of unit.

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the bottom margin

Since 2.10

— Function: gtk-page-setup-set-bottom-margin (self <gtk-page-setup>) (margin double) (unit <gtk-unit>)
— Method: set-bottom-margin

Sets the bottom margin of the <gtk-page-setup>.

setup
a <gtk-page-setup>
margin
the new bottom margin in units of unit
unit
the units for margin

Since 2.10

— Function: gtk-page-setup-get-left-margin (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-left-margin

Gets the left margin in units of unit.

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the left margin

Since 2.10

— Function: gtk-page-setup-set-left-margin (self <gtk-page-setup>) (margin double) (unit <gtk-unit>)
— Method: set-left-margin

Sets the left margin of the <gtk-page-setup>.

setup
a <gtk-page-setup>
margin
the new left margin in units of unit
unit
the units for margin

Since 2.10

— Function: gtk-page-setup-get-right-margin (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-right-margin

Gets the right margin in units of unit.

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the right margin

Since 2.10

— Function: gtk-page-setup-set-right-margin (self <gtk-page-setup>) (margin double) (unit <gtk-unit>)
— Method: set-right-margin

Sets the right margin of the <gtk-page-setup>.

setup
a <gtk-page-setup>
margin
the new right margin in units of unit
unit
the units for margin

Since 2.10

— Function: gtk-page-setup-get-paper-width (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-paper-width

Returns the paper width in units of unit.

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

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the paper width.

Since 2.10

— Function: gtk-page-setup-get-paper-height (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-paper-height

Returns the paper height in units of unit.

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

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the paper height.

Since 2.10

— Function: gtk-page-setup-get-page-width (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-page-width

Returns the page width in units of unit.

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

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the page width.

Since 2.10

— Function: gtk-page-setup-get-page-height (self <gtk-page-setup>) (unit <gtk-unit>) ⇒  (ret double)
— Method: get-page-height

Returns the page height in units of unit.

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

setup
a <gtk-page-setup>
unit
the unit for the return value
ret
the page height.

Since 2.10