Poppler CPP 24.11.0
Public Types | Public Member Functions | List of all members
poppler::page Class Reference

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

Inheritance diagram for poppler::page:
Inheritance graph
[legend]

Public Types

enum  orientation_enum {
  landscape ,
  portrait ,
  seascape ,
  upside_down
}
 
enum  search_direction_enum {
  search_from_top ,
  search_next_result ,
  search_previous_result
}
 
enum  text_layout_enum {
  physical_layout ,
  raw_order_layout ,
  non_raw_non_physical_layout
}
 
enum  text_list_option_enum { text_list_include_font = 1 }
 

Public Member Functions

 ~page ()
 
double duration () const
 
ustring label () const
 
orientation_enum orientation () const
 
rectf page_rect (page_box_enum box=crop_box) const
 
bool search (const ustring &text, rectf &r, search_direction_enum direction, case_sensitivity_enum case_sensitivity, rotation_enum rotation=rotate_0) const
 
ustring text (const rectf &r, text_layout_enum layout_mode) const
 
ustring text (const rectf &r=rectf()) const
 
std::vector< text_boxtext_list () const
 
std::vector< text_boxtext_list (int opt_flag) const
 
page_transitiontransition () const
 

Detailed Description

A page in a PDF document.

Member Enumeration Documentation

◆ orientation_enum

The possible orientation of a page.

◆ search_direction_enum

The direction/action to follow when performing a text search.

◆ text_layout_enum

A layout of the text of a page.

Enumerator
non_raw_non_physical_layout 
Since
0.88

Constructor & Destructor Documentation

◆ ~page()

page::~page ( )

Destructor.

Member Function Documentation

◆ duration()

double page::duration ( ) const

The eventual duration the page can be hinted to be shown in a presentation.

If this value is positive (usually different than -1) then a PDF viewer, when showing the page in a presentation, should show the page for at most for this number of seconds, and then switch to the next page (if any). Note this is purely a presentation attribute, it has no influence on the behaviour.

Returns
the duration time (in seconds) of the page

◆ label()

ustring page::label ( ) const
Returns
the label of the page, if any

◆ orientation()

page::orientation_enum page::orientation ( ) const
Returns
the orientation of the page

◆ page_rect()

rectf page::page_rect ( page_box_enum  box = crop_box) const

Returns the size of one rect of the page.

Returns
the size of the specified page rect

◆ search()

bool page::search ( const ustring text,
rectf r,
search_direction_enum  direction,
case_sensitivity_enum  case_sensitivity,
rotation_enum  rotation = rotate_0 
) const

Search the page for some text.

Parameters
textthe text to search
[in,out]rthe area where to start search, which will be set to the area of the match (if any)
directionin which direction search for text
case_sensitivitywhether search in a case sensitive way
rotationthe rotation assumed for the page

◆ text() [1/2]

ustring page::text ( const rectf r,
text_layout_enum  layout_mode 
) const

Returns the text in the page.

Parameters
rectif not empty, it will be extracted the text in it; otherwise, the text of the whole page
layout_modethe layout of the text
Returns
the text of the page in the specified rect or in the whole page
Since
0.16

◆ text() [2/2]

ustring page::text ( const rectf r = rectf()) const

Returns the text in the page, in its physical layout.

Parameters
rif not empty, it will be extracted the text in it; otherwise, the text of the whole page
Returns
the text of the page in the specified rect or in the whole page

◆ text_list() [1/2]

std::vector< text_box > page::text_list ( ) const

Returns a list of text of the page.

This method returns a std::vector of text_box that contain all the text of the page, with roughly one text word of text per text_box item.

For text written in western languages (left-to-right and up-to-down), the std::vector contains the text in the proper order.

Since
0.63
Note
The page object owns the text_box objects as unique_ptr, the caller is not needed to free them.
Warning
This method is not tested with Asian scripts

◆ text_list() [2/2]

std::vector< text_box > page::text_list ( int  opt_flag) const

Extended version of text_list() taking an option flag.

The option flag should be the multiple of text_list_option_enum.

Since
0.89

◆ transition()

page_transition * page::transition ( ) const

The transition from this page to the next one.

If it is set, then a PDF viewer in a presentation should perform the specified transition effect when switching from this page to the next one.

Returns
the transition effect for the switch to the next page, if any