Skip to content

PdfTextExtractor extracts blank text #1444

@spstrademark

Description

@spstrademark

Hello,
i am using the following versions in flutter and syncfusion_flutter_pdf :
flutter:3.13.6
syncfusion_flutter_pdf: ^23.1.38

I have the following issue that when i try to read the attached pdf file the pages are blank or mostly unreadable. This is my code for reading a specific page :

Future<Map<String, dynamic>> getPdfContent(String path,{pageIndex=1}) async{


  PdfDocument document = PdfDocument(inputBytes: await _readDocumentData(path));
  int pageCount = document.pages.count;

  if (pageIndex < 0 || pageIndex >= pageCount) {
    print("Error: Page index out of bounds!");
    document.dispose();
    return {'text': '', 'pageCount': pageCount};
  }

  PdfTextExtractor extractor = PdfTextExtractor(document);

  // Since you're extracting from a single page, start and end page indices should be the same
  String text = extractor.extractText(startPageIndex: pageIndex, endPageIndex: pageIndex);

  document.dispose();

  return {'text': text, 'pageCount': pageCount};
}

The provided code is working fine with other pdf files, am i doing something wrong and can this issue be resolved somehow?

Thank you for your time!
Stanko

Черният Лебед - Насим Талеб.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpdfPDF componentwaiting for customer responseCannot make further progress until the customer responds.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions