Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I copy text out of a PDF file and into a text editor, it ends up mangled in a variety of ways. Formatting like bold and italics are lost; soft line breaks within a paragraph of text are converted to hard line breaks; dashes to break a word over two lines are preserved even when they shouldn't be; and single and double quotes are replaced with ? signs.

Ideally, I'd like to be able to copy text from a PDF and have formatting converted to HTML codes, "smart quotes" converted to " and ', and line breaks done properly. Is there any way to do this?

share|improve this question
    
I wrote a blog article explaining what is in the PDF and why extraction is complex at jpedal.org/PDFblog/?p=228 –  mark stephens Oct 12 '10 at 7:23
    
Word 2013 can open PDFs. Not perfect. But doable –  pratnala Dec 1 '12 at 14:56

6 Answers 6

up vote 25 down vote accepted

Firstly, you have to understand what a PDF is. PDFs are designed to mimic a printed page, and they are designed only as an output format, not an input format. a PDF is basically a map containing the exact location of characters (individual letters or punctuation, etc.) or images. In most cases, a PDF does not even store information about where one word ends and another begins, much less things like soft breaks vs. hard breaks for paragraph endings.

(A few recent PDFs do store some information about this stuff, but that's a new technology, and you'd be lucky to find PDFs like that. Even if you did, your PDF viewer might not know about it.)

Anyway, it's up to your software to implement some kind of "artificial intelligence" to extract merely from the locations of individual characters what is a word, what is a paragraph, and so on. Different software is going to do this better than others, and it's also going to depend on how the PDF was made. In any case, you should never expect perfect results. Having the output PDF is not the same as having the source document. Far better to try to obtain that if you can.

The standard solution to your kind of problem is to use Adobe Acrobat Professional (the expensive one, not the free reader) to convert the PDF to HTML. Even that is not going to get perfect results.

There is free software that can be used to extract text from PDFs with some of formatting intact, but again, don't expect perfect results. See, e.g., calibre (which can convert to RTF format), pdftohtml/pdfreflow or the AbiWord word processor (with all import/export plugins enabled). There's also a PDF import plugin for OpenOffice.

But please don't expect perfection with any of these results. You're going against the grain here. PDF just is not meant as an editable input format.

share|improve this answer
5  
tl;dr version: PDFs Suck –  Fake Name Oct 12 '10 at 1:51

make use of "cloudconvert tool" from google docs...upload you document to cloudconvert and convert to word doc.

share|improve this answer

Another option is to download and start using the free pdf viewer, Foxit (its good). Then you can 'Save As' and choose .txt to convert it to a text file. That will preserve all the formatting. Dunno whether you can do the same in Adobe because I stopped using it a while ago when I converted to Foxit.

share|improve this answer
    
"Save as... Text" worked for me with several free pdf viewers. –  Jeff Dec 18 '13 at 19:23

Open your PDF file with a browser(Google chrome and firefox are tested)then copy your text there.

share|improve this answer
    
Thanks! This worked for me. –  Mischa Mar 19 at 10:00

There is a very good online tool called Sej-da. Its deals with Advanced PDF Manipulation. There is no software to download. As it is a new online tool it is currently still in Beta. It allows you to extract text from a PDF, as well as providing a myriad of other PDF functionalities

http://www.sejda.com/

A brief video review of sejda functions was done 14th November 2012 by Revision 3 it can be found here:

http://revision3.com/tzdaily/sejda-online-pdf

share|improve this answer
    
One could still download the command line tool: sejda.org/download (I don't think it allows extracting text with formatting?) –  Arjan Dec 1 '12 at 14:41
    
I have already recommended Sejda above Arjan –  Simon Dec 1 '12 at 14:56
    
Huh? I just meant: you're saying it's an online tool, but one can also download the same thing. Also, looking into it further: I don't think it will preserve the formatting, like was asked for? –  Arjan Dec 1 '12 at 15:16
    
Good point I suppose, I have never used it, although heard good things about it - although it is still only in beta –  Simon Dec 1 '12 at 15:28
    
I am well aware preserving of format was requested, but unless you try you will never know. –  Simon Dec 1 '12 at 15:41

You can use Adobe Acrobat Pro for this.

For tables: With Acrobat 9/10 there was a select tables feature. With Acrobat X you can just click Save As > Spreadsheet > Excel. It even concatenates pages into one long spreadsheets. Awesome feature.

For text: A similar feature exists for exporting to MS Word. Save As > Word > Word Doc.

Sources:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.