PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
PDF::PageText Class Reference

Represents text on a page. More...

#include <pdfsdk/cxx/page_text.h>

Inheritance diagram for PDF::PageText:

Public Member Functions

size_t GetNumChars () const
 Get the number of characters from a page, text segment or a word.
 
PageTextChar GetChar (size_t charindex) const
 Get the character at the specified index.
 
size_t HitTest (const PDF::PointF &point) const
 Perform a hit test at the specified point and return the index of the character that contains the point.
 
std::vector< PageTextRangeSearch (const std::wstring &text, PageTextSearchFlags flags=0) const
 Search for the specified text throughout all text within a page.
 
 PageText (PDPageText handle, bool adopt=false) noexcept
 
 PageText (const PageText &rhs) noexcept
 
PageTextoperator= (const PageText &rhs) noexcept
 
 PageText (PageText &&rhs) noexcept
 
PageTextoperator= (PageText &&rhs) noexcept
 

Detailed Description

Represents text on a page.

For more information refer to section 9 Text of the ISO 32000-2:2020 (PDF 2.0) PDF Standard.

Member Function Documentation

◆ GetChar()

PageTextChar PDF::PageText::GetChar ( size_t charindex) const
inline

Get the character at the specified index.

Parameters
charindexThe index of the character.
Returns
The character at the specified index.

◆ GetNumChars()

size_t PDF::PageText::GetNumChars ( ) const
inline

Get the number of characters from a page, text segment or a word.

Returns
The number of characters.

◆ HitTest()

size_t PDF::PageText::HitTest ( const PDF::PointF & point) const
inline

Perform a hit test at the specified point and return the index of the character that contains the point.

It determines if a particular point (e.g., a mouse click) intersects with a graphical element, such as a character in a text layout.

Parameters
pointThe point to perform the hit test at.
Returns
The index of the character that contains the point, or kPDPageIndexNull if no character contains the point.

◆ Search()

std::vector< PageTextRange > PDF::PageText::Search ( const std::wstring & text,
PageTextSearchFlags flags = 0 ) const
inline

Search for the specified text throughout all text within a page.

Parameters
textThe text to search for (i.e. L"search for this")
flags[Optional] The search flags specifying case-insensitivity and/or whole word matching.
See also
PageTextSearchFlagsEnum.
Returns
A vector of PageTextRange objects representing the ranges of text that match the search.

The documentation for this class was generated from the following file: