Poppler CPP 24.12.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
poppler::page_renderer Class Reference

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

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

Public Types

enum  line_mode_enum {
  line_default ,
  line_solid ,
  line_shape
}
 
enum  render_hint {
  antialiasing = 0x00000001 ,
  text_antialiasing = 0x00000002 ,
  text_hinting = 0x00000004
}
 

Public Member Functions

 page_renderer ()
 
 ~page_renderer ()
 
image::format_enum image_format () const
 
line_mode_enum line_mode () const
 
argb paper_color () const
 
unsigned int render_hints () const
 
image render_page (const page *p, double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, rotation_enum rotate=rotate_0) const
 
void set_image_format (image::format_enum format)
 
void set_line_mode (line_mode_enum mode)
 
void set_paper_color (argb c)
 
void set_render_hint (render_hint hint, bool on=true)
 
void set_render_hints (unsigned int hints)
 

Static Public Member Functions

static bool can_render ()
 

Detailed Description

Simple way to render a page of a PDF document.

Since
0.16

Member Enumeration Documentation

◆ render_hint

A flag of an option taken into account when rendering.

Constructor & Destructor Documentation

◆ page_renderer()

page_renderer::page_renderer ( )

Constructs a new page renderer.

◆ ~page_renderer()

page_renderer::~page_renderer ( )

Destructor.

Member Function Documentation

◆ can_render()

bool page_renderer::can_render ( )
static

Rendering capability test.

page_renderer can render only if a render backend ('Splash') is compiled in Poppler.

Returns
whether page_renderer can render

◆ image_format()

image::format_enum page_renderer::image_format ( ) const

The image format used when rendering.

By default ARGB32 is set.

Returns
the image format
Since
0.65

◆ line_mode()

page_renderer::line_mode_enum page_renderer::line_mode ( ) const

The line mode used when rendering.

By default default mode is set.

Returns
the line mode
Since
0.65

◆ paper_color()

argb page_renderer::paper_color ( ) const

The color used for the "paper" of the pages.

The default color is opaque solid white (0xffffffff).

Returns
the paper color

◆ render_hints()

unsigned int page_renderer::render_hints ( ) const

The hints used when rendering.

By default no hint is set.

Returns
the render hints set

◆ render_page()

image page_renderer::render_page ( const page p,
double  xres = 72.0,
double  yres = 72.0,
int  x = -1,
int  y = -1,
int  w = -1,
int  h = -1,
rotation_enum  rotate = rotate_0 
) const

Render the specified page.

This functions renders the specified page on an image following the specified parameters, returning it.

Parameters
pthe page to render
xresthe X resolution, in dot per inch (DPI)
yresthe Y resolution, in dot per inch (DPI)
xthe X top-right coordinate, in pixels
ythe Y top-right coordinate, in pixels
wthe width in pixels of the area to render
hthe height in pixels of the area to render
rotatethe rotation to apply when rendering the page
Returns
the rendered image, or a null one in case of errors
See also
can_render

◆ set_image_format()

void page_renderer::set_image_format ( image::format_enum  format)

Set new image format used when rendering.

Parameters
formatthe new image format
Since
0.65

◆ set_line_mode()

void page_renderer::set_line_mode ( page_renderer::line_mode_enum  mode)

Set new line mode used when rendering.

Parameters
modethe new line mode
Since
0.65

◆ set_paper_color()

void page_renderer::set_paper_color ( argb  c)

Set a new color for the "paper".

Parameters
cthe new color

◆ set_render_hint()

void page_renderer::set_render_hint ( page_renderer::render_hint  hint,
bool  on = true 
)

Enable or disable a single render hint.

Parameters
hintthe hint to modify
onwhether enable it or not

◆ set_render_hints()

void page_renderer::set_render_hints ( unsigned int  hints)

Set new render hints at once.

Parameters
hintsthe new set of render hints