ev-document-factory

## ev-document-factory ev-document-factory |

## Functions

EvDocument * | ev_document_factory_get_document ()
EvDocument * | ev_document_factory_get_document_for_gfile ()
EvDocument * | ev_document_factory_get_document_for_stream ()
void | ev_document_factory_add_filters ()

## Description

## Functions

### ev_document_factory_get_document ()

    EvDocument *
    ev_document_factory_get_document (const char *uri,
                                      GError **error);

Creates a EvDocument for the document at `uri` ; or, if no backend handling the document's type is found, or an error occurred on opening the document, returns `NULL` and fills in `error` . If the document is encrypted, it is returned but also `error` is set to `EV_DOCUMENT_ERROR_ENCRYPTED`.

#### Parameters

uri | an URI |
error | a GError location to store an error, or `NULL` |

#### Returns

a new EvDocument, or `NULL`.

[transfer full]

### ev_document_factory_get_document_for_gfile ()

    EvDocument *
    ev_document_factory_get_document_for_gfile
                                   (GFile *file,
                                    EvDocumentLoadFlags flags,
                                    GCancellable *cancellable,
                                    GError **error);

Synchronously creates a EvDocument for the document at `file` ; or, if no backend handling the document's type is found, or an error occurred on opening the document, returns `NULL` and fills in `error` . If the document is encrypted, it is returned but also `error` is set to `EV_DOCUMENT_ERROR_ENCRYPTED`.

#### Parameters

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

a new EvDocument, or `NULL`.

[transfer full]

Since: 3.6

### ev_document_factory_get_document_for_stream ()

    EvDocument *
    ev_document_factory_get_document_for_stream
                                   (GInputStream *stream,
                                    const char *mime_type,
                                    EvDocumentLoadFlags flags,
                                    GCancellable *cancellable,
                                    GError **error);

Synchronously creates a EvDocument for the document from `stream` ; or, if no backend handling the document's type is found, or an error occurred on opening the document, returns `NULL` and fills in `error` . If the document is encrypted, it is returned but also `error` is set to `EV_DOCUMENT_ERROR_ENCRYPTED`.

If `mime_type` is non-`NULL`, this overrides any type inferred from the stream. If the mime type cannot be inferred from the stream, and `mime_type` is `NULL`, an error is returned.

#### Parameters

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

#### Returns

a new EvDocument, or `NULL`.

[transfer full]

Since: 3.6

### ev_document_factory_add_filters ()

    void
    ev_document_factory_add_filters (GtkWidget *chooser,
                                     EvDocument *document);

Adds some file filters to `chooser` .

Always add a "All documents" format.

If `document` is not `NULL`, adds a GtkFileFilter for `document` 's MIME type.

If `document` is `NULL`, adds a GtkFileFilter for each document type that evince can handle.

#### Parameters

chooser | a GtkFileChooser |
document | a EvDocument, or `NULL` |

## Types and Values