EvDocument: Evince Document Library Reference Manual

## EvDocument EvDocument |

## Functions

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

## Properties

gboolean | modified | Read / Write

## Types and Values

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

## Object Hierarchy

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

## Description

## Functions

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

Returns the EvDocumentInfo for the document.

#### Parameters

document | a EvDocument |

#### Returns

a EvDocumentInfo.

[transfer none]

### 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. If the backend does not support the format for the document's contents, EV_DOCUMENT_ERROR_UNSUPPORTED_CONTENT 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);

Synchronously loads the document from `stream` . See `ev_document_load()` for more information.

#### Parameters

document | a EvDocument |
stream | a GInputStream |
flags | flags from EvDocumentLoadFlags |
cancellable | a GCancellable, or `NULL`. | [allow-none]
error | a GError location to store an error, or `NULL`. | [allow-none]

#### Returns

`TRUE` if loading succeeded, or `FALSE` on error with `error` filled in

Since: 3.6

### ev_document_load_gfile ()

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

Synchronously loads the document from `file` . See `ev_document_load()` for more information.

#### Parameters

document | a EvDocument |
file | a GFile |
flags | flags from EvDocumentLoadFlags |
cancellable | a GCancellable, or `NULL`. | [allow-none]
error | a GError location to store an error, or `NULL`. | [allow-none]

#### Returns

`TRUE` if loading succeeded, or `FALSE` on error with `error` filled in

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

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

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

#### Parameters

document | an EvDocument |
rc | an EvRenderContext |

#### Returns

a GdkPixbuf.

[transfer full]

### ev_document_get_thumbnail_surface ()

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

#### Parameters

document | an EvDocument |
rc | an EvRenderContext |

#### Returns

a cairo_surface_t.

[transfer full]

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

Peforms a Synctex backward search to obtain the TeX input file, line and (possibly) column corresponding to the position (`x` ,`y` ) (in 72dpi coordinates) in the `page` of `document` .

#### Parameters

document | a EvDocument |
page_index | the target page |
x | X coordinate |
y | Y coordinate |

#### Returns

A pointer to the EvSourceLink structure that holds the result. `NULL` if synctex is not enabled for the document or no result is found. The EvSourceLink pointer should be freed with g_free after it is used.

### ev_document_synctex_forward_search ()

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

Peforms a Synctex forward search to obtain the area in the document corresponding to the position (line and column in `source_link` ) in the source Tex file.

#### Parameters

document | a EvDocument |
source_link | a EvSourceLink |

#### Returns

An EvMapping with the page number and area corresponding to the given line in the source file. It must be free with g_free when done

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

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

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

#### Members

EV_DOCUMENT_ERROR_INVALID |  |
EV_DOCUMENT_ERROR_UNSUPPORTED_CONTENT |  |
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 |  |
EV_DOCUMENT_LOAD_FLAG_NO_CACHE |  |

## Property Details

### The `“modified”` property

      “modified”                 gboolean

Whether the document has been modified.

Owner: EvDocument

Flags: Read / Write

Default value: FALSE