PopplerAttachment

## PopplerAttachment PopplerAttachment |

## Synopsis

                        PopplerAttachment;
    gboolean            poppler_attachment_save             (PopplerAttachment *attachment,
                                                             const char *filename,
                                                             GError **error);
    gboolean            poppler_attachment_save_to_callback (PopplerAttachment *attachment,
                                                             PopplerAttachmentSaveFunc save_func,
                                                             gpointer user_data,
                                                             GError **error);
    gboolean            (*PopplerAttachmentSaveFunc)        (const gchar *buf,
                                                             gsize count,
                                                             gpointer data,
                                                             GError **error);

## Description

## Details

### PopplerAttachment

    typedef struct _PopplerAttachment PopplerAttachment;

### poppler_attachment_save ()

    gboolean            poppler_attachment_save             (PopplerAttachment *attachment,
                                                             const char *filename,
                                                             GError **error);

Saves `attachment` to a file indicated by `filename`. If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain and whatever the save function generates.

`attachment` : | A PopplerAttachment.
`filename` : | name of file to save
`error` : | return location for error, or `NULL`.
Returns : | `TRUE`, if the file successfully saved

### poppler_attachment_save_to_callback ()

    gboolean            poppler_attachment_save_to_callback (PopplerAttachment *attachment,
                                                             PopplerAttachmentSaveFunc save_func,
                                                             gpointer user_data,
                                                             GError **error);

Saves `attachment` by feeding the produced data to `save_func`. Can be used when you want to store the attachment to something other than a file, such as an in-memory buffer or a socket. If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain and whatever the save function generates.

`attachment` : | A PopplerAttachment.
`save_func` : | a function that is called to save each block of data that the save routine generates.
`user_data` : | user data to pass to the save function.
`error` : | return location for error, or `NULL`.
Returns : | `TRUE`, if the save successfully completed

### PopplerAttachmentSaveFunc ()

    gboolean            (*PopplerAttachmentSaveFunc)        (const gchar *buf,
                                                             gsize count,
                                                             gpointer data,
                                                             GError **error);

Specifies the type of the function passed to `poppler_attachment_save_to_callback()`. It is called once for each block of bytes that is "written" by `poppler_attachment_save_to_callback()`. If successful it should return `TRUE`. If an error occurs it should set `error` and return `FALSE`, in which case `poppler_attachment_save_to_callback()` will fail with the same error.

`buf` : | buffer containing bytes to be written.
`count` : | number of bytes in `buf`.
`data` : | A location to return an error.
`error` : | user data passed to `poppler_attachment_save_to_callback()`
Returns : | %TRUE if successful, `FALSE` (with `error` set) if failed.