PageSetup
Object Hierarchy:
Gtk.PageSetup
Gtk.PageSetup
Gtk.PageSetup
GLib.Object
GLib.Object
GLib.Object->Gtk.PageSetup
Description:
[ CCode ( type_id = "gtk_page_setup_get_type ()" ) ]public class PageSetup : Object
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
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 [[email protected] ] to get the defaults, or use [[email protected] _run_page_setup_dialog] to show the
page setup dialog and receive the resulting page setup.
A page setup dialog
```c 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; } ```
Content:
Creation methods:
public PageSetup ()
Creates a new `GtkPageSetup`.
public PageSetup.from_file (string file_name) throws Error
Reads the page setup from the file file_name
.
public PageSetup.from_gvariant (Variant variant)
Desrialize a page setup from an a{sv} variant.
public PageSetup.from_key_file (KeyFile key_file, string ? group_name) throws Error
Reads the page setup from the group group_name
in the key
file key_file
.
Methods:
public PageSetup copy ()
Copies a `GtkPageSetup`.
public double get_bottom_margin (Unit unit)
Gets the bottom margin in units of unit
.
public double get_left_margin (Unit unit)
Gets the left margin in units of unit
.
public PageOrientation get_orientation ()
Gets the page orientation of the `GtkPageSetup`.
public double get_page_height (Unit unit)
Returns the page height in units of unit
.
public double get_page_width (Unit unit)
Returns the page width in units of unit
.
public double get_paper_height (Unit unit)
Returns the paper height in units of unit
.
public unowned PaperSize get_paper_size ()
Gets the paper size of the `GtkPageSetup`.
public double get_paper_width (Unit unit)
Returns the paper width in units of unit
.
public double get_right_margin (Unit unit)
Gets the right margin in units of unit
.
public double get_top_margin (Unit unit)
Gets the top margin in units of unit
.
public bool load_file (string file_name) throws Error
Reads the page setup from the file file_name
.
public bool load_key_file (KeyFile key_file, string ? group_name) throws Error
Reads the page setup from the group group_name
in the key
file key_file
.
public void set_bottom_margin (double margin, Unit unit)
Sets the bottom margin of the `GtkPageSetup`.
public void set_left_margin (double margin, Unit unit)
Sets the left margin of the `GtkPageSetup`.
public void set_orientation (PageOrientation orientation)
Sets the page orientation of the `GtkPageSetup`.
public void set_paper_size (PaperSize size)
Sets the paper size of the `GtkPageSetup` without changing the
margins.
public void set_paper_size_and_default_margins (PaperSize size)
Sets the paper size of the `GtkPageSetup` and modifies the margins
according to the new paper size.
public void set_right_margin (double margin, Unit unit)
Sets the right margin of the `GtkPageSetup`.
public void set_top_margin (double margin, Unit unit)
Sets the top margin of the `GtkPageSetup`.
public bool to_file (string file_name) throws Error
This function saves the information from
this to file_name
.
public Variant to_gvariant ()
Serialize page setup to an a{sv} variant.
public void to_key_file (KeyFile key_file, string ? group_name)
This function adds the page setup from this
to key_file
.
Inherited Members:
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref