getTextInRect method
Retrieves text inside the specified rectangle on the current page.
Parameters:
rect - The page-space rectangle used to extract bounded text.
Returns: Text contained in the rectangle, or an empty string.
example:
final CPDFPage page = controller.document.pageAtIndex(0);
const CPDFRectF rect = CPDFRectF(
left: 40,
top: 760,
right: 560,
bottom: 680,
);
final String text = await page.getTextInRect(rect);
print(text);
Since v2.6.8
Implementation
Future<String> getTextInRect(CPDFRectF rect) async {
final result = await _channel.invokeMethod('get_page_text_in_rect', {
'page_index': pageIndex,
'rect': rect.toJson(),
});
return result ?? '';
}