Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Jul 28, 2021 9:22 pm

I was trying following segment of code from your demo examples, but ExtractText yields no text with attached document, althought in AdobeReader I can select text and copy it from document. Am I missing soimething or where is the problem?

Code: Select all
  PdfDocument doc = new PdfDocument();
  doc.LoadFromFile("sample.pdf");
  PdfPageBase page = doc.Pages[0];

  SimpleTextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
  string text = page.ExtractText(strategy);
  FileStream fs = new FileStream("result.txt", FileMode.Create);
  StreamWriter sw = new StreamWriter(fs);
  sw.Write(text);
  sw.Flush();
  sw.Close();


Sincerely,
Brane

bbrodnik
 
Posts: 21
Joined: Sat Jan 09, 2021 10:38 am

Thu Jul 29, 2021 9:05 am

Hello,

Thanks for your inquiry.
I tested your case with the latest version of Spire.PDF(Spire.PDF Pack(Hot Fix) Version:7.7.10 ) and found that the text extraction was successful, but the extracted text was garbled. Here I attached my test demo for your reference. Regarding the issue of garbled text, I have posted this issue to our developers for investigation. Once it is resolved or there is any update, I will inform you in time. Sorry for the inconvenience caused.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Thu Jul 29, 2021 10:52 am

Yes, you are right, extracted text was returned, but was garbled. I missconcluded because VS TextVisualizer in debugger didn,t show me any text, so I appologise.

But it still is an issue and I have many documents with this kind of problem so I would appreciate if you resolve it.

Regards

bbrodnik
 
Posts: 21
Joined: Sat Jan 09, 2021 10:38 am

Fri Jul 30, 2021 2:36 am

Hello,

Thank you for your feedback.
Our Dev team will investigate the garbled text issue. Once any significant progress has been made, I will inform you immediately.
Wish you a nice day :D

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Fri Aug 20, 2021 11:27 am

Hello,

Thank you for your patience.
Glad to inform you that we have just released Spire.PDF Pack (Hot Fix) Version: 7.8.8 which solves the problem you posted. Please download it from the following links.
Website link:
https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link:
https://www.nuget.org/packages/Spire.PDF/7.8.8
https://www.nuget.org/packages/Spire.PDF.NETCore/7.8.8

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Sat Aug 28, 2021 8:20 am

It works!!! Thank you very much.

Regards,
Brane

bbrodnik
 
Posts: 21
Joined: Sat Jan 09, 2021 10:38 am

Mon Aug 30, 2021 2:36 am

Hi,

You're welcome.
If you have other questions about using Spire.PDF in the future, please feel free to contact us.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF