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.

Tue Aug 05, 2014 9:12 am

Attached file is zipped PDF , I want to retrieve text from it, but get IndexOutOfRangeExceptopn is such code:

Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spire.Pdf;


namespace GM_PdfProcessor.PDF
{
    public class SpirePdfHandler
    {

        public void ExtractText(string fileName)
        {
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(fileName);

            StringBuilder buffer = new StringBuilder();
         
            string aha ="";

            foreach (PdfPageBase page in doc.Pages)
            {
                aha = page.ExtractText();               
            }
        }
    }
}


Spire.PDF is from the NuGET of ver 3.1.9.5040

blaze
 
Posts: 4
Joined: Tue Aug 05, 2014 8:59 am

Tue Aug 05, 2014 10:13 am

Hello,

I run your code and used the same dll in Windows 7 64bit but didn’t reproduce the issue you encountered. Could you please provide us information about your OS?
If you get any questions, welcome to get it back to us.

Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Mon Aug 11, 2014 11:54 am

Wn7 64bit

blaze
 
Posts: 4
Joined: Tue Aug 05, 2014 8:59 am

Tue Aug 12, 2014 9:03 am

Hello,

I sent you an e-mail. There is a project in the attachment of the e-mail. Please test it.
If you get any questions, welcome to get it back to us.

Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Return to Spire.PDF