## GXPSFile GXPSFile — XPS Files |

## Functions

GXPSFile * | gxps_file_new ()
guint | gxps_file_get_n_documents ()
GXPSDocument * | gxps_file_get_document ()
gint | gxps_file_get_document_for_link_target ()
GXPSCoreProperties * | gxps_file_get_core_properties ()

## Properties

GFile * | file | Write / Construct Only

## Types and Values

struct | GXPSFile
#define | GXPS_FILE_ERROR
enum | GXPSFileError

## Object Hierarchy

        GObject
        ╰── GXPSFile

## Implemented Interfaces

GXPSFile implements GInitable.

## Includes

    #include <libgxps/gxps.h>

## 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()`.

## Functions

### gxps_file_new ()

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

Creates a new GXPSFile for the given GFile.

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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` .

#### Parameters

xps | a GXPSFile |
target | a GXPSLinkTarget |

#### Returns

the index of the document pointed by the given GXPSLinkTarget or -1.

### gxps_file_get_core_properties ()

    GXPSCoreProperties *
    gxps_file_get_core_properties (GXPSFile *xps,
                                   GError **error);

Create a GXPSCoreProperties object containing the metadata of `xpsm` , or `NULL` in case of error or if the GXPSFile doesn't contain core properties.

#### Parameters

xps | a GXPSFile |
error | GError for error reporting, or `NULL` to ignore |

#### Returns

a new GXPSCoreProperties or `NULL`. Free the returned object with `g_object_unref()`.

[transfer full]

## Types and Values

### 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

Error codes returned by GXPSFile functions.

#### Members

GXPS_FILE_ERROR_INVALID | The XPS is invalid. |

## Property Details

### The `“file”` property

      “file”                     GFile *

The file file.

Owner: GXPSFile

Flags: Write / Construct Only

## See Also

GXPSDocument, GXPSLinkTarget