extractText method

String extractText({
  1. int? startPageIndex,
  2. int? endPageIndex,
  3. bool? layoutText,
})

Extract text from an existing PDF document

startPageIndex and endPageIndex specifies the page range to be selected to extract text. for example, startPageIndex is 0 and endPageIndex is 9 is used to extract text from first page to 10 page of loaded PDF

for extracting text from particular page, we can set an index of the page to startPageIndex

//Load an exisiting PDF document.
PdfDocument document = PdfDocument.fromBase64String(pdfData);
//Extract text from all pages
String text = PdfTextExtractor(document).extractText();
//Dispose the document.
document.dispose();

Implementation

String extractText(
    {int? startPageIndex, int? endPageIndex, bool? layoutText}) {
  _isLayout = layoutText ?? false;
  return _extractText(startPageIndex, endPageIndex);
}