Poppler CPP 24.12.0
|
#include "poppler/cpp/poppler-document.h"
Public Types | |
enum | page_layout_enum { no_layout , single_page , one_column , two_column_left , two_column_right , two_page_left , two_page_right } |
enum | page_mode_enum { use_none , use_outlines , use_thumbs , fullscreen , use_oc , use_attach } |
Public Member Functions | |
std::map< std::string, destination > | create_destination_map () const |
font_iterator * | create_font_iterator (int start_page=0) const |
page * | create_page (const ustring &label) const |
page * | create_page (int index) const |
toc * | create_toc () const |
std::vector< embedded_file * > | embedded_files () const |
std::vector< font_info > | fonts () const |
ustring | get_author () const |
time_type | get_creation_date () const |
time_t | get_creation_date_t () const |
ustring | get_creator () const |
ustring | get_keywords () const |
time_type | get_modification_date () const |
time_t | get_modification_date_t () const |
bool | get_pdf_id (std::string *permanent_id, std::string *update_id) const |
void | get_pdf_version (int *major, int *minor) const |
ustring | get_producer () const |
ustring | get_subject () const |
ustring | get_title () const |
bool | has_embedded_files () const |
bool | has_permission (permission_enum which) const |
time_type | info_date (const std::string &key) const |
time_t | info_date_t (const std::string &key) const |
ustring | info_key (const std::string &key) const |
std::vector< std::string > | info_keys () const |
bool | is_encrypted () const |
bool | is_linearized () const |
bool | is_locked () const |
ustring | metadata () const |
page_layout_enum | page_layout () const |
page_mode_enum | page_mode () const |
int | pages () const |
bool | remove_info () |
bool | save (const std::string &file_name) const |
bool | save_a_copy (const std::string &file_name) const |
bool | set_author (const ustring &author) |
bool | set_creation_date (time_type creation_date) |
bool | set_creation_date_t (time_t creation_date) |
bool | set_creator (const ustring &creator) |
bool | set_info_date (const std::string &key, time_type val) |
bool | set_info_date_t (const std::string &key, time_t val) |
bool | set_info_key (const std::string &key, const ustring &val) |
bool | set_keywords (const ustring &keywords) |
bool | set_modification_date (time_type mod_date) |
bool | set_modification_date_t (time_t mod_date) |
bool | set_producer (const ustring &producer) |
bool | set_subject (const ustring &subject) |
bool | set_title (const ustring &title) |
bool | unlock (const std::string &owner_password, const std::string &user_password) |
Static Public Member Functions | |
static document * | load_from_data (byte_array *file_data, const std::string &owner_password=std::string(), const std::string &user_password=std::string()) |
static document * | load_from_file (const std::string &file_name, const std::string &owner_password=std::string(), const std::string &user_password=std::string()) |
static document * | load_from_raw_data (const char *file_data, int file_data_length, const std::string &owner_password=std::string(), const std::string &user_password=std::string()) |
Represents a PDF document.
The various page modes available in a PDF document.
std::map< std::string, destination > document::create_destination_map | ( | ) | const |
Creates a map of all the named destinations in the document.
font_iterator * document::create_font_iterator | ( | int | start_page = 0 | ) | const |
Creates a new font iterator.
This creates a new font iterator for reading the font information of the document page by page, starting at the specified start_page
(0 if not specified).
Document page by label reading.
This creates a new page representing the document page whose label is the specified label
. If there is no page with that label
, NULL is returned.
page * document::create_page | ( | int | index | ) | const |
Document page by index reading.
This creates a new page representing the index
-th page of the document.
toc * document::create_toc | ( | ) | const |
Reads the TOC (table of contents) of the document.
std::vector< embedded_file * > document::embedded_files | ( | ) | const |
Reads all the document-level embedded files of the document.
std::vector< font_info > document::fonts | ( | ) | const |
Reads all the font information of the document.
ustring document::get_author | ( | ) | const |
Gets the document's author.
time_type document::get_creation_date | ( | ) | const |
Gets the document's creation date as a time_type value.
time_t document::get_creation_date_t | ( | ) | const |
Gets the document's creation date as a time_t value.
ustring document::get_creator | ( | ) | const |
Gets the document's creator.
ustring document::get_keywords | ( | ) | const |
Gets the document's keywords.
time_type document::get_modification_date | ( | ) | const |
Gets the document's modification date as a time_type value.
time_t document::get_modification_date_t | ( | ) | const |
Gets the document's modification date as a time_t value.
bool document::get_pdf_id | ( | std::string * | permanent_id, |
std::string * | update_id | ||
) | const |
Gets the IDs of the current PDF document, if available.
permanent_id | if not NULL, will be set to the permanent ID of the document |
update_id | if not NULL, will be set to the update ID of the document |
void document::get_pdf_version | ( | int * | major, |
int * | minor | ||
) | const |
Gets the version of the current PDF document.
Example:
major | if not NULL, will be set to the "major" number of the version |
minor | if not NULL, will be set to the "minor" number of the version |
ustring document::get_producer | ( | ) | const |
Gets the document's producer.
ustring document::get_subject | ( | ) | const |
Gets the document's subject.
ustring document::get_title | ( | ) | const |
bool document::has_embedded_files | ( | ) | const |
Reads whether the current document has document-level embedded files (attachments).
This is a very fast way to know whether there are embedded files (also known as "attachments") at the document-level. Note this does not take into account files embedded in other ways (e.g. to annotations).
bool document::has_permission | ( | permission_enum | which | ) | const |
Check for available "document permission".
time_type document::info_date | ( | const std::string & | key | ) | const |
time_t document::info_date_t | ( | const std::string & | key | ) | const |
ustring document::info_key | ( | const std::string & | key | ) | const |
std::vector< std::string > document::info_keys | ( | ) | const |
bool document::is_encrypted | ( | ) | const |
bool document::is_linearized | ( | ) | const |
bool document::is_locked | ( | ) | const |
|
static |
Tries to load a PDF document from the specified data.
file_data
(swap()ing it)file_data | the data representing a document to open |
|
static |
Tries to load a PDF document from the specified file.
file_name | the file to open |
|
static |
Tries to load a PDF document from the specified data buffer.
file_data | the data buffer representing a document to open |
file_data_length | the length of the data buffer |
ustring document::metadata | ( | ) | const |
Reads the document metadata string.
document::page_layout_enum document::page_layout | ( | ) | const |
document::page_mode_enum document::page_mode | ( | ) | const |
int document::pages | ( | ) | const |
Document page count.
bool document::remove_info | ( | ) |
Removes the document's Info dictionary.
bool document::save | ( | const std::string & | file_name | ) | const |
Saves the document to file file_name
.
bool document::save_a_copy | ( | const std::string & | file_name | ) | const |
Saves the original version of the document to file file_name
.
bool document::set_author | ( | const ustring & | author | ) |
Sets the document's author to author
.
If author
is empty, the document's author is removed.
bool document::set_creation_date | ( | time_type | creation_date | ) |
Sets the document's creation date to creation_date
.
If creation_date
== time_type(-1), the document's creation date is removed.
bool document::set_creation_date_t | ( | time_t | creation_date | ) |
Sets the document's creation date to creation_date
.
If creation_date
== time_t(-1), the document's creation date is removed.
bool document::set_creator | ( | const ustring & | creator | ) |
Sets the document's creator to creator
.
If creator
is empty, the document's creator is removed.
bool document::set_info_date | ( | const std::string & | key, |
time_type | val | ||
) |
Sets the time_type value of the specified key
of the document information to val
.
If val
== time_type(-1), the entry specified by key
is removed.
bool document::set_info_date_t | ( | const std::string & | key, |
time_t | val | ||
) |
Sets the time_t value of the specified key
of the document information to val
.
If val
== time_t(-1), the entry specified by key
is removed.
bool document::set_info_key | ( | const std::string & | key, |
const ustring & | val | ||
) |
Sets the value of the specified key
of the document information to val
.
If val
is empty, the entry specified by key
is removed.
bool document::set_keywords | ( | const ustring & | keywords | ) |
Sets the document's keywords to keywords
.
If keywords
is empty, the document's keywords are removed.
bool document::set_modification_date | ( | time_type | mod_date | ) |
Sets the document's modification date to mod_date
.
If mod_date
== time_type(-1), the document's modification date is removed.
bool document::set_modification_date_t | ( | time_t | mod_date | ) |
Sets the document's modification date to mod_date
.
If mod_date
== time_t(-1), the document's modification date is removed.
bool document::set_producer | ( | const ustring & | producer | ) |
Sets the document's producer to producer
.
If producer
is empty, the document's producer is removed.
bool document::set_subject | ( | const ustring & | subject | ) |
Sets the document's subject to subject
.
If subject
is empty, the document's subject is removed.
bool document::set_title | ( | const ustring & | title | ) |
Sets the document's title to title
.
If title
is empty, the document's title is removed.
bool document::unlock | ( | const std::string & | owner_password, |
const std::string & | user_password | ||
) |
Unlocks the current document, if locked.