GXPSFile

## GXPSFile GXPSFile — XPS Files |

## Synopsis

    #include <libgxps/gxps.h>

    struct              GXPSFile;
    #define             GXPS_FILE_ERROR
    enum                GXPSFileError;
    GXPSFile *          gxps_file_new                       (GFile *filename,
                                                             GError **error);
    guint               gxps_file_get_n_documents           (GXPSFile *xps);
    GXPSDocument *      gxps_file_get_document              (GXPSFile *xps,
                                                             guint n_doc,
                                                             GError **error);
    gint                gxps_file_get_document_for_link_target
                                                            (GXPSFile *xps,
                                                             GXPSLinkTarget *target);

## Object Hierarchy

      GObject
       +----GXPSFile

## Implemented Interfaces

GXPSFile implements GInitable.

## Properties

      "file"                     GFile*                : Write / Construct Only

## Description

GXPSFile represents a XPS file. A GXPSFile is a set of one or more documents, you can get the amount of documents contained in the set with `gxps_file_get_n_documents()`. Documents can be retrieved by their index in the set with `gxps_file_get_document()`.

## Details

### struct GXPSFile

    struct GXPSFile;

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

### GXPS_FILE_ERROR

    #define GXPS_FILE_ERROR          (gxps_file_error_quark ())

Error domain for GXPSFile. Errors in this domain will be from the GXPSFileError enumeration. See GError for more information on error domains.

### enum GXPSFileError

    typedef enum {
    	GXPS_FILE_ERROR_INVALID
    } GXPSFileError;

Error codes returned by GXPSFile functions.

`GXPS_FILE_ERROR_INVALID` | The XPS is invalid.

### gxps_file_new ()

    GXPSFile *          gxps_file_new                       (GFile *filename,
                                                             GError **error);

Creates a new GXPSFile for the given GFile.

`filename` : | a GFile
`error` : | GError for error reporting, or `NULL` to ignore
Returns : | a GXPSFile or `NULL` on error.

### gxps_file_get_n_documents ()

    guint               gxps_file_get_n_documents           (GXPSFile *xps);

Gets the number of documents in `xps`.

`xps` : | a GXPSFile
Returns : | the number of documents.

### gxps_file_get_document ()

    GXPSDocument *      gxps_file_get_document              (GXPSFile *xps,
                                                             guint n_doc,
                                                             GError **error);

Creates a new GXPSDocument representing the document at index `n_doc` in `xps` file.

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

### gxps_file_get_document_for_link_target ()

    gint                gxps_file_get_document_for_link_target
                                                            (GXPSFile *xps,
                                                             GXPSLinkTarget *target);

Gets the index of the document in `xps` pointed by `target`. If the GXPSLinkTarget does not reference a document, or referenced document is not found in `xps` file -1 will be returned. In this case you can look for the page pointed by the link target by calling `gxps_document_get_page_for_anchor()` with the anchor of the GXPSLinkTarget for every document in `xps`.

`xps` : | a GXPSFile
`target` : | a GXPSLinkTarget
Returns : | the index of the document pointed by the given GXPSLinkTarget or -1.

## Property Details

### The `"file"` property

      "file"                     GFile*                : Write / Construct Only

The file file.

## See Also

GXPSDocument, GXPSLinkTarget