## PopplerDocument PopplerDocument — Information about a document |

## Synopsis

    #include <poppler.h>

                        PopplerDocument;
                        PopplerIndexIter;
                        PopplerFontsIter;
                        PopplerLayersIter;
    enum                PopplerPageLayout;
    enum                PopplerPageMode;
                        PopplerFontInfo;
    enum                PopplerFontType;
                        PopplerPSFile;
    enum                PopplerViewerPreferences;
    enum                PopplerPermissions;
    PopplerDocument *   poppler_document_new_from_file      (const char *uri,
                                                             const char *password,
                                                             GError **error);
    PopplerDocument *   poppler_document_new_from_data      (char *data,
                                                             int length,
                                                             const char *password,
                                                             GError **error);
    PopplerDocument *   poppler_document_new_from_stream    (GInputStream *stream,
                                                             goffset length,
                                                             const char *password,
                                                             GCancellable *cancellable,
                                                             GError **error);
    PopplerDocument *   poppler_document_new_from_gfile     (GFile *file,
                                                             const char *password,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            poppler_document_save               (PopplerDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gboolean            poppler_document_save_a_copy        (PopplerDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gboolean            poppler_document_get_id             (PopplerDocument *document,
                                                             gchar **permanent_id,
                                                             gchar **update_id);
    gchar *             poppler_document_get_pdf_version_string
                                                            (PopplerDocument *document);
    void                poppler_document_get_pdf_version    (PopplerDocument *document,
                                                             guint *major_version,
                                                             guint *minor_version);
    gchar *             poppler_document_get_title          (PopplerDocument *document);
    gchar *             poppler_document_get_author         (PopplerDocument *document);
    gchar *             poppler_document_get_subject        (PopplerDocument *document);
    gchar *             poppler_document_get_keywords       (PopplerDocument *document);
    gchar *             poppler_document_get_creator        (PopplerDocument *document);
    gchar *             poppler_document_get_producer       (PopplerDocument *document);
    time_t              poppler_document_get_creation_date  (PopplerDocument *document);
    time_t              poppler_document_get_modification_date
                                                            (PopplerDocument *document);
    PopplerPageLayout   poppler_document_get_page_layout    (PopplerDocument *document);
    PopplerPageMode     poppler_document_get_page_mode      (PopplerDocument *document);
    PopplerPermissions  poppler_document_get_permissions    (PopplerDocument *document);
    gchar *             poppler_document_get_metadata       (PopplerDocument *document);
    gboolean            poppler_document_is_linearized      (PopplerDocument *document);
    int                 poppler_document_get_n_pages        (PopplerDocument *document);
    PopplerPage *       poppler_document_get_page           (PopplerDocument *document,
                                                             int index);
    PopplerPage *       poppler_document_get_page_by_label  (PopplerDocument *document,
                                                             const char *label);
    PopplerDest *       poppler_document_find_dest          (PopplerDocument *document,
                                                             const gchar *link_name);
    guint               poppler_document_get_n_attachments  (PopplerDocument *document);
    gboolean            poppler_document_has_attachments    (PopplerDocument *document);
    GList *             poppler_document_get_attachments    (PopplerDocument *document);
    PopplerFormField *  poppler_document_get_form_field     (PopplerDocument *document,
                                                             gint id);
    PopplerIndexIter *  poppler_index_iter_new              (PopplerDocument *document);
    PopplerIndexIter *  poppler_index_iter_copy             (PopplerIndexIter *iter);
    void                poppler_index_iter_free             (PopplerIndexIter *iter);
    PopplerIndexIter *  poppler_index_iter_get_child        (PopplerIndexIter *parent);
    gboolean            poppler_index_iter_is_open          (PopplerIndexIter *iter);
    PopplerAction *     poppler_index_iter_get_action       (PopplerIndexIter *iter);
    gboolean            poppler_index_iter_next             (PopplerIndexIter *iter);
    PopplerFontInfo *   poppler_font_info_new               (PopplerDocument *document);
    gboolean            poppler_font_info_scan              (PopplerFontInfo *font_info,
                                                             int n_pages,
                                                             PopplerFontsIter **iter);
    void                poppler_font_info_free              (PopplerFontInfo *font_info);
    PopplerFontsIter *  poppler_fonts_iter_copy             (PopplerFontsIter *iter);
    void                poppler_fonts_iter_free             (PopplerFontsIter *iter);
    const char *        poppler_fonts_iter_get_name         (PopplerFontsIter *iter);
    const char *        poppler_fonts_iter_get_full_name    (PopplerFontsIter *iter);
    PopplerFontType     poppler_fonts_iter_get_font_type    (PopplerFontsIter *iter);
    const char *        poppler_fonts_iter_get_substitute_name
                                                            (PopplerFontsIter *iter);
    const char *        poppler_fonts_iter_get_file_name    (PopplerFontsIter *iter);
    const char *        poppler_fonts_iter_get_encoding     (PopplerFontsIter *iter);
    gboolean            poppler_fonts_iter_is_embedded      (PopplerFontsIter *iter);
    gboolean            poppler_fonts_iter_is_subset        (PopplerFontsIter *iter);
    gboolean            poppler_fonts_iter_next             (PopplerFontsIter *iter);
    PopplerLayersIter * poppler_layers_iter_new             (PopplerDocument *document);
    PopplerLayersIter * poppler_layers_iter_copy            (PopplerLayersIter *iter);
    void                poppler_layers_iter_free            (PopplerLayersIter *iter);
    PopplerLayersIter * poppler_layers_iter_get_child       (PopplerLayersIter *parent);
    PopplerLayer *      poppler_layers_iter_get_layer       (PopplerLayersIter *iter);
    gchar *             poppler_layers_iter_get_title       (PopplerLayersIter *iter);
    gboolean            poppler_layers_iter_next            (PopplerLayersIter *iter);
    PopplerPSFile *     poppler_ps_file_new                 (PopplerDocument *document,
                                                             const char *filename,
                                                             int first_page,
                                                             int n_pages);
    void                poppler_ps_file_free                (PopplerPSFile *ps_file);
    void                poppler_ps_file_set_paper_size      (PopplerPSFile *ps_file,
                                                             double width,
                                                             double height);
    void                poppler_ps_file_set_duplex          (PopplerPSFile *ps_file,
                                                             gboolean duplex);

## Object Hierarchy

      GObject
       +----PopplerDocument

## Properties

      "author"                   gchar*                : Read
      "creation-date"            gint                  : Read
      "creator"                  gchar*                : Read
      "format"                   gchar*                : Read
      "format-major"             guint                 : Read
      "format-minor"             guint                 : Read
      "keywords"                 gchar*                : Read
      "linearized"               gboolean              : Read
      "metadata"                 gchar*                : Read
      "mod-date"                 gint                  : Read
      "page-layout"              PopplerPageLayout     : Read
      "page-mode"                PopplerPageMode       : Read
      "permissions"              PopplerPermissions    : Read
      "producer"                 gchar*                : Read
      "subject"                  gchar*                : Read
      "title"                    gchar*                : Read
      "viewer-preferences"       PopplerViewerPreferences  : Read

## Description

The PopplerDocument is an object used to refer to a main document.

## Details

### PopplerDocument

    typedef struct _PopplerDocument PopplerDocument;

### PopplerIndexIter

    typedef struct _PopplerIndexIter PopplerIndexIter;

### PopplerFontsIter

    typedef struct _PopplerFontsIter PopplerFontsIter;

### PopplerLayersIter

    typedef struct _PopplerLayersIter PopplerLayersIter;

### enum PopplerPageLayout

    typedef enum {
      POPPLER_PAGE_LAYOUT_UNSET,
      POPPLER_PAGE_LAYOUT_SINGLE_PAGE,
      POPPLER_PAGE_LAYOUT_ONE_COLUMN,
      POPPLER_PAGE_LAYOUT_TWO_COLUMN_LEFT,
      POPPLER_PAGE_LAYOUT_TWO_COLUMN_RIGHT,
      POPPLER_PAGE_LAYOUT_TWO_PAGE_LEFT,
      POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT
    } PopplerPageLayout;

Page layout types

`POPPLER_PAGE_LAYOUT_UNSET` | no specific layout set
`POPPLER_PAGE_LAYOUT_SINGLE_PAGE` | one page at a time
`POPPLER_PAGE_LAYOUT_ONE_COLUMN` | pages in one column
`POPPLER_PAGE_LAYOUT_TWO_COLUMN_LEFT` | pages in two columns with odd numbered pages on the left
`POPPLER_PAGE_LAYOUT_TWO_COLUMN_RIGHT` | pages in two columns with odd numbered pages on the right
`POPPLER_PAGE_LAYOUT_TWO_PAGE_LEFT` | two pages at a time with odd numbered pages on the left
`POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT` | two pages at a time with odd numbered pages on the right

### enum PopplerPageMode

    typedef enum {
      POPPLER_PAGE_MODE_UNSET,
      POPPLER_PAGE_MODE_NONE,
      POPPLER_PAGE_MODE_USE_OUTLINES,
      POPPLER_PAGE_MODE_USE_THUMBS,
      POPPLER_PAGE_MODE_FULL_SCREEN,
      POPPLER_PAGE_MODE_USE_OC,
      POPPLER_PAGE_MODE_USE_ATTACHMENTS
    } PopplerPageMode;

Page modes

`POPPLER_PAGE_MODE_UNSET` | no specific mode set
`POPPLER_PAGE_MODE_NONE` | neither document outline nor thumbnails visible
`POPPLER_PAGE_MODE_USE_OUTLINES` | document outline visible
`POPPLER_PAGE_MODE_USE_THUMBS` | thumbnails visible
`POPPLER_PAGE_MODE_FULL_SCREEN` | full-screen mode
`POPPLER_PAGE_MODE_USE_OC` | layers panel visible
`POPPLER_PAGE_MODE_USE_ATTACHMENTS` | attachments panel visible

### PopplerFontInfo

    typedef struct {
    } PopplerFontInfo;

### enum PopplerFontType

    typedef enum {
      POPPLER_FONT_TYPE_UNKNOWN,
      POPPLER_FONT_TYPE_TYPE1,
      POPPLER_FONT_TYPE_TYPE1C,
      POPPLER_FONT_TYPE_TYPE1COT,
      POPPLER_FONT_TYPE_TYPE3,
      POPPLER_FONT_TYPE_TRUETYPE,
      POPPLER_FONT_TYPE_TRUETYPEOT,
      POPPLER_FONT_TYPE_CID_TYPE0,
      POPPLER_FONT_TYPE_CID_TYPE0C,
      POPPLER_FONT_TYPE_CID_TYPE0COT,
      POPPLER_FONT_TYPE_CID_TYPE2,
      POPPLER_FONT_TYPE_CID_TYPE2OT
    } PopplerFontType;

Font types

`POPPLER_FONT_TYPE_UNKNOWN` | unknown font type
`POPPLER_FONT_TYPE_TYPE1` | Type 1 font type
`POPPLER_FONT_TYPE_TYPE1C` | Type 1 font type embedded in Compact Font Format (CFF) font program
`POPPLER_FONT_TYPE_TYPE1COT` | Type 1 font type embedded in OpenType font program
`POPPLER_FONT_TYPE_TYPE3` | A font type that is defined with PDF graphics operators
`POPPLER_FONT_TYPE_TRUETYPE` | TrueType font type
`POPPLER_FONT_TYPE_TRUETYPEOT` | TrueType font type embedded in OpenType font program
`POPPLER_FONT_TYPE_CID_TYPE0` | CIDFont type based on Type 1 font technology
`POPPLER_FONT_TYPE_CID_TYPE0C` | CIDFont type based on Type 1 font technology embedded in CFF font program
`POPPLER_FONT_TYPE_CID_TYPE0COT` | CIDFont type based on Type 1 font technology embedded in OpenType font program
`POPPLER_FONT_TYPE_CID_TYPE2` | CIDFont type based on TrueType font technology
`POPPLER_FONT_TYPE_CID_TYPE2OT` | CIDFont type based on TrueType font technology embedded in OpenType font program

### PopplerPSFile

    typedef struct {
    } PopplerPSFile;

### enum PopplerViewerPreferences

    typedef enum {
      POPPLER_VIEWER_PREFERENCES_UNSET = 0,
      POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR = 1 << 0,
      POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR = 1 << 1,
      POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI = 1 << 2,
      POPPLER_VIEWER_PREFERENCES_FIT_WINDOW = 1 << 3,
      POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW = 1 << 4,
      POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE = 1 << 5,
      POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL = 1 << 6
    } PopplerViewerPreferences;

Viewer preferences

`POPPLER_VIEWER_PREFERENCES_UNSET` | no preferences set
`POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR` | hider toolbars when document is active
`POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR` | hide menu bar when document is active
`POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI` | hide UI elements in document's window
`POPPLER_VIEWER_PREFERENCES_FIT_WINDOW` | resize document's window to fit the size of the first displayed page
`POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW` | position the document's window in the center of the screen
`POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE` | display document title in window's title bar
`POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL` | the predominant reading order for text is right to left

### enum PopplerPermissions

    typedef enum {
      POPPLER_PERMISSIONS_OK_TO_PRINT = 1 << 0,
      POPPLER_PERMISSIONS_OK_TO_MODIFY = 1 << 1,
      POPPLER_PERMISSIONS_OK_TO_COPY = 1 << 2,
      POPPLER_PERMISSIONS_OK_TO_ADD_NOTES = 1 << 3,
      POPPLER_PERMISSIONS_OK_TO_FILL_FORM = 1 << 4,
      POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS = 1 << 5,
      POPPLER_PERMISSIONS_OK_TO_ASSEMBLE = 1 << 6,
      POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION = 1 << 7,
      POPPLER_PERMISSIONS_FULL = (POPPLER_PERMISSIONS_OK_TO_PRINT | POPPLER_PERMISSIONS_OK_TO_MODIFY | POPPLER_PERMISSIONS_OK_TO_COPY | POPPLER_PERMISSIONS_OK_TO_ADD_NOTES | POPPLER_PERMISSIONS_OK_TO_FILL_FORM | POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS | POPPLER_PERMISSIONS_OK_TO_ASSEMBLE | POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION)
    } PopplerPermissions;

Permissions

`POPPLER_PERMISSIONS_OK_TO_PRINT` | document can be printer
`POPPLER_PERMISSIONS_OK_TO_MODIFY` | document contents can be modified
`POPPLER_PERMISSIONS_OK_TO_COPY` | document can be copied
`POPPLER_PERMISSIONS_OK_TO_ADD_NOTES` | annotations can added to the document
`POPPLER_PERMISSIONS_OK_TO_FILL_FORM` | interactive form fields can be filled in
`POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS` | extract text and graphics (in support of accessibility to users with disabilities or for other purposes). Since 0.18
`POPPLER_PERMISSIONS_OK_TO_ASSEMBLE` | assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images). Since 0.18
`POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION` | document can be printer at high resolution. Since 0.18
`POPPLER_PERMISSIONS_FULL` | document permits all operations

### poppler_document_new_from_file ()

    PopplerDocument *   poppler_document_new_from_file      (const char *uri,
                                                             const char *password,
                                                             GError **error);

Creates a new PopplerDocument. If `NULL` is returned, then `error` will be set. Possible errors include those in the POPPLER_ERROR and G_FILE_ERROR domains.

`uri` : | uri of the file to load
`password` : | password to unlock the file with, or `NULL`. [allow-none]
`error` : | Return location for an error, or `NULL`. [allow-none]
Returns : | A newly created PopplerDocument, or `NULL`

### poppler_document_new_from_data ()

    PopplerDocument *   poppler_document_new_from_data      (char *data,
                                                             int length,
                                                             const char *password,
                                                             GError **error);

Creates a new PopplerDocument. If `NULL` is returned, then `error` will be set. Possible errors include those in the POPPLER_ERROR and G_FILE_ERROR domains.

`data` : | the pdf data contained in a char array
`length` : | the length of data
`password` : | password to unlock the file with, or `NULL`. [allow-none]
`error` : | Return location for an error, or `NULL`. [allow-none]
Returns : | A newly created PopplerDocument, or `NULL`

### poppler_document_new_from_stream ()

    PopplerDocument *   poppler_document_new_from_stream    (GInputStream *stream,
                                                             goffset length,
                                                             const char *password,
                                                             GCancellable *cancellable,
                                                             GError **error);

Creates a new PopplerDocument reading the PDF contents from `stream`. Note that the given GInputStream must be seekable or `G_IO_ERROR_NOT_SUPPORTED` will be returned. Possible errors include those in the POPPLER_ERROR and G_FILE_ERROR domains.

`stream` : | a GInputStream to read from
`length` : | the stream length, or -1 if not known
`password` : | password to unlock the file with, or `NULL`. [allow-none]
`cancellable` : | a GCancellable, or `NULL`. [allow-none]
`error` : | Return location for an error, or `NULL`. [allow-none]
Returns : | a new PopplerDocument, or `NULL`. [transfer full]

Since 0.22

### poppler_document_new_from_gfile ()

    PopplerDocument *   poppler_document_new_from_gfile     (GFile *file,
                                                             const char *password,
                                                             GCancellable *cancellable,
                                                             GError **error);

Creates a new PopplerDocument reading the PDF contents from `file`. Possible errors include those in the POPPLER_ERROR and G_FILE_ERROR domains.

`file` : | a GFile to load
`password` : | password to unlock the file with, or `NULL`. [allow-none]
`cancellable` : | a GCancellable, or `NULL`. [allow-none]
`error` : | Return location for an error, or `NULL`. [allow-none]
Returns : | a new PopplerDocument, or `NULL`. [transfer full]

Since 0.22

### poppler_document_save ()

    gboolean            poppler_document_save               (PopplerDocument *document,
                                                             const char *uri,
                                                             GError **error);

Saves `document`. Any change made in the document such as form fields filled, annotations added or modified will be saved. If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain.

`document` : | a PopplerDocument
`uri` : | uri of file to save
`error` : | return location for an error, or `NULL`. [allow-none]
Returns : | `TRUE`, if the document was successfully saved

### poppler_document_save_a_copy ()

    gboolean            poppler_document_save_a_copy        (PopplerDocument *document,
                                                             const char *uri,
                                                             GError **error);

Saves a copy of the original `document`. Any change made in the document such as form fields filled by the user will not be saved. If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain.

`document` : | a PopplerDocument
`uri` : | uri of file to save
`error` : | return location for an error, or `NULL`. [allow-none]
Returns : | `TRUE`, if the document was successfully saved

### poppler_document_get_id ()

    gboolean            poppler_document_get_id             (PopplerDocument *document,
                                                             gchar **permanent_id,
                                                             gchar **update_id);

Returns the PDF file identifier represented as two byte string arrays of size 32. `permanent_id` is the permanent identifier that is built based on the file contents at the time it was originally created, so that this identifer never changes. `update_id` is the update identifier that is built based on the file contents at the time it was last updated.

Note that returned strings are not null-terminated, they have a fixed size of 32 bytes.

`document` : | A PopplerDocument
`permanent_id` : | location to store an allocated string, use `g_free()` to free the returned string. [out][allow-none]
`update_id` : | location to store an allocated string, use `g_free()` to free the returned string. [out][allow-none]
Returns : | `TRUE` if the `document` contains an id, `FALSE` otherwise

Since 0.16

### poppler_document_get_pdf_version_string ()

    gchar *             poppler_document_get_pdf_version_string
                                                            (PopplerDocument *document);

Returns the PDF version of `document` as a string (e.g. PDF-1.6)

`document` : | A PopplerDocument
Returns : | a new allocated string containing the PDF version of `document`, or `NULL`

Since 0.16

### poppler_document_get_pdf_version ()

    void                poppler_document_get_pdf_version    (PopplerDocument *document,
                                                             guint *major_version,
                                                             guint *minor_version);

`document` : | A PopplerDocument
`major_version` : | return location for the PDF major version number. [out][allow-none]
`minor_version` : | return location for the PDF minor version number. [out][allow-none]
Returns : | the major and minor PDF version numbers

Since 0.16

### poppler_document_get_title ()

    gchar *             poppler_document_get_title          (PopplerDocument *document);

Returns the document's title

`document` : | A PopplerDocument
Returns : | a new allocated string containing the title of `document`, or `NULL`

Since 0.16

### poppler_document_get_author ()

    gchar *             poppler_document_get_author         (PopplerDocument *document);

Returns the author of the document

`document` : | A PopplerDocument
Returns : | a new allocated string containing the author of `document`, or `NULL`

Since 0.16

### poppler_document_get_subject ()

    gchar *             poppler_document_get_subject        (PopplerDocument *document);

Returns the subject of the document

`document` : | A PopplerDocument
Returns : | a new allocated string containing the subject of `document`, or `NULL`

Since 0.16

### poppler_document_get_keywords ()

    gchar *             poppler_document_get_keywords       (PopplerDocument *document);

Returns the keywords associated to the document

`document` : | A PopplerDocument
Returns : | a new allocated string containing keywords associated to `document`, or `NULL`

Since 0.16

### poppler_document_get_creator ()

    gchar *             poppler_document_get_creator        (PopplerDocument *document);

Returns the creator of the document. If the document was converted from another format, the creator is the name of the product that created the original document from which it was converted.

`document` : | A PopplerDocument
Returns : | a new allocated string containing the creator of `document`, or `NULL`

Since 0.16

### poppler_document_get_producer ()

    gchar *             poppler_document_get_producer       (PopplerDocument *document);

Returns the producer of the document. If the document was converted from another format, the producer is the name of the product that converted it to PDF

`document` : | A PopplerDocument
Returns : | a new allocated string containing the producer of `document`, or `NULL`

Since 0.16

### poppler_document_get_creation_date ()

    time_t              poppler_document_get_creation_date  (PopplerDocument *document);

Returns the date the document was created as seconds since the Epoch

`document` : | A PopplerDocument
Returns : | the date the document was created, or -1

Since 0.16

### poppler_document_get_modification_date ()

    time_t              poppler_document_get_modification_date
                                                            (PopplerDocument *document);

Returns the date the document was most recently modified as seconds since the Epoch

`document` : | A PopplerDocument
Returns : | the date the document was most recently modified, or -1

Since 0.16

### poppler_document_get_page_layout ()

    PopplerPageLayout   poppler_document_get_page_layout    (PopplerDocument *document);

Returns the page layout that should be used when the document is opened

`document` : | A PopplerDocument
Returns : | a PopplerPageLayout that should be used when the document is opened

Since 0.16

### poppler_document_get_page_mode ()

    PopplerPageMode     poppler_document_get_page_mode      (PopplerDocument *document);

Returns a PopplerPageMode representing how the document should be initially displayed when opened.

`document` : | A PopplerDocument
Returns : | a PopplerPageMode that should be used when document is opened

Since 0.16

### poppler_document_get_permissions ()

    PopplerPermissions  poppler_document_get_permissions    (PopplerDocument *document);

Returns the flags specifying which operations are permitted when the document is opened.

`document` : | A PopplerDocument
Returns : | a set of falgs from PopplerPermissions enumeration

Since 0.16

### poppler_document_get_metadata ()

    gchar *             poppler_document_get_metadata       (PopplerDocument *document);

Returns the XML metadata string of the document

`document` : | A PopplerDocument
Returns : | a new allocated string containing the XML metadata, or `NULL`

Since 0.16

### poppler_document_is_linearized ()

    gboolean            poppler_document_is_linearized      (PopplerDocument *document);

Returns whether `document` is linearized or not. Linearization of PDF enables efficient incremental access of the PDF file in a network environment.

`document` : | A PopplerDocument
Returns : | `TRUE` if `document` is linearized, `FALSE` otherwhise

Since 0.16

### poppler_document_get_n_pages ()

    int                 poppler_document_get_n_pages        (PopplerDocument *document);

Returns the number of pages in a loaded document.

`document` : | A PopplerDocument
Returns : | Number of pages

### poppler_document_get_page ()

    PopplerPage *       poppler_document_get_page           (PopplerDocument *document,
                                                             int index);

Returns the PopplerPage indexed at `index`. This object is owned by the caller.

`document` : | A PopplerDocument
`index` : | a page index
Returns : | (transfer full) : The PopplerPage at `index`

### poppler_document_get_page_by_label ()

    PopplerPage *       poppler_document_get_page_by_label  (PopplerDocument *document,
                                                             const char *label);

Returns the PopplerPage reference by `label`. This object is owned by the caller. `label` is a human-readable string representation of the page number, and can be document specific. Typically, it is a value such as "iii" or "3".

By default, "1" refers to the first page.

`document` : | A PopplerDocument
`label` : | a page label
Returns : | (transfer full) :The PopplerPage referenced by `label`

### poppler_document_find_dest ()

    PopplerDest *       poppler_document_find_dest          (PopplerDocument *document,
                                                             const gchar *link_name);

Finds named destination `link_name` in `document`

`document` : | A PopplerDocument
`link_name` : | a named destination
Returns : | The PopplerDest destination or `NULL` if `link_name` is not a destination. Returned value must be freed with poppler_dest_free

### poppler_document_get_n_attachments ()

    guint               poppler_document_get_n_attachments  (PopplerDocument *document);

Returns the number of attachments in a loaded document. See also `poppler_document_get_attachments()`

`document` : | A PopplerDocument
Returns : | Number of attachments

Since 0.18

### poppler_document_has_attachments ()

    gboolean            poppler_document_has_attachments    (PopplerDocument *document);

Returns `TRUE` of `document` has any attachments.

`document` : | A PopplerDocument
Returns : | `TRUE`, if `document` has attachments.

### poppler_document_get_attachments ()

    GList *             poppler_document_get_attachments    (PopplerDocument *document);

Returns a GList containing PopplerAttachments. These attachments are unowned, and must be unreffed, and the list must be freed with `g_list_free()`.

`document` : | A PopplerDocument
Returns : | a list of available attachments. [element-type PopplerAttachment][transfer full]

### poppler_document_get_form_field ()

    PopplerFormField *  poppler_document_get_form_field     (PopplerDocument *document,
                                                             gint id);

Returns the PopplerFormField for the given `id`. It must be freed with `g_object_unref()`

`document` : | a PopplerDocument
`id` : | an id of a PopplerFormField
Returns : | a new PopplerFormField or `NULL` if not found. [transfer full]

### poppler_index_iter_new ()

    PopplerIndexIter *  poppler_index_iter_new              (PopplerDocument *document);

Returns the root PopplerIndexIter for `document`, or `NULL`. This must be freed with `poppler_index_iter_free()`.

Certain documents have an index associated with them. This index can be used to help the user navigate the document, and is similar to a table of contents. Each node in the index will contain a PopplerAction that can be displayed to the user — typically a POPPLER_ACTION_GOTO_DEST or a POPPLER_ACTION_URI.

Here is a simple example of some code that walks the full index:

    static void
    walk_index (PopplerIndexIter *iter)
    {
      do
        {
          /* Get the the action and do something with it */
          PopplerIndexIter *child = poppler_index_iter_get_child (iter);
          if (child)
            walk_index (child);
          poppler_index_iter_free (child);
        }
      while (poppler_index_iter_next (iter));
    }
    ...
    {
      iter = poppler_index_iter_new (document);
      walk_index (iter);
      poppler_index_iter_free (iter);
    }

`document` : | a PopplerDocument
Returns : | a new PopplerIndexIter

### poppler_index_iter_copy ()

    PopplerIndexIter *  poppler_index_iter_copy             (PopplerIndexIter *iter);

Creates a new PopplerIndexIter as a copy of `iter`. This must be freed with `poppler_index_iter_free()`.

`iter` : | a PopplerIndexIter
Returns : | a new PopplerIndexIter

### poppler_index_iter_free ()

    void                poppler_index_iter_free             (PopplerIndexIter *iter);

Frees `iter`.

`iter` : | a PopplerIndexIter

### poppler_index_iter_get_child ()

    PopplerIndexIter *  poppler_index_iter_get_child        (PopplerIndexIter *parent);

Returns a newly created child of `parent`, or `NULL` if the iter has no child. See `poppler_index_iter_new()` for more information on this function.

`parent` : | a PopplerIndexIter
Returns : | a new PopplerIndexIter

### poppler_index_iter_is_open ()

    gboolean            poppler_index_iter_is_open          (PopplerIndexIter *iter);

Returns whether this node should be expanded by default to the user. The document can provide a hint as to how the document's index should be expanded initially.

`iter` : | a PopplerIndexIter
Returns : | `TRUE`, if the document wants `iter` to be expanded

### poppler_index_iter_get_action ()

    PopplerAction *     poppler_index_iter_get_action       (PopplerIndexIter *iter);

Returns the PopplerAction associated with `iter`. It must be freed with `poppler_action_free()`.

`iter` : | a PopplerIndexIter
Returns : | a new PopplerAction

### poppler_index_iter_next ()

    gboolean            poppler_index_iter_next             (PopplerIndexIter *iter);

Sets `iter` to point to the next action at the current level, if valid. See `poppler_index_iter_new()` for more information.

`iter` : | a PopplerIndexIter
Returns : | `TRUE`, if `iter` was set to the next action

### poppler_font_info_new ()

    PopplerFontInfo *   poppler_font_info_new               (PopplerDocument *document);

Creates a new PopplerFontInfo object

`document` : | a PopplerDocument
Returns : | a new PopplerFontInfo instance

### poppler_font_info_scan ()

    gboolean            poppler_font_info_scan              (PopplerFontInfo *font_info,
                                                             int n_pages,
                                                             PopplerFontsIter **iter);

Scans the document associated with `font_info` for fonts. At most `n_pages` will be scanned starting from the current iterator. `iter` will point to the first font scanned.

Here is a simple example of code to scan fonts in a document

    font_info = poppler_font_info_new (document);
    while (poppler_font_info_scan (font_info, 20, &fonts_iter)) {
            if (!fonts_iter)
                    continue; /* No fonts found in these 20 pages */
            do {
                    /* Do something with font iter */
                    g_print ("Font Name: %s\n", poppler_fonts_iter_get_name (fonts_iter));
            } while (poppler_fonts_iter_next (fonts_iter));
            poppler_fonts_iter_free (fonts_iter);
    }

`font_info` : | a PopplerFontInfo
`n_pages` : | number of pages to scan
`iter` : | return location for a PopplerFontsIter. [out]
Returns : | `TRUE`, if there are more fonts left to scan

### poppler_font_info_free ()

    void                poppler_font_info_free              (PopplerFontInfo *font_info);

### poppler_fonts_iter_copy ()

    PopplerFontsIter *  poppler_fonts_iter_copy             (PopplerFontsIter *iter);

Creates a copy of `iter`

`iter` : | a PopplerFontsIter to copy
Returns : | a new allocated copy of `iter`

### poppler_fonts_iter_free ()

    void                poppler_fonts_iter_free             (PopplerFontsIter *iter);

Frees the given PopplerFontsIter

`iter` : | a PopplerFontsIter

### poppler_fonts_iter_get_name ()

    const char *        poppler_fonts_iter_get_name         (PopplerFontsIter *iter);

Returns the name of the font associated with `iter`

`iter` : | a PopplerFontsIter
Returns : | the font name

### poppler_fonts_iter_get_full_name ()

    const char *        poppler_fonts_iter_get_full_name    (PopplerFontsIter *iter);

Returns the full name of the font associated with `iter`

`iter` : | a PopplerFontsIter
Returns : | the font full name

### poppler_fonts_iter_get_font_type ()

    PopplerFontType     poppler_fonts_iter_get_font_type    (PopplerFontsIter *iter);

Returns the type of the font associated with `iter`

`iter` : | a PopplerFontsIter
Returns : | the font type

### poppler_fonts_iter_get_substitute_name ()

    const char *        poppler_fonts_iter_get_substitute_name
                                                            (PopplerFontsIter *iter);

The name of the substitute font of the font associated with `iter` or `NULL` if the font is embedded

`iter` : | a PopplerFontsIter
Returns : | the name of the substitute font or `NULL` if font is embedded

Since 0.20

### poppler_fonts_iter_get_file_name ()

    const char *        poppler_fonts_iter_get_file_name    (PopplerFontsIter *iter);

The filename of the font associated with `iter` or `NULL` if the font is embedded

`iter` : | a PopplerFontsIter
Returns : | the filename of the font or `NULL` if font is embedded

### poppler_fonts_iter_get_encoding ()

    const char *        poppler_fonts_iter_get_encoding     (PopplerFontsIter *iter);

Returns the encoding of the font associated with `iter`

`iter` : | a PopplerFontsIter
Returns : | the font encoding

Since 0.20

### poppler_fonts_iter_is_embedded ()

    gboolean            poppler_fonts_iter_is_embedded      (PopplerFontsIter *iter);

Returns whether the font associated with `iter` is embedded in the document

`iter` : | a PopplerFontsIter
Returns : | `TRUE` if font is emebdded, `FALSE` otherwise

### poppler_fonts_iter_is_subset ()

    gboolean            poppler_fonts_iter_is_subset        (PopplerFontsIter *iter);

Returns whether the font associated with `iter` is a subset of another font

`iter` : | a PopplerFontsIter
Returns : | `TRUE` if font is a subset, `FALSE` otherwise

### poppler_fonts_iter_next ()

    gboolean            poppler_fonts_iter_next             (PopplerFontsIter *iter);

Sets `iter` to point to the next font

`iter` : | a PopplerFontsIter
Returns : | `TRUE`, if `iter` was set to the next font

### poppler_layers_iter_new ()

    PopplerLayersIter * poppler_layers_iter_new             (PopplerDocument *document);

`document` : | a PopplerDocument

Since 0.12

### poppler_layers_iter_copy ()

    PopplerLayersIter * poppler_layers_iter_copy            (PopplerLayersIter *iter);

Creates a new PopplerLayersIter as a copy of `iter`. This must be freed with `poppler_layers_iter_free()`.

`iter` : | a PopplerLayersIter
Returns : | a new PopplerLayersIter Since 0.12

### poppler_layers_iter_free ()

    void                poppler_layers_iter_free            (PopplerLayersIter *iter);

Frees `iter`.

`iter` : | a PopplerLayersIter

Since 0.12

### poppler_layers_iter_get_child ()

    PopplerLayersIter * poppler_layers_iter_get_child       (PopplerLayersIter *parent);

Returns a newly created child of `parent`, or `NULL` if the iter has no child. See `poppler_layers_iter_new()` for more information on this function.

`parent` : | a PopplerLayersIter
Returns : | a new PopplerLayersIter, or `NULL`

Since 0.12

### poppler_layers_iter_get_layer ()

    PopplerLayer *      poppler_layers_iter_get_layer       (PopplerLayersIter *iter);

Returns the PopplerLayer associated with `iter`.

`iter` : | a PopplerLayersIter
Returns : | a new PopplerLayer, or `NULL` if there isn't any layer associated with `iter`. [transfer full]

Since 0.12

### poppler_layers_iter_get_title ()

    gchar *             poppler_layers_iter_get_title       (PopplerLayersIter *iter);

Returns the title associated with `iter`. It must be freed with `g_free()`.

`iter` : | a PopplerLayersIter
Returns : | a new string containing the `iter`'s title or `NULL` if `iter` doesn't have a title. The returned string should be freed with `g_free()` when no longer needed.

Since 0.12

### poppler_layers_iter_next ()

    gboolean            poppler_layers_iter_next            (PopplerLayersIter *iter);

Sets `iter` to point to the next action at the current level, if valid. See `poppler_layers_iter_new()` for more information.

`iter` : | a PopplerLayersIter
Returns : | `TRUE`, if `iter` was set to the next action

Since 0.12

### poppler_ps_file_new ()

    PopplerPSFile *     poppler_ps_file_new                 (PopplerDocument *document,
                                                             const char *filename,
                                                             int first_page,
                                                             int n_pages);

Create a new postscript file to render to

`document` : | a PopplerDocument
`filename` : | the path of the output filename
`first_page` : | the first page to print
`n_pages` : | the number of pages to print
Returns : | a PopplerPSFile

### poppler_ps_file_free ()

    void                poppler_ps_file_free                (PopplerPSFile *ps_file);

Frees `ps_file`

`ps_file` : | a PopplerPSFile

### poppler_ps_file_set_paper_size ()

    void                poppler_ps_file_set_paper_size      (PopplerPSFile *ps_file,
                                                             double width,
                                                             double height);

Set the output paper size. These values will end up in the DocumentMedia, the BoundingBox DSC comments and other places in the generated PostScript.

`ps_file` : | a PopplerPSFile which was not yet printed to.
`width` : | the paper width in 1/72 inch
`height` : | the paper height in 1/72 inch

### poppler_ps_file_set_duplex ()

    void                poppler_ps_file_set_duplex          (PopplerPSFile *ps_file,
                                                             gboolean duplex);

Enable or disable Duplex printing.

`ps_file` : | a PopplerPSFile which was not yet printed to
`duplex` : | whether to force duplex printing (on printers which support this)

## Property Details

### The `"author"` property

      "author"                   gchar*                : Read

The author of the document

Default value: NULL

### The `"creation-date"` property

      "creation-date"            gint                  : Read

The date the document was created as seconds since the Epoch, or -1

Allowed values: >= -1

Default value: -1

### The `"creator"` property

      "creator"                  gchar*                : Read

The creator of the document. See also `poppler_document_get_creator()`

Default value: NULL

### The `"format"` property

      "format"                   gchar*                : Read

The PDF version as string. See also `poppler_document_get_pdf_version_string()`

Default value: NULL

### The `"format-major"` property

      "format-major"             guint                 : Read

The PDF major version number. See also `poppler_document_get_pdf_version()`

Default value: 1

### The `"format-minor"` property

      "format-minor"             guint                 : Read

The PDF minor version number. See also `poppler_document_get_pdf_version()`

Default value: 0

### The `"keywords"` property

      "keywords"                 gchar*                : Read

The keywords associated to the document

Default value: NULL

### The `"linearized"` property

      "linearized"               gboolean              : Read

Whether document is linearized. See also `poppler_document_is_linearized()`

Default value: FALSE

### The `"metadata"` property

      "metadata"                 gchar*                : Read

Document metadata in XML format, or `NULL`

Default value: NULL

### The `"mod-date"` property

      "mod-date"                 gint                  : Read

The date the document was most recently modified as seconds since the Epoch, or -1

Allowed values: >= -1

Default value: -1

### The `"page-layout"` property

      "page-layout"              PopplerPageLayout     : Read

The page layout that should be used when the document is opened

Default value: POPPLER_PAGE_LAYOUT_UNSET

### The `"page-mode"` property

      "page-mode"                PopplerPageMode       : Read

The mode that should be used when the document is opened

Default value: POPPLER_PAGE_MODE_UNSET

### The `"permissions"` property

      "permissions"              PopplerPermissions    : Read

Flags specifying which operations are permitted when the document is opened

Default value: POPPLER_PERMISSIONS_OK_TO_PRINT|POPPLER_PERMISSIONS_OK_TO_MODIFY|POPPLER_PERMISSIONS_OK_TO_COPY|POPPLER_PERMISSIONS_OK_TO_ADD_NOTES|POPPLER_PERMISSIONS_OK_TO_FILL_FORM|POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS|POPPLER_PERMISSIONS_OK_TO_ASSEMBLE|POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION

### The `"producer"` property

      "producer"                 gchar*                : Read

The producer of the document. See also `poppler_document_get_producer()`

Default value: NULL

### The `"subject"` property

      "subject"                  gchar*                : Read

The subject of the document

Default value: NULL

### The `"title"` property

      "title"                    gchar*                : Read

The document's title or `NULL`

Default value: NULL

### The `"viewer-preferences"` property

      "viewer-preferences"       PopplerViewerPreferences  : Read

Viewer Preferences.