poppler::document Class Reference

Represents a PDF document. More...

#include "poppler/cpp/poppler-document.h"

Inheritance diagram for poppler::document:
[legend]

List of all members.

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

font_iteratorcreate_font_iterator (int start_page=0) const
pagecreate_page (int index) const
pagecreate_page (const ustring &label) const
toccreate_toc () const
std::vector< embedded_file * > embedded_files () const
std::vector< font_infofonts () const
bool get_pdf_id (std::string *permanent_id, std::string *update_id) const
void get_pdf_version (int *major, int *minor) const
bool has_embedded_files () const
bool has_permission (permission_enum which) const
time_type info_date (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 unlock (const std::string &owner_password, const std::string &user_password)

Static Public Member Functions

static documentload_from_data (byte_array *file_data, const std::string &owner_password=std::string(), const std::string &user_password=std::string())
static documentload_from_file (const std::string &file_name, const std::string &owner_password=std::string(), const std::string &user_password=std::string())
static documentload_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())

Detailed Description

Represents a PDF document.


Member Enumeration Documentation

The various page modes available in a PDF document.

Enumerator:
use_none 

The document specifies no particular page mode.

use_outlines 

The document specifies its TOC (table of contents) should be open.

use_thumbs 

The document specifies that should be open a view of the thumbnails of its pages.

fullscreen 

The document specifies it wants to be open in a fullscreen mode.

use_oc 

The document specifies that should be open a view of its Optional Content (also known as layers).

use_attach 

The document specifies that should be open a view of its document-level attachments.


Member Function Documentation

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).

Returns:
a new font iterator
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.

Note:
the page indexes are in the range [0, pages()[.
Returns:
a new page object or NULL
page * document::create_page ( const ustring label  )  const

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.

Returns:
a new page object or NULL
toc * document::create_toc (  )  const

Reads the TOC (table of contents) of the document.

Returns:
a new toc object if a TOC is available, NULL otherwise
std::vector< embedded_file * > document::embedded_files (  )  const

Reads all the document-level embedded files of the document.

Returns:
the document-level embedded files
std::vector< font_info > document::fonts (  )  const

Reads all the font information of the document.

Note:
this can be slow for big documents; prefer the use of a font_iterator to read incrementally page by page
See also:
create_font_iterator
bool document::get_pdf_id ( std::string *  permanent_id,
std::string *  update_id 
) const

Gets the IDs of the current PDF document, if available.

Parameters:
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
Returns:
whether the document has the IDs
Since:
0.16
void document::get_pdf_version ( int *  major,
int *  minor 
) const

Gets the version of the current PDF document.

Example:

 poppler::document *doc = ...;
 // for example, if the document is PDF 1.6:
 int major = 0, minor = 0;
 doc->get_pdf_version(&major, &minor);
 // major == 1
 // minor == 6
Parameters:
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
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).

Returns:
whether the document has embedded files
bool document::has_permission ( permission_enum  which  )  const

Check for available "document permission".

Returns:
whether the specified permission is allowed
time_type document::info_date ( const std::string &  key  )  const

Gets the time_t value value of the specified key of the document information.

Returns:
the time_t value for the key
See also:
info_keys, info_date
ustring document::info_key ( const std::string &  key  )  const

Gets the value of the specified key of the document information.

Returns:
the value for the key, or an empty string if not available
See also:
info_keys, info_date
std::vector< std::string > document::info_keys (  )  const
Returns:
all the information keys available in the document
See also:
info_key, info_date
bool document::is_encrypted (  )  const
Returns:
whether the document is encrypted
bool document::is_linearized (  )  const
Returns:
whether the document is linearized
bool document::is_locked (  )  const
Returns:
whether the current document is locked
document * document::load_from_data ( byte_array *  file_data,
const std::string &  owner_password = std::string(),
const std::string &  user_password = std::string() 
) [static]

Tries to load a PDF document from the specified data.

Note:
if the loading succeeds, the document takes ownership of the file_data (swap()ing it)
Parameters:
file_data the data representing a document to open
Returns:
a new document if the load succeeded (even if the document is locked), NULL otherwise
document * document::load_from_file ( const std::string &  file_name,
const std::string &  owner_password = std::string(),
const std::string &  user_password = std::string() 
) [static]

Tries to load a PDF document from the specified file.

Parameters:
file_name the file to open
Returns:
a new document if the load succeeded (even if the document is locked), NULL otherwise
document * 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() 
) [static]

Tries to load a PDF document from the specified data buffer.

Note:
the buffer must remain valid for the whole lifetime of the returned document
Parameters:
file_data the data buffer representing a document to open
file_data_length the length of the data buffer
Returns:
a new document if the load succeeded (even if the document is locked), NULL otherwise
Since:
0.16
ustring document::metadata (  )  const

Reads the document metadata string.

Returns:
the document metadata string
document::page_layout_enum document::page_layout (  )  const
Returns:
the eventual page layout specified by the current PDF document
document::page_mode_enum document::page_mode (  )  const
Returns:
the eventual page mode specified by the current PDF document
int document::pages (  )  const

Document page count.

Returns:
the number of pages of the document
bool document::unlock ( const std::string &  owner_password,
const std::string &  user_password 
)

Unlocks the current doocument, if locked.

Returns:
the new locking status of the document

Generated on 27 Dec 2015 for Poppler CPP by  doxygen 1.6.1