tags:

views:

307

answers:

2

currently i have been using the following code and i am using some dll files from pdfbox

        FileInfo file = new FileInfo("c://aa.pdf");

        PDDocument doc = PDDocument.load(file.FullName);

        PDFTextStripper pdfStripper = new PDFTextStripper();
        string text = pdfStripper.getText (doc);
        richTextBox1.Text = qq;

using this code i can able to get text file but not in a correct format plz give me a some ideas

+1  A: 

Extracting the text from a pdf file is anything but trivial.

To quote from th iTextSharp tutorial.

"The pdf format is just a canvas where text and graphics are placed without any structure information. As such there aren't any 'iText-objects' in a PDF file. In each page there will probably be a number of 'Strings', but you can't reconstruct a phrase or a paragraph using these strings. There are probably a number of lines drawn, but you can't retrieve a Table-object based on these lines. In short: parsing the content of a PDF-file is NOT POSSIBLE with iText."

There are several commercial applications which claim to be able to do it. Caveat Emptor.

There is also a free software library called Poppler http://poppler.freedesktop.org/ which is used by the pdf viewers of GNOME and KDE. It has a function called pdftotext() but I have no experience with it. It may be your best free option.

Spike
thank u so much i will try
ush
it is not working
ush
Well, it is supposed to be a hard problem. I take it you're not creating these pdfs yourself?
Spike
+1  A: 

There is a blog article explaining the issues with PDF text extraction in general at http://pdf.jpedal.org/java-pdf-blog/bid/12670/PDF-text

mark stephens