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.

Thu Sep 16, 2021 9:34 am

Hello,

We have an issue with extracting text from a pdf.

Our system is based on using Docker containers, we receive pdf as a stream format and we would like to extract data from it.
We are using the function LoadFromStream from SpirePDF. We get the page count number but the method ExtractText doesnt return the string.
Here is the code sample:

Code: Select all
using (MemoryStream ms = new MemoryStream(Attachment.Body))
            {
                PdfDocument doc = new PdfDocument();
                doc.LoadFromStream(ms);
                Console.WriteLine(doc.Pages.Count);

                PdfPageBase page = doc.Pages[0];
               
                SimpleTextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
                string text = page.ExtractText(strategy);
                Console.WriteLine(text);
               
                return text;
            }


Thank you very much for you answer,
Have a good day!

datvadoo
 
Posts: 5
Joined: Wed Jul 21, 2021 9:12 am

Thu Sep 16, 2021 9:54 am

Hello

Thanks for your inquiry.
I simulated a PDF file and tested your code with the latest Spire.PDF Pack(Hot Fix) Version:7.9.2, but I did not reproduce your issue. If you are using an older version, we recommend you upgrade to the latest version and try again.

If the issue persists after trying, to help us investigate your issue more quickly and accurately, please provide your input file and your project target framework (e.g. .NET Core 3.1) to help us investigate further. You could send them to us ([email protected]) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Sep 23, 2021 10:29 am

Hello,

Greetings from E-iceblue!
Has your issue been resolved? Any feedback will be greatly appreciated.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF

cron