We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Help with loading of pure text from a PDF file

Hi.
When I try to extract pure text from pdf file it, I do not see any text on output.
I use this code:

Document pdfDocument = new Document(@“C:\temp\mypdffile.pdf”);
TextAbsorber textAbsorber = new TextAbsorber(new TextExtractionOptions(TextExtractionOptions.TextFormattingMode.Raw));
pdfDocument.Pages.Accept(textAbsorber);
Console.WriteLine(textAbsorber.Text);

Can anyone advise me where I am doing wrong?
Thx.


Juri

Hi Juri,

The code that you have shared seems to be correct. I can see the text extracted from PDF. May be the problem is reliant on the source file you are using.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I tried the same pdf file in the demo application http://www.aspose.com/demos/.net-components/aspose.pdf/csharp/PdfDemos/Text/ExtractText.aspx and it works great.