## EvDocument EvDocument |

## Synopsis

    struct              EvDocument;
    struct              EvDocumentClass;
    #define             EV_DOC_MUTEX_LOCK
    #define             EV_DOC_MUTEX_UNLOCK
    enum                EvDocumentError;
    struct              EvPoint;
    struct              EvSourceLink;
    struct              EvRectangle;
    struct              EvDocumentBackendInfo;
    enum                EvDocumentLoadFlags;
    GMutex *            ev_document_get_doc_mutex           (void);
    void                ev_document_doc_mutex_lock          (void);
    void                ev_document_doc_mutex_unlock        (void);
    gboolean            ev_document_doc_mutex_trylock       (void);
    GMutex *            ev_document_get_fc_mutex            (void);
    void                ev_document_fc_mutex_lock           (void);
    void                ev_document_fc_mutex_unlock         (void);
    gboolean            ev_document_fc_mutex_trylock        (void);
    EvDocumentInfo *    ev_document_get_info                (EvDocument *document);
    gboolean            ev_document_get_backend_info        (EvDocument *document,
                                                             EvDocumentBackendInfo *info);
    gboolean            ev_document_load                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gboolean            ev_document_load_stream             (EvDocument *document,
                                                             GInputStream *stream,
                                                             EvDocumentLoadFlags flags,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            ev_document_load_gfile              (EvDocument *document,
                                                             GFile *file,
                                                             EvDocumentLoadFlags flags,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            ev_document_save                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gint                ev_document_get_n_pages             (EvDocument *document);
    EvPage *            ev_document_get_page                (EvDocument *document,
                                                             gint index);
    void                ev_document_get_page_size           (EvDocument *document,
                                                             gint page_index,
                                                             double *width,
                                                             double *height);
    gchar *             ev_document_get_page_label          (EvDocument *document,
                                                             gint page_index);
    void                ev_document_get_min_page_size       (EvDocument *document,
                                                             gdouble *width,
                                                             gdouble *height);
    cairo_surface_t *   ev_document_render                  (EvDocument *document,
                                                             EvRenderContext *rc);
    const gchar *       ev_document_get_uri                 (EvDocument *document);
    const gchar *       ev_document_get_title               (EvDocument *document);
    gboolean            ev_document_is_page_size_uniform    (EvDocument *document);
    void                ev_document_get_max_page_size       (EvDocument *document,
                                                             gdouble *width,
                                                             gdouble *height);
    gboolean            ev_document_check_dimensions        (EvDocument *document);
    gint                ev_document_get_max_label_len       (EvDocument *document);
    gboolean            ev_document_has_text_page_labels    (EvDocument *document);
    gboolean            ev_document_find_page_by_label      (EvDocument *document,
                                                             const gchar *page_label,
                                                             gint *page_index);
    GdkPixbuf *         ev_document_get_thumbnail           (EvDocument *document,
                                                             EvRenderContext *rc);
    gboolean            ev_document_has_synctex             (EvDocument *document);
    EvSourceLink *      ev_document_synctex_backward_search (EvDocument *document,
                                                             gint page_index,
                                                             gfloat x,
                                                             gfloat y);
    EvMapping *         ev_document_synctex_forward_search  (EvDocument *document,
                                                             EvSourceLink *source_link);
    EvSourceLink *      ev_source_link_copy                 (EvSourceLink *link);
    void                ev_source_link_free                 (EvSourceLink *link);
    EvSourceLink *      ev_source_link_new                  (const gchar *filename,
                                                             gint line,
                                                             gint col);
    gint                ev_rect_cmp                         (EvRectangle *a,
                                                             EvRectangle *b);
    EvRectangle *       ev_rectangle_new                    (void);
    EvRectangle *       ev_rectangle_copy                   (EvRectangle *ev_rect);
    void                ev_rectangle_free                   (EvRectangle *ev_rect);
    #define             EV_BACKEND_IMPLEMENT_INTERFACE      (TYPE_IFACE,
                                                             iface_init)
    #define             EV_BACKEND_REGISTER_WITH_CODE       (BackendName,
                                                             backend_name,
                                                             CODE)
    #define             EV_BACKEND_REGISTER                 (BackendName,
                                                             backend_name)

## Object Hierarchy

      GObject
       +----EvDocument

      GEnum
       +----EvDocumentError

      GBoxed
       +----EvSourceLink

      GBoxed
       +----EvRectangle

      GFlags
       +----EvDocumentLoadFlags

## Description

## Details

### struct EvDocument

    struct EvDocument;

### struct EvDocumentClass

    struct EvDocumentClass {
            GObjectClass base_class;

            /* Virtual Methods  */
            gboolean          (* load)            (EvDocument      *document,
                                                   const char      *uri,
                                                   GError         **error);
            gboolean          (* save)            (EvDocument      *document,
                                                   const char      *uri,
                                                   GError         **error);
            gint              (* get_n_pages)     (EvDocument      *document);
    	EvPage          * (* get_page)        (EvDocument      *document,
    					       gint             index);
            void              (* get_page_size)   (EvDocument      *document,
                                                   EvPage          *page,
                                                   double          *width,
                                                   double          *height);
            gchar           * (* get_page_label)  (EvDocument      *document,
                                                   EvPage          *page);
            cairo_surface_t * (* render)          (EvDocument      *document,
                                                   EvRenderContext *rc);
    	GdkPixbuf       * (* get_thumbnail)   (EvDocument      *document,
    					       EvRenderContext *rc);
            EvDocumentInfo  * (* get_info)        (EvDocument      *document);
            gboolean          (* get_backend_info)(EvDocument      *document,
                                                   EvDocumentBackendInfo *info);
            gboolean	  (* support_synctex) (EvDocument      *document);

            /* GIO streams */
            gboolean          (* load_stream)     (EvDocument          *document,
                                                   GInputStream        *stream,
                                                   EvDocumentLoadFlags  flags,
                                                   GCancellable        *cancellable,
                                                   GError             **error);
            gboolean          (* load_gfile)      (EvDocument          *document,
                                                   GFile               *file,
                                                   EvDocumentLoadFlags  flags,
                                                   GCancellable        *cancellable,
                                                   GError             **error);
    };

### EV_DOC_MUTEX_LOCK

    #define EV_DOC_MUTEX_LOCK (ev_document_doc_mutex_lock ())

### EV_DOC_MUTEX_UNLOCK

    #define EV_DOC_MUTEX_UNLOCK (ev_document_doc_mutex_unlock ())

### enum EvDocumentError

    typedef enum {
            EV_DOCUMENT_ERROR_INVALID,
            EV_DOCUMENT_ERROR_ENCRYPTED
    } EvDocumentError;

`EV_DOCUMENT_ERROR_INVALID` |
`EV_DOCUMENT_ERROR_ENCRYPTED` |

### struct EvPoint

    struct EvPoint {
            double x;
            double y;
    };

### struct EvSourceLink

    struct EvSourceLink {
            gchar *filename;
            gint   line;
            gint   col;
    };

### struct EvRectangle

    struct EvRectangle {
    	gdouble x1;
    	gdouble y1;
    	gdouble x2;
    	gdouble y2;
    };

### struct EvDocumentBackendInfo

    struct EvDocumentBackendInfo {
    	const gchar *name;
    	const gchar *version;
    };

### enum EvDocumentLoadFlags

    typedef enum {
            EV_DOCUMENT_LOAD_FLAG_NONE = 0
    } EvDocumentLoadFlags;

`EV_DOCUMENT_LOAD_FLAG_NONE` |

### ev_document_get_doc_mutex ()

    GMutex *            ev_document_get_doc_mutex           (void);

### ev_document_doc_mutex_lock ()

    void                ev_document_doc_mutex_lock          (void);

### ev_document_doc_mutex_unlock ()

    void                ev_document_doc_mutex_unlock        (void);

### ev_document_doc_mutex_trylock ()

    gboolean            ev_document_doc_mutex_trylock       (void);

### ev_document_get_fc_mutex ()

    GMutex *            ev_document_get_fc_mutex            (void);

### ev_document_fc_mutex_lock ()

    void                ev_document_fc_mutex_lock           (void);

### ev_document_fc_mutex_unlock ()

    void                ev_document_fc_mutex_unlock         (void);

### ev_document_fc_mutex_trylock ()

    gboolean            ev_document_fc_mutex_trylock        (void);

### ev_document_get_info ()

    EvDocumentInfo *    ev_document_get_info                (EvDocument *document);

### ev_document_get_backend_info ()

    gboolean            ev_document_get_backend_info        (EvDocument *document,
                                                             EvDocumentBackendInfo *info);

### ev_document_load ()

    gboolean            ev_document_load                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);

Loads `document` from `uri`.

On failure, `FALSE` is returned and `error` is filled in. If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID is returned. Other errors are possible too, depending on the backend used to load the document and the URI, e.g. GIOError, GFileError, and GConvertError.

`document` : | a EvDocument
`uri` : | the document's URI
`error` : | a GError location to store an error, or `NULL`
Returns : | `TRUE` on success, or `FALSE` on failure.

### ev_document_load_stream ()

    gboolean            ev_document_load_stream             (EvDocument *document,
                                                             GInputStream *stream,
                                                             EvDocumentLoadFlags flags,
                                                             GCancellable *cancellable,
                                                             GError **error);

Since 3.6

### ev_document_load_gfile ()

    gboolean            ev_document_load_gfile              (EvDocument *document,
                                                             GFile *file,
                                                             EvDocumentLoadFlags flags,
                                                             GCancellable *cancellable,
                                                             GError **error);

Since 3.6

### ev_document_save ()

    gboolean            ev_document_save                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);

Saves `document` to `uri`.

`document` : | a EvDocument
`uri` : | the target URI
`error` : | a GError location to store an error, or `NULL`
Returns : | `TRUE` on success, or `FALSE` on error with `error` filled in

### ev_document_get_n_pages ()

    gint                ev_document_get_n_pages             (EvDocument *document);

### ev_document_get_page ()

    EvPage *            ev_document_get_page                (EvDocument *document,
                                                             gint index);

`document` : | a EvDocument
`index` : | index of page
Returns : | Newly created EvPage for the given index. [transfer full]

### ev_document_get_page_size ()

    void                ev_document_get_page_size           (EvDocument *document,
                                                             gint page_index,
                                                             double *width,
                                                             double *height);

`document` : | a EvDocument
`page_index` : | index of page
`width` : | return location for the width of the page, or `NULL`. [out][allow-none]
`height` : | return location for the height of the page, or `NULL`. [out][allow-none]

### ev_document_get_page_label ()

    gchar *             ev_document_get_page_label          (EvDocument *document,
                                                             gint page_index);

### ev_document_get_min_page_size ()

    void                ev_document_get_min_page_size       (EvDocument *document,
                                                             gdouble *width,
                                                             gdouble *height);

### ev_document_render ()

    cairo_surface_t *   ev_document_render                  (EvDocument *document,
                                                             EvRenderContext *rc);

### ev_document_get_uri ()

    const gchar *       ev_document_get_uri                 (EvDocument *document);

### ev_document_get_title ()

    const gchar *       ev_document_get_title               (EvDocument *document);

### ev_document_is_page_size_uniform ()

    gboolean            ev_document_is_page_size_uniform    (EvDocument *document);

### ev_document_get_max_page_size ()

    void                ev_document_get_max_page_size       (EvDocument *document,
                                                             gdouble *width,
                                                             gdouble *height);

### ev_document_check_dimensions ()

    gboolean            ev_document_check_dimensions        (EvDocument *document);

### ev_document_get_max_label_len ()

    gint                ev_document_get_max_label_len       (EvDocument *document);

### ev_document_has_text_page_labels ()

    gboolean            ev_document_has_text_page_labels    (EvDocument *document);

### ev_document_find_page_by_label ()

    gboolean            ev_document_find_page_by_label      (EvDocument *document,
                                                             const gchar *page_label,
                                                             gint *page_index);

### ev_document_get_thumbnail ()

    GdkPixbuf *         ev_document_get_thumbnail           (EvDocument *document,
                                                             EvRenderContext *rc);

### ev_document_has_synctex ()

    gboolean            ev_document_has_synctex             (EvDocument *document);

### ev_document_synctex_backward_search ()

    EvSourceLink *      ev_document_synctex_backward_search (EvDocument *document,
                                                             gint page_index,
                                                             gfloat x,
                                                             gfloat y);

### ev_document_synctex_forward_search ()

    EvMapping *         ev_document_synctex_forward_search  (EvDocument *document,
                                                             EvSourceLink *source_link);

### ev_source_link_copy ()

    EvSourceLink *      ev_source_link_copy                 (EvSourceLink *link);

### ev_source_link_free ()

    void                ev_source_link_free                 (EvSourceLink *link);

### ev_source_link_new ()

    EvSourceLink *      ev_source_link_new                  (const gchar *filename,
                                                             gint line,
                                                             gint col);

### ev_rect_cmp ()

    gint                ev_rect_cmp                         (EvRectangle *a,
                                                             EvRectangle *b);

### ev_rectangle_new ()

    EvRectangle *       ev_rectangle_new                    (void);

### ev_rectangle_copy ()

    EvRectangle *       ev_rectangle_copy                   (EvRectangle *ev_rect);

### ev_rectangle_free ()

    void                ev_rectangle_free                   (EvRectangle *ev_rect);

### EV_BACKEND_IMPLEMENT_INTERFACE()

    #define             EV_BACKEND_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)

### EV_BACKEND_REGISTER_WITH_CODE()

    #define             EV_BACKEND_REGISTER_WITH_CODE(BackendName, backend_name, CODE)

### EV_BACKEND_REGISTER()

    #define             EV_BACKEND_REGISTER(BackendName, backend_name)