View Single Post
  #1 (permalink)  
Old September 12th, 2007, 05:46 AM
prasannatele prasannatele is offline
Registered User
 
Join Date: Sep 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default read pdf files in C#

Hi all,
Please reply asap.
The control goes into infinite loop when i try reading pdf file in my C# file.
I have to return a string as it is my requirement.
can anyone suggest what to do?

FileStream ReadPdf = new FileStream(@"D:\abc.pdf", FileMode.Open);
            long FileSize;
            FileSize = ReadPdf.Length;
            UTF8Encoding temp = new UTF8Encoding(true);
            Int16 i;
            string returnstring = null;

            byte[] Buffer = new byte[(Int64)FileSize];
            ReadPdf.Read(Buffer, 0, (int)ReadPdf.Length);
            for (i = 0; i <= Buffer.Length - 1; i++)
            {
                returnstring = temp.GetString(Buffer);
            }
            return returnstring;

Reply With Quote