![]() |
![]() |
![]() |
Poppler Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum PopplerPageLayout; enum PopplerPageMode; enum PopplerFontType; 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); gboolean poppler_document_save (PopplerDocument *document, const char *uri, GError **error); 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); gboolean poppler_document_has_attachments (PopplerDocument *document); GList * poppler_document_get_attachments (PopplerDocument *document); PopplerFormField * poppler_document_get_form_field (PopplerDocument *document, gint id); GType poppler_index_iter_get_type (void); 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); GType poppler_fonts_iter_get_type (void); 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); gboolean poppler_fonts_iter_is_embedded (PopplerFontsIter *iter); gboolean poppler_fonts_iter_is_subset (PopplerFontsIter *iter); gboolean poppler_fonts_iter_next (PopplerFontsIter *iter); PopplerPSFile * poppler_ps_file_new (PopplerDocument *document, const char *filename, int first_page, int n_pages); 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); void poppler_ps_file_free (PopplerPSFile *ps_file);
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;
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;
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;
typedef enum /*< flags >*/ { 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;
typedef enum /*< flags >*/ { 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_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) } PopplerPermissions;
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 of the file to load |
|
password to unlock the file with, or NULL
|
|
Return location for an error, or NULL
|
Returns : |
A newly created PopplerDocument, or NULL
|
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.
|
the pdf data contained in a char array |
|
the length of data |
|
password to unlock the file with, or NULL
|
|
Return location for an error, or NULL
|
Returns : |
A newly created PopplerDocument, or NULL
|
gboolean poppler_document_save (PopplerDocument *document, const char *uri, GError **error);
Saves document
. Any change made in the document such as
form fields filled by the user will be saved.
If error
is set, FALSE
will be returned. Possible errors
include those in the G_FILE_ERROR domain.
|
a PopplerDocument |
|
uri of file to save |
|
return location for an error, or NULL
|
Returns : |
TRUE , if the document was successfully saved
|
int poppler_document_get_n_pages (PopplerDocument *document);
Returns the number of pages in a loaded document.
|
A PopplerDocument |
Returns : |
Number of pages |
PopplerPage * poppler_document_get_page (PopplerDocument *document, int index);
Returns the PopplerPage indexed at index
. This object is owned by the
caller.
PopplerPages are indexed starting at 0.
|
A PopplerDocument |
|
a page index |
Returns : |
The PopplerPage at index
|
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.
|
A PopplerDocument |
|
a page label |
Returns : |
The PopplerPage referenced by label
|
PopplerDest * poppler_document_find_dest (PopplerDocument *document, const gchar *link_name);
Finds named destination link_name
in document
|
A PopplerDocument |
|
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
|
gboolean poppler_document_has_attachments (PopplerDocument *document);
Returns TRUE
of document
has any attachments.
|
A PopplerDocument |
Returns : |
TRUE , if document has 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()
.
|
A PopplerDocument |
Returns : |
a list of available attachments. |
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()
|
a PopplerDocument |
|
an id of a PopplerFormField |
Returns : |
a new PopplerFormField or NULL if not found |
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); }
|
a PopplerDocument |
Returns : |
a new PopplerIndexIter |
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()
.
|
a PopplerIndexIter |
Returns : |
a new PopplerIndexIter |
void poppler_index_iter_free (PopplerIndexIter *iter);
Frees iter
.
|
a PopplerIndexIter |
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.
|
a PopplerIndexIter |
Returns : |
a new PopplerIndexIter |
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.
|
a PopplerIndexIter |
Returns : |
TRUE , if the document wants iter to be expanded
|
PopplerAction * poppler_index_iter_get_action (PopplerIndexIter *iter);
Returns the PopplerAction associated with iter
. It must be freed with
poppler_action_free()
.
|
a PopplerIndexIter |
Returns : |
a new PopplerAction |
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.
|
a PopplerIndexIter |
Returns : |
TRUE , if iter was set to the next action
|
PopplerFontInfo * poppler_font_info_new (PopplerDocument *document);
|
|
Returns : |
gboolean poppler_font_info_scan (PopplerFontInfo *font_info, int n_pages, PopplerFontsIter **iter);
|
|
|
|
|
|
Returns : |
PopplerFontsIter * poppler_fonts_iter_copy (PopplerFontsIter *iter);
|
|
Returns : |
const char * poppler_fonts_iter_get_name (PopplerFontsIter *iter);
|
|
Returns : |
const char * poppler_fonts_iter_get_full_name (PopplerFontsIter *iter);
|
|
Returns : |
PopplerFontType poppler_fonts_iter_get_font_type (PopplerFontsIter *iter);
|
|
Returns : |
gboolean poppler_fonts_iter_is_embedded (PopplerFontsIter *iter);
|
|
Returns : |
gboolean poppler_fonts_iter_is_subset (PopplerFontsIter *iter);
|
|
Returns : |
gboolean poppler_fonts_iter_next (PopplerFontsIter *iter);
|
|
Returns : |
PopplerPSFile * poppler_ps_file_new (PopplerDocument *document, const char *filename, int first_page, int n_pages);
Create a new postscript file to render to
|
a PopplerDocument |
|
the path of the output filename |
|
the first page to print |
|
the number of pages to print |
Returns : |
a PopplerPSFile |
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.
|
a PopplerPSFile which was not yet printed to. |
|
the paper width in 1/72 inch |
|
the paper height in 1/72 inch |
void poppler_ps_file_set_duplex (PopplerPSFile *ps_file, gboolean duplex);
Enable or disable Duplex printing.
|
a PopplerPSFile which was not yet printed to |
|
whether to force duplex printing (on printers which support this) |
void poppler_ps_file_free (PopplerPSFile *ps_file);
Frees ps_file
|
a PopplerPSFile |