EvDocument: Atril Document Library Reference Manual

## EvDocument EvDocument |

## Functions

GQuark | ev_document_error_quark ()
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_save ()
gint | ev_document_get_n_pages ()
EvPage * | ev_document_get_page ()
void | ev_document_get_page_size ()
gchar * | ev_document_get_page_label ()
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 ()
gint | ev_rect_cmp ()
GType | ev_rectangle_get_type ()
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()
#define | EV_DEFINE_BOXED_TYPE()

## Types and Values

struct | EvDocument
struct | EvDocumentClass
| EvDocumentPrivate
#define | EV_DOCUMENT_ERROR
#define | EV_DOC_MUTEX_LOCK
#define | EV_DOC_MUTEX_UNLOCK
enum | EvDocumentError
| EvPoint
struct | EvRectangle
struct | EvDocumentBackendInfo
#define | EV_TYPE_RECTANGLE

## Object Hierarchy

        GBoxed
        ╰── EvRectangle
        GEnum
        ╰── EvDocumentError
        GObject
        ╰── EvDocument

## Description

## Functions

### ev_document_error_quark ()

    GQuark
    ev_document_error_quark (void);

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

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

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

Saves `document` to `uri` .

#### Parameters

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

### ev_document_get_page_size ()

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

### ev_document_get_page_label ()

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

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

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

### ev_rectangle_get_type ()

    GType
    ev_rectangle_get_type (void);

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

### EV_DEFINE_BOXED_TYPE()

    #define             EV_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func)

## 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);
            EvDocumentInfo  * (* get_info)        (EvDocument      *document);
            gboolean          (* get_backend_info)(EvDocument      *document,
                                                   EvDocumentBackendInfo *info);
            gboolean	  (* support_synctex) (EvDocument      *document);

    	void              (* toggle_night_mode)  (EvDocument      *document,gboolean night);
    	void              (*check_add_night_sheet)(EvDocument      *document);
    };

### EvDocumentPrivate

    typedef struct _EvDocumentPrivate EvDocumentPrivate;

### EV_DOCUMENT_ERROR

    #define EV_DOCUMENT_ERROR ev_document_error_quark ()

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

### EvPoint

    typedef struct {
            double x;
            double y;
    } EvPoint;

### struct EvRectangle

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

### struct EvDocumentBackendInfo

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

### EV_TYPE_RECTANGLE

    #define EV_TYPE_RECTANGLE (ev_rectangle_get_type ())