GXPSDocument

## GXPSDocument GXPSDocument — XPS Documents |

## Synopsis

    #include <libgxps/gxps.h>

    struct              GXPSDocument;
    guint               gxps_document_get_n_pages           (GXPSDocument *doc);
    GXPSPage *          gxps_document_get_page              (GXPSDocument *doc,
                                                             guint n_page,
                                                             GError **error);
    gboolean            gxps_document_get_page_size         (GXPSDocument *doc,
                                                             guint n_page,
                                                             gdouble *width,
                                                             gdouble *height);
    gint                gxps_document_get_page_for_anchor   (GXPSDocument *doc,
                                                             const gchar *anchor);
    GXPSDocumentStructure * gxps_document_get_structure     (GXPSDocument *doc);

## Object Hierarchy

      GObject
       +----GXPSDocument

## Implemented Interfaces

GXPSDocument implements GInitable.

## Properties

      "archive"                  GXPSArchive*          : Write / Construct Only
      "source"                   gchar*                : Write / Construct Only

## Description

GXPSDocument represents a document in a GXPSFile. GXPSDocument objects can not be created directly, they are retrieved from a GXPSFile with `gxps_file_get_document()`.

## Details

### struct GXPSDocument

    struct GXPSDocument;

The GXPSDocument struct contains only private fields and should not be directly accessed.

### gxps_document_get_n_pages ()

    guint               gxps_document_get_n_pages           (GXPSDocument *doc);

Gets the number of pages in `doc`.

`doc` : | a GXPSDocument
Returns : | the number of pages.

### gxps_document_get_page ()

    GXPSPage *          gxps_document_get_page              (GXPSDocument *doc,
                                                             guint n_page,
                                                             GError **error);

Creates a new GXPSPage representing the page at index `n_doc` in `doc` document.

`doc` : | a GXPSDocument
`n_page` : | the index of the page to get
`error` : | GError for error reporting, or `NULL` to ignore
Returns : | a new GXPSPage or `NULL` on error. Free the returned object with `g_object_unref()`. [transfer full]

### gxps_document_get_page_size ()

    gboolean            gxps_document_get_page_size         (GXPSDocument *doc,
                                                             guint n_page,
                                                             gdouble *width,
                                                             gdouble *height);

Gets the typical size of the page at index `n_page` in `doc` document. This function is useful to get the advisory size of pages in a document without creating GXPSPage objects. This page size might be different than the actual page size so page dimension might need to be updated once the page is loaded. Advisory page sizes are not always available in `doc`, in which case this function returns `FALSE`. To get the authoritative size of a page you should use `gxps_page_get_size()` instead.

`doc` : | a GXPSDocument
`n_page` : | the index of a page in `doc`
`width` : | return location for the width of `n_page`. [out][allow-none]
`height` : | return location for the height of `n_page`. [out][allow-none]
Returns : | `TRUE` if the page size information is available in `doc`, `FALSE` otherwise.

### gxps_document_get_page_for_anchor ()

    gint                gxps_document_get_page_for_anchor   (GXPSDocument *doc,
                                                             const gchar *anchor);

Gets the index of the page in `doc` where the given anchor is.

`doc` : | a GXPSDocument
`anchor` : | the name of an anchor
Returns : | the page index of the given anchor.

### gxps_document_get_structure ()

    GXPSDocumentStructure * gxps_document_get_structure     (GXPSDocument *doc);

Creates a new GXPSDocumentStructure representing the document structure of `doc`.

`doc` : | a a GXPSDocument
Returns : | a new GXPSDocumentStructure or `NULL` if document doesn't have a structure. Free the returned object with `g_object_unref()`. [transfer full]

## Property Details

### The `"archive"` property

      "archive"                  GXPSArchive*          : Write / Construct Only

The document archive.

### The `"source"` property

      "source"                   gchar*                : Write / Construct Only

The Document Source File.

Default value: NULL

## See Also

GXPSFile, GXPSPage, GXPSDocumentStructure