Poppler Qt6 24.09.0
|
#include <poppler-qt6.h>
Public Types | |
enum | Orientation { Landscape , Portrait , Seascape , UpsideDown } |
enum | PageAction { Opening , Closing } |
enum | PainterFlag { NoPainterFlags = 0x00000000 , DontSaveAndRestore = 0x00000001 } |
using | RenderToImagePartialUpdateFunc = void(*)(const QImage &, const QVariant &) |
enum | Rotation { Rotate0 = 0 , Rotate90 = 1 , Rotate180 = 2 , Rotate270 = 3 } |
enum | SearchDirection { FromTop , NextResult , PreviousResult } |
enum | SearchFlag { NoSearchFlags = 0x00000000 , IgnoreCase = 0x00000001 , WholeWords = 0x00000002 , IgnoreDiacritics = 0x00000004 , AcrossLines = 0x00000008 } |
enum | SearchMode { CaseSensitive , CaseInsensitive } |
using | ShouldAbortQueryFunc = bool(*)(const QVariant &) |
using | ShouldRenderToImagePartialQueryFunc = bool(*)(const QVariant &) |
enum | TextLayout { PhysicalLayout , RawOrderLayout } |
Public Member Functions | |
std::unique_ptr< Link > | action (PageAction act) const |
void | addAnnotation (const Annotation *ann) |
std::vector< std::unique_ptr< Annotation > > | annotations () const |
std::vector< std::unique_ptr< Annotation > > | annotations (const QSet< Annotation::SubType > &subtypes) const |
void | defaultCTM (double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown) |
double | duration () const |
std::vector< std::unique_ptr< FormField > > | formFields () const |
int | index () const |
QString | label () const |
std::vector< std::unique_ptr< Link > > | links () const |
Orientation | orientation () const |
QSize | pageSize () const |
QSizeF | pageSizeF () const |
void | removeAnnotation (const Annotation *ann) |
QImage | renderToImage (double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback, const QVariant &payload) const |
QImage | renderToImage (double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback, ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const |
QImage | renderToImage (double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate=Rotate0) const |
bool | renderToPainter (QPainter *painter, double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate=Rotate0, PainterFlags flags=NoPainterFlags) const |
bool | search (const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags=NoSearchFlags, Rotation rotate=Rotate0) const |
QList< QRectF > | search (const QString &text, SearchFlags flags=NoSearchFlags, Rotation rotate=Rotate0) const |
QString | text (const QRectF &rect) const |
QString | text (const QRectF &rect, TextLayout textLayout) const |
std::vector< std::unique_ptr< TextBox > > | textList (Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const |
std::vector< std::unique_ptr< TextBox > > | textList (Rotation rotate=Rotate0) const |
QImage | thumbnail () const |
PageTransition * | transition () const |
~Page () | |
A page in a document.
The Page class represents a single page within a PDF document.
You cannot construct a Page directly, but you have to use the Document functions that return a new Page out of an index or a label.
using Poppler::Page::RenderToImagePartialUpdateFunc = void (*)(const QImage & , const QVariant & ) |
Partial Update renderToImage callback.
This function type is used for doing partial rendering updates; the first parameter is the image as rendered up to now, the second is the unaltered closure argument which was passed to the renderToImage call.
using Poppler::Page::ShouldAbortQueryFunc = bool (*)(const QVariant & ) |
Abort query function callback.
This function type is used for query if the current rendering/text extraction should be cancelled.
using Poppler::Page::ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & ) |
Partial Update query renderToImage callback.
This function type is used for query if the partial rendering update should happen; the parameter is the unaltered closure argument which was passed to the renderToImage call.
Types of orientations that are possible.
Additional flags for the renderToPainter method.
Enumerator | |
---|---|
DontSaveAndRestore | Do not save/restore the caller-owned painter. renderToPainter() by default preserves, using save() + restore(), the state of the painter specified; if this is not needed, this flag can avoid this job |
Flags to modify the search behaviour.
void Poppler::Page::addAnnotation | ( | const Annotation * | ann | ) |
Adds an annotation to the page.
std::vector< std::unique_ptr< Annotation > > Poppler::Page::annotations | ( | ) | const |
Returns the annotations of the page.
std::vector< std::unique_ptr< Annotation > > Poppler::Page::annotations | ( | const QSet< Annotation::SubType > & | subtypes | ) | const |
Returns the annotations of the page.
subtypes | the subtypes of annotations you are interested in |
double Poppler::Page::duration | ( | ) | const |
Returns the page duration.
That is the time, in seconds, that the page should be displayed before the presentation automatically advances to the next page. Returns < 0 if duration is not set.
QSize Poppler::Page::pageSize | ( | ) | const |
QSizeF Poppler::Page::pageSizeF | ( | ) | const |
void Poppler::Page::removeAnnotation | ( | const Annotation * | ann | ) |
Removes an annotation from the page and destroys the annotation object.
QImage Poppler::Page::renderToImage | ( | double | xres, |
double | yres, | ||
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
Rotation | rotate, | ||
RenderToImagePartialUpdateFunc | partialUpdateCallback, | ||
ShouldRenderToImagePartialQueryFunc | shouldDoPartialUpdateCallback, | ||
const QVariant & | payload | ||
) | const |
Render the page to a QImage using the current Document renderer.
If x
= y
= w
= h
= -1, the method will automatically compute the size of the image from the horizontal and vertical resolutions specified in xres
and yres
. Otherwise, the method renders only a part of the page, specified by the parameters (x
, y
, w
, h
) in pixel coordinates. The returned QImage then has size (w
, h
), independent of the page size.
x | specifies the left x-coordinate of the box, in pixels. |
y | specifies the top y-coordinate of the box, in pixels. |
w | specifies the width of the box, in pixels. |
h | specifies the height of the box, in pixels. |
xres | horizontal resolution of the graphics device, in dots per inch |
yres | vertical resolution of the graphics device, in dots per inch |
rotate | how to rotate the page |
partialUpdateCallback | callback that will be called to report a partial rendering update |
shouldDoPartialUpdateCallback | callback that will be called to ask if a partial rendering update is wanted. This exists because doing a partial rendering update needs to copy the image buffer so if it is not wanted it is better skipped early. |
payload | opaque structure that will be passed back to partialUpdateCallback and shouldDoPartialUpdateCallback. |
x
, y
, w
, h
) are not well-tested. Unusual or meaningless parameters may lead to rather unexpected results.QImage Poppler::Page::renderToImage | ( | double | xres, |
double | yres, | ||
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
Rotation | rotate, | ||
RenderToImagePartialUpdateFunc | partialUpdateCallback, | ||
ShouldRenderToImagePartialQueryFunc | shouldDoPartialUpdateCallback, | ||
ShouldAbortQueryFunc | shouldAbortRenderCallback, | ||
const QVariant & | payload | ||
) | const |
Render the page to a QImage using the current Document renderer.
If x
= y
= w
= h
= -1, the method will automatically compute the size of the image from the horizontal and vertical resolutions specified in xres
and yres
. Otherwise, the method renders only a part of the page, specified by the parameters (x
, y
, w
, h
) in pixel coordinates. The returned QImage then has size (w
, h
), independent of the page size.
x | specifies the left x-coordinate of the box, in pixels. |
y | specifies the top y-coordinate of the box, in pixels. |
w | specifies the width of the box, in pixels. |
h | specifies the height of the box, in pixels. |
xres | horizontal resolution of the graphics device, in dots per inch |
yres | vertical resolution of the graphics device, in dots per inch |
rotate | how to rotate the page |
partialUpdateCallback | callback that will be called to report a partial rendering update |
shouldDoPartialUpdateCallback | callback that will be called to ask if a partial rendering update is wanted. This exists because doing a partial rendering update needs to copy the image buffer so if it is not wanted it is better skipped early. |
shouldAbortRenderCallback | callback that will be called to ask if the rendering should be cancelled. |
payload | opaque structure that will be passed back to partialUpdateCallback, shouldDoPartialUpdateCallback and shouldAbortRenderCallback. |
x
, y
, w
, h
) are not well-tested. Unusual or meaningless parameters may lead to rather unexpected results.QImage Poppler::Page::renderToImage | ( | double | xres = 72.0 , |
double | yres = 72.0 , |
||
int | x = -1 , |
||
int | y = -1 , |
||
int | w = -1 , |
||
int | h = -1 , |
||
Rotation | rotate = Rotate0 |
||
) | const |
Render the page to a QImage using the current Document renderer.
If x
= y
= w
= h
= -1, the method will automatically compute the size of the image from the horizontal and vertical resolutions specified in xres
and yres
. Otherwise, the method renders only a part of the page, specified by the parameters (x
, y
, w
, h
) in pixel coordinates. The returned QImage then has size (w
, h
), independent of the page size.
x | specifies the left x-coordinate of the box, in pixels. |
y | specifies the top y-coordinate of the box, in pixels. |
w | specifies the width of the box, in pixels. |
h | specifies the height of the box, in pixels. |
xres | horizontal resolution of the graphics device, in dots per inch |
yres | vertical resolution of the graphics device, in dots per inch |
rotate | how to rotate the page |
x
, y
, w
, h
) are not well-tested. Unusual or meaningless parameters may lead to rather unexpected results.bool Poppler::Page::renderToPainter | ( | QPainter * | painter, |
double | xres = 72.0 , |
||
double | yres = 72.0 , |
||
int | x = -1 , |
||
int | y = -1 , |
||
int | w = -1 , |
||
int | h = -1 , |
||
Rotation | rotate = Rotate0 , |
||
PainterFlags | flags = NoPainterFlags |
||
) | const |
Render the page to the specified QPainter using the current Document renderer.
If x
= y
= w
= h
= -1, the method will automatically compute the size of the page area from the horizontal and vertical resolutions specified in xres
and yres
. Otherwise, the method renders only a part of the page, specified by the parameters (x
, y
, w
, h
) in pixel coordinates.
painter | the painter to paint on |
x | specifies the left x-coordinate of the box, in pixels. |
y | specifies the top y-coordinate of the box, in pixels. |
w | specifies the width of the box, in pixels. |
h | specifies the height of the box, in pixels. |
xres | horizontal resolution of the graphics device, in dots per inch |
yres | vertical resolution of the graphics device, in dots per inch |
rotate | how to rotate the page |
flags | additional painter flags |
x
, y
, w
, h
) are not well-tested. Unusual or meaningless parameters may lead to rather unexpected results.bool Poppler::Page::search | ( | const QString & | text, |
double & | sLeft, | ||
double & | sTop, | ||
double & | sRight, | ||
double & | sBottom, | ||
SearchDirection | direction, | ||
SearchFlags | flags = NoSearchFlags , |
||
Rotation | rotate = Rotate0 |
||
) | const |
Returns true if the specified text was found.
text | the text the search |
rectXXX | in all directions is used to return where the text was found, for NextResult and PreviousResult indicates where to continue searching for |
direction | in which direction do the search |
flags | the flags to consider during matching |
rotate | the rotation to apply for the search order |
QList< QRectF > Poppler::Page::search | ( | const QString & | text, |
SearchFlags | flags = NoSearchFlags , |
||
Rotation | rotate = Rotate0 |
||
) | const |
Returns a list of all occurrences of the specified text on the page.
if SearchFlags::AcrossLines is given in
flags,then | rects may just be parts of the text itself if it's split between multiple lines. |
text | the text to search |
flags | the flags to consider during matching |
rotate | the rotation to apply for the search order |
QString Poppler::Page::text | ( | const QRectF & | rect | ) | const |
Returns the text that is inside a specified rectangle.
The text is returned using the physical layout of the page
rect | the rectangle specifying the area of interest, with coordinates given in points, i.e., 1/72th of an inch. If rect is null, all text on the page is given |
QString Poppler::Page::text | ( | const QRectF & | rect, |
TextLayout | textLayout | ||
) | const |
Returns the text that is inside a specified rectangle.
rect | the rectangle specifying the area of interest, with coordinates given in points, i.e., 1/72th of an inch. If rect is null, all text on the page is given |
std::vector< std::unique_ptr< TextBox > > Poppler::Page::textList | ( | Rotation | rotate, |
ShouldAbortQueryFunc | shouldAbortExtractionCallback, | ||
const QVariant & | closure | ||
) | const |
Returns a list of text of the page.
This method returns a QList of TextBoxes that contain all the text of the page, with roughly one text word of text per TextBox item.
For text written in western languages (left-to-right and up-to-down), the QList contains the text in the proper order.
shouldAbortExtractionCallback | callback that will be called to ask if the text extraction should be cancelled. |
closure | opaque structure that will be passed back to shouldAbortExtractionCallback. |
std::vector< std::unique_ptr< TextBox > > Poppler::Page::textList | ( | Rotation | rotate = Rotate0 | ) | const |
Returns a list of text of the page.
This method returns a QList of TextBoxes that contain all the text of the page, with roughly one text word of text per TextBox item.
For text written in western languages (left-to-right and up-to-down), the QList contains the text in the proper order.
QImage Poppler::Page::thumbnail | ( | ) | const |
Get the page thumbnail if it exists.
PageTransition * Poppler::Page::transition | ( | ) | const |
Returns the transition of this page.