Evince Document Library Reference Manual: EvDocument

## EvDocument EvDocument |

## Functions

#define | EV_DOC_MUTEX_LOCK
#define | EV_DOC_MUTEX_UNLOCK
GMutex * | ev_document_get_doc_mutex ()
void | ev_document_doc_mutex_lock ()
void | ev_document_doc_mutex_unlock ()
gboolean | ev_document_doc_mutex_trylock ()
GMutex * | ev_document_get_fc_mutex ()
void | ev_document_fc_mutex_lock ()
void | ev_document_fc_mutex_unlock ()
gboolean | ev_document_fc_mutex_trylock ()
EvDocumentInfo * | ev_document_get_info ()
gboolean | ev_document_get_backend_info ()
gboolean | ev_document_load ()
gboolean | ev_document_load_stream ()
gboolean | ev_document_load_gfile ()
gboolean | ev_document_save ()
gint | ev_document_get_n_pages ()
EvPage * | ev_document_get_page ()
void | ev_document_get_page_size ()
gchar * | ev_document_get_page_label ()
void | ev_document_get_min_page_size ()
cairo_surface_t * | ev_document_render ()
const gchar * | ev_document_get_uri ()
const gchar * | ev_document_get_title ()
gboolean | ev_document_is_page_size_uniform ()
void | ev_document_get_max_page_size ()
gboolean | ev_document_check_dimensions ()
gint | ev_document_get_max_label_len ()
gboolean | ev_document_has_text_page_labels ()
gboolean | ev_document_find_page_by_label ()
GdkPixbuf * | ev_document_get_thumbnail ()
cairo_surface_t * | ev_document_get_thumbnail_surface ()
gboolean | ev_document_has_synctex ()
EvSourceLink * | ev_document_synctex_backward_search ()
EvMapping * | ev_document_synctex_forward_search ()
EvSourceLink * | ev_source_link_copy ()
void | ev_source_link_free ()
EvSourceLink * | ev_source_link_new ()
gint | ev_rect_cmp ()
EvRectangle * | ev_rectangle_new ()
EvRectangle * | ev_rectangle_copy ()
void | ev_rectangle_free ()
#define | EV_BACKEND_IMPLEMENT_INTERFACE()
#define | EV_BACKEND_REGISTER_WITH_CODE()
#define | EV_BACKEND_REGISTER()

## Types and Values

struct | EvDocument
struct | EvDocumentClass
enum | EvDocumentError
struct | EvPoint
struct | EvSourceLink
struct | EvRectangle
struct | EvDocumentBackendInfo
enum | EvDocumentLoadFlags

## Object Hierarchy

        GBoxed
        ├── EvRectangle
        ╰── EvSourceLink
        GEnum
        ╰── EvDocumentError
        GFlags
        ╰── EvDocumentLoadFlags
        GObject
        ╰── EvDocument

## Description

## Functions

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

### ev_document_get_doc_mutex ()

    GMutex *
    ev_document_get_doc_mutex (void);

#### Returns

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

#### Returns

### ev_document_get_fc_mutex ()

    GMutex *
    ev_document_get_fc_mutex (void);

#### Returns

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

#### Returns

### ev_document_get_info ()

    EvDocumentInfo *
    ev_document_get_info (EvDocument *document);

#### Returns

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

#### Parameters

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

#### Parameters

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);

#### Returns

### ev_document_get_page ()

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

#### Parameters

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);

#### Parameters

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);

#### Returns

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

#### Returns

### 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_get_thumbnail_surface ()

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

Since 3.14

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

#### Returns

### ev_rectangle_new ()

    EvRectangle *
    ev_rectangle_new (void);

#### Returns

### ev_rectangle_copy ()

    EvRectangle *
    ev_rectangle_copy (EvRectangle *ev_rect);

#### Returns

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

## Types and Values

### 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);
    	cairo_surface_t * (* get_thumbnail_surface) (EvDocument          *document,
    						     EvRenderContext     *rc);
    };

### enum EvDocumentError

#### Members

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

#### Members

EV_DOCUMENT_LOAD_FLAG_NONE |  |