Top |
gchar * | author | Read |
gint | creation-date | Read |
gchar * | creator | Read |
gchar * | format | Read |
guint | format-major | Read |
guint | format-minor | Read |
gchar * | keywords | Read |
gboolean | linearized | Read |
gchar * | metadata | Read |
gint | mod-date | Read |
PopplerPageLayout | page-layout | Read |
PopplerPageMode | page-mode | Read |
PopplerPermissions | permissions | Read |
gchar * | producer | Read |
gchar * | subject | Read |
gchar * | title | Read |
PopplerViewerPreferences | viewer-preferences | Read |
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.
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.
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 |
[allow-none] |
cancellable |
a GCancellable, or |
[allow-none] |
error |
Return location for an error, or |
[allow-none] |
Since: 0.22
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 |
[allow-none] |
cancellable |
a GCancellable, or |
[allow-none] |
error |
Return location for an error, or |
[allow-none] |
Since: 0.22
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 |
||
uri |
uri of file to save |
|
error |
return location for an error, or |
[allow-none] |
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 |
||
uri |
uri of file to save |
|
error |
return location for an error, or |
[allow-none] |
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.
Since: 0.16
gchar *
poppler_document_get_pdf_version_string
(PopplerDocument *document
);
Returns the PDF version of document
as a string (e.g. PDF-1.6)
Since: 0.16
void poppler_document_get_pdf_version (PopplerDocument *document
,guint *major_version
,guint *minor_version
);
document |
||
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] |
Since: 0.16
gchar *
poppler_document_get_title (PopplerDocument *document
);
Returns the document's title
Since: 0.16
gchar *
poppler_document_get_author (PopplerDocument *document
);
Returns the author of the document
Since: 0.16
gchar *
poppler_document_get_subject (PopplerDocument *document
);
Returns the subject of the document
Since: 0.16
gchar *
poppler_document_get_keywords (PopplerDocument *document
);
Returns the keywords associated to the document
Since: 0.16
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.
Since: 0.16
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
Since: 0.16
time_t
poppler_document_get_creation_date (PopplerDocument *document
);
Returns the date the document was created as seconds since the Epoch
Since: 0.16
time_t
poppler_document_get_modification_date
(PopplerDocument *document
);
Returns the date the document was most recently modified as seconds since the Epoch
Since: 0.16
PopplerPageLayout
poppler_document_get_page_layout (PopplerDocument *document
);
Returns the page layout that should be used when the document is opened
Since: 0.16
PopplerPageMode
poppler_document_get_page_mode (PopplerDocument *document
);
Returns a PopplerPageMode representing how the document should be initially displayed when opened.
Since: 0.16
PopplerPermissions
poppler_document_get_permissions (PopplerDocument *document
);
Returns the flags specifying which operations are permitted when the document is opened.
Since: 0.16
gchar *
poppler_document_get_metadata (PopplerDocument *document
);
Returns the XML metadata string of the document
Since: 0.16
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.
Since: 0.16
int
poppler_document_get_n_pages (PopplerDocument *document
);
Returns the number of pages in a loaded document.
PopplerPage * poppler_document_get_page (PopplerDocument *document
,int index
);
Returns the PopplerPage indexed at index
. This object is owned by the
caller.
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.
PopplerDest * poppler_document_find_dest (PopplerDocument *document
,const gchar *link_name
);
Finds named destination link_name
in document
The PopplerDest destination or NULL
if
link_name
is not a destination. Returned value must
be freed with poppler_dest_free
guint
poppler_document_get_n_attachments (PopplerDocument *document
);
Returns the number of attachments in a loaded document.
See also poppler_document_get_attachments()
Since: 0.18
gboolean
poppler_document_has_attachments (PopplerDocument *document
);
Returns TRUE
of document
has any 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()
.
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()
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); }
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()
.
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.
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.
PopplerAction *
poppler_index_iter_get_action (PopplerIndexIter *iter
);
Returns the PopplerAction associated with iter
. It must be freed with
poppler_action_free()
.
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.
PopplerFontInfo *
poppler_font_info_new (PopplerDocument *document
);
Creates a new PopplerFontInfo object
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 |
||
n_pages |
number of pages to scan |
|
iter |
return location for a PopplerFontsIter. |
[out] |
PopplerFontsIter *
poppler_fonts_iter_copy (PopplerFontsIter *iter
);
Creates a copy of iter
void
poppler_fonts_iter_free (PopplerFontsIter *iter
);
Frees the given PopplerFontsIter
const char *
poppler_fonts_iter_get_name (PopplerFontsIter *iter
);
Returns the name of the font associated with iter
const char *
poppler_fonts_iter_get_full_name (PopplerFontsIter *iter
);
Returns the full name of the font associated with iter
PopplerFontType
poppler_fonts_iter_get_font_type (PopplerFontsIter *iter
);
Returns the type of the font associated with iter
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
Since: 0.20
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
const char *
poppler_fonts_iter_get_encoding (PopplerFontsIter *iter
);
Returns the encoding of the font associated with iter
Since: 0.20
gboolean
poppler_fonts_iter_is_embedded (PopplerFontsIter *iter
);
Returns whether the font associated with iter
is embedded in the document
gboolean
poppler_fonts_iter_is_subset (PopplerFontsIter *iter
);
Returns whether the font associated with iter
is a subset of another font
gboolean
poppler_fonts_iter_next (PopplerFontsIter *iter
);
Sets iter
to point to the next font
PopplerLayersIter *
poppler_layers_iter_new (PopplerDocument *document
);
Since: 0.12
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()
.
void
poppler_layers_iter_free (PopplerLayersIter *iter
);
Frees iter
.
Since: 0.12
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.
Since: 0.12
PopplerLayer *
poppler_layers_iter_get_layer (PopplerLayersIter *iter
);
Returns the PopplerLayer associated with iter
.
Since: 0.12
gchar *
poppler_layers_iter_get_title (PopplerLayersIter *iter
);
Returns the title associated with iter
. It must be freed with
g_free()
.
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
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.
Since: 0.12
PopplerPSFile * poppler_ps_file_new (PopplerDocument *document
,const char *filename
,int first_page
,int n_pages
);
Create a new postscript file to render to
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.
void poppler_ps_file_set_duplex (PopplerPSFile *ps_file
,gboolean duplex
);
Enable or disable Duplex printing.
Page layout types
Page modes
Font types
unknown font type |
||
Type 1 font type |
||
Type 1 font type embedded in Compact Font Format (CFF) font program |
||
Type 1 font type embedded in OpenType font program |
||
A font type that is defined with PDF graphics operators |
||
TrueType font type |
||
TrueType font type embedded in OpenType font program |
||
CIDFont type based on Type 1 font technology |
||
CIDFont type based on Type 1 font technology embedded in CFF font program |
||
CIDFont type based on Type 1 font technology embedded in OpenType font program |
||
CIDFont type based on TrueType font technology |
||
CIDFont type based on TrueType font technology embedded in OpenType font program |
Viewer preferences
no preferences set |
||
hider toolbars when document is active |
||
hide menu bar when document is active |
||
hide UI elements in document's window |
||
resize document's window to fit the size of the first displayed page |
||
position the document's window in the center of the screen |
||
display document title in window's title bar |
||
the predominant reading order for text is right to left |
Permissions
document can be printer |
||
document contents can be modified |
||
document can be copied |
||
annotations can added to the document |
||
interactive form fields can be filled in |
||
extract text and graphics (in support of accessibility to users with disabilities or for other purposes). Since 0.18 |
||
assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images). Since 0.18 |
||
document can be printer at high resolution. Since 0.18 |
||
document permits all operations |
“creation-date”
property“creation-date” gint
The date the document was created as seconds since the Epoch, or -1
Flags: Read
Allowed values: >= -1
Default value: -1
“creator”
property“creator” gchar *
The creator of the document. See also poppler_document_get_creator()
Flags: Read
Default value: NULL
“format”
property“format” gchar *
The PDF version as string. See also poppler_document_get_pdf_version_string()
Flags: Read
Default value: NULL
“format-major”
property“format-major” guint
The PDF major version number. See also poppler_document_get_pdf_version()
Flags: Read
Default value: 1
“format-minor”
property“format-minor” guint
The PDF minor version number. See also poppler_document_get_pdf_version()
Flags: Read
Default value: 0
“keywords”
property“keywords” gchar *
The keywords associated to the document
Flags: Read
Default value: NULL
“linearized”
property“linearized” gboolean
Whether document is linearized. See also poppler_document_is_linearized()
Flags: Read
Default value: FALSE
“metadata”
property“metadata” gchar *
Document metadata in XML format, or NULL
Flags: Read
Default value: NULL
“mod-date”
property“mod-date” gint
The date the document was most recently modified as seconds since the Epoch, or -1
Flags: Read
Allowed values: >= -1
Default value: -1
“page-layout”
property“page-layout” PopplerPageLayout
The page layout that should be used when the document is opened
Flags: Read
Default value: POPPLER_PAGE_LAYOUT_UNSET
“page-mode”
property“page-mode” PopplerPageMode
The mode that should be used when the document is opened
Flags: Read
Default value: POPPLER_PAGE_MODE_UNSET
“permissions”
property“permissions” PopplerPermissions
Flags specifying which operations are permitted when the document is opened
Flags: Read
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
“producer”
property“producer” gchar *
The producer of the document. See also poppler_document_get_producer()
Flags: Read
Default value: NULL
“subject”
property“subject” gchar *
The subject of the document
Flags: Read
Default value: NULL
“viewer-preferences”
property“viewer-preferences” PopplerViewerPreferences
Viewer Preferences.
Flags: Read