# Extracting text from a pdf file

**URL:** <https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305>\
**Category:** Factual Questions\
**Created:** [November 12, 2008, 4:29am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305 "2008-11-12T04:29:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tapioca\_Dextrin](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tapioca\_Dextrin](https://boards.straightdope.com/u/Tapioca_Dextrin)\
**Post date:** [November 12, 2008, 4:29am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/1 "2008-11-12T04:29:06Z")

</div>

In theory, if you have the full version of Adobe Acrobat, you can select text and use it to paste it. Normally, this works pretty well. I currently have a pdf that was created back in around 1999 and I can’t extract the text - wahat I get is this

e,)+? :@   
 :@  
\< :@ @ Aa;!

This isn’t very useful. Anyone have any idea how to extract useful data from an ancient PDF???

---

<div class="post-metadata">

**Author:** ![Dog80](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@Dog80](https://boards.straightdope.com/u/Dog80)\
**Post date:** [November 12, 2008, 5:24am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/2 "2008-11-12T05:24:21Z")

</div>

If anything else fails you could OCR it.

---

<div class="post-metadata">

**Author:** ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)\
**Post date:** [November 12, 2008, 5:58am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/3 "2008-11-12T05:58:34Z")

</div>

Modern OCR works pretty well but you need access to a good scanner. I had a hard copy of some family history that I fed into a heavy duty copier at work and it read, converted, and e-mailed me a new version of 20 pages within 5 minutes with near 100% accuracy. Home scanners may take longer.

---

<div class="post-metadata">

**Author:** ![bluezooky](https://avatars.discourse-cdn.com/v4/letter/b/e8c25b/32.png) [@bluezooky](https://boards.straightdope.com/u/bluezooky)\
**Post date:** [November 12, 2008, 6:00am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/4 "2008-11-12T06:00:36Z")

</div>

Ghostscript, Ghostview and GSview might be worth trying.[http://pages.cs.wisc.edu/~ghost/](http://pages.cs.wisc.edu/~ghost/)

---

<div class="post-metadata">

**Author:** ![sailor](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sailor](https://boards.straightdope.com/u/sailor)\
**Post date:** [November 12, 2008, 7:49am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/5 "2008-11-12T07:49:59Z")

</div>

> [@Shagnasty](#):
>
> Modern OCR works pretty well but you need access to a good scanner. I had a hard copy of some family history that I fed into a heavy duty copier at work and it read, converted, and e-mailed me a new version of 20 pages within 5 minutes with near 100% accuracy. Home scanners may take longer.

Why on earth would you need a scanner when you can print the PDF to an image (TIFF) file directly?

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [November 12, 2008, 8:09am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/6 "2008-11-12T08:09:58Z")

</div>

Another thing you can do is to print it to a Postscript file, and then clean it up. I have cause to do something like this. I use a collection of sed and Perl scripts to clean up the crud, which gets me most of the way there. If your pdf is fairly simple, this might work pretty well.

---

<div class="post-metadata">

**Author:** ![LSLGuy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lslguy/32/5813_2.png) [@LSLGuy](https://boards.straightdope.com/u/LSLGuy)\
**Post date:** [November 12, 2008, 1:37pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/7 "2008-11-12T13:37:48Z")

</div>

I’m a bit confused. Plain old for-free adobe reader has the ability to extract text from pdf files (at least modern ones). This has been true back to at least version 5 of the freebie. While it’s not great for dozens of pages, it’ll work OK if you just need to grab a couple pages.

What program & what process is the OP using to get the gibberish sh/she is getting now?

---

<div class="post-metadata">

**Author:** ![Khadaji](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Khadaji](https://boards.straightdope.com/u/Khadaji)\
**Post date:** [November 12, 2008, 1:58pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/8 "2008-11-12T13:58:41Z")

</div>

PDF can store text, but it can also store bitmaps, gifs, jpgs and other image types. It is possible that you have a PDF that is showing several scanned pages (images). You would not be able to extract text from an image, and as others have pointed out, you would need to perform an OCR on them.

I would be willing to take a look at it, if the file isn’t too big. You may use the address in my profile.

---

<div class="post-metadata">

**Author:** ![Tapioca\_Dextrin](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tapioca\_Dextrin](https://boards.straightdope.com/u/Tapioca_Dextrin)\
**Post date:** [November 13, 2008, 5:21am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/9 "2008-11-13T05:21:09Z")

</div>

> [@LSLGuy](#):
>
> What program & what process is the OP using to get the gibberish sh/she is getting now?

The full version of Acrobat

> [@Dog80](#):
>
> If anything else fails you could OCR it.

There’s no OCR in the office

> [@Khadaji](#):
>
> I would be willing to take a look at it, if the file isn’t too big. You may use the address in my profile.

Ah, the joys of confidential documents.

Looks like I’ll have a busy few weeks typing. I’ve nothing better to do :smack:

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [November 13, 2008, 5:35am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/10 "2008-11-13T05:35:08Z")

</div>

> [@Tapioca\_Dextrin](#):
>
> Looks like I’ll have a busy few weeks typing. I’ve nothing better to do :smack:

Really, print it to a Postscript file and open it up with an editor. What have you got to lose?

---

<div class="post-metadata">

**Author:** ![Tapioca\_Dextrin](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tapioca\_Dextrin](https://boards.straightdope.com/u/Tapioca_Dextrin)\
**Post date:** [November 13, 2008, 6:41am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/11 "2008-11-13T06:41:20Z")

</div>

The postscript file doesn’t contain any readable text ☹

---

<div class="post-metadata">

**Author:** ![astro](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@astro](https://boards.straightdope.com/u/astro)\
**Post date:** [November 13, 2008, 6:54am UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/12 "2008-11-13T06:54:26Z")

</div>

3 ideas for you;

Well… just as a thought it might not have anything to do with the actual capturing (it’s getting something) but rather the font conversion. You might try the extraction process on a system with a more compete install of font files.

Assuming you can “see” the text in the old pdf file try _printing_ it as a pdf file. This is will force saving and conversion to a newer pdf/font format and perhaps enable text capture.  
This free program looks like it might solve your problem

> **[Convert PDF to HTML - Free Online Conversion](https://labnol.blogspot.com/2005/12/convert-doc-xls-ppt-rtf-pdf-to-html.html)**
>
> How to instantly convert Microsoft Office, OpenOffice, PDF documents to HTML without installing any third-party software like Adobe Acrobat ...

---

<div class="post-metadata">

**Author:** ![LSLGuy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lslguy/32/5813_2.png) [@LSLGuy](https://boards.straightdope.com/u/LSLGuy)\
**Post date:** [November 13, 2008, 2:09pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/13 "2008-11-13T14:09:21Z")

</div>

If full Acrobat can’t retrieve the text, I’m gonna bet you really have pictures of text, i.e. embedded gif/jpg files, rather than actual text. If so …

When you say you have no OCR …

Assuming you’re on Windows, not Mac or ??? …

If you have Office 2003 or later, and you have MS Document Imaging (look in the start menu under Office \>\> Office Tools), then you have all you’ll need for OCR.

All we need now is to convert the PDF itself to an image format file.

I don’t know if full Acrobat can do save as tiff, or save each page as a jpg. I’d try that first. If not …

If you have, or can buy for $15, a fax modem, yuo can print the PDF to paper, fax it to the fax modem, which yields a TIFF file.

If your office has a multi-function printer with scanning, that’d be the better choice. Or if any of your co-workers who’re cleared for seeing the document have one at home.

Once you do get the scan file, then drop that in MS Document Imaging & viola.

If the document is less than, say, 15 pages, you could probably retype it more quickly, unless you get lucky. But if the doc is 200 pages then yuo can afford to spend a day or more trying to extract the text before it gets cheaper to re-keystroke it.

Heck, if it’s gonna take a man-week to re-keystroke, it’d probably be cheaper to go buy a scanner/multi-function printer & be done with it.

---

<div class="post-metadata">

**Author:** ![tomndebb](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@tomndebb](https://boards.straightdope.com/u/tomndebb)\
**Post date:** [November 13, 2008, 3:00pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/14 "2008-11-13T15:00:13Z")

</div>

> [@sailor](#):
>
> Why on earth would you need a scanner when you can print the PDF to an image (TIFF) file directly?

The TIFF would be only pictures of the pictures of the words. In order to get an electronic copy of the text that can be _edited_, one needs to bring it into a text editor. If all one has is a picture file (GIF, TIFF, whatever), then one “simple” way to move the data (rather than the images) is to get it into a printed document, then use a scanner that will convert the images to text.

---

<div class="post-metadata">

**Author:** ![Reply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/reply/32/15952_2.png) [@Reply](https://boards.straightdope.com/u/Reply)\
**Post date:** [November 13, 2008, 5:04pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/15 "2008-11-13T17:04:04Z")

</div>

How about converting the PDF to another format? Try this free program that can convert the PDF to HTML or other formats… it may or may not successfully preserve the text.  
[http://www.mobipocket.com/en/DownloadSoft/ProductDetailsCreator.asp](http://www.mobipocket.com/en/DownloadSoft/ProductDetailsCreator.asp)

I normally use it to convert PDFs for reading on my Kindle, and it works somewhat, well… haphazardly. But it’s worth a try; you’ve got nothing to lose.

---

<div class="post-metadata">

**Author:** ![minor7flat5](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/minor7flat5/32/258_2.png) [@minor7flat5](https://boards.straightdope.com/u/minor7flat5)\
**Post date:** [November 13, 2008, 5:38pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/16 "2008-11-13T17:38:40Z")

</div>

Not sure what you mean by the “Full Version” of Acrobat.

I use Acrobat Pro 8 on my Mac and it has full OCR capabilities; I use it all the time to OCR documents that I have scanned in.

In addition, you can use Acrobat Pro to delete any metadata from the file so that you can start fresh. Presumably the document is a scanned image, with embedded metadata containing old corrupt text information. If you strip out the bogus metadata and run a fresh OCR on the doc, you might get it.  
(Of course, use a _copy_ of the document; keep the original file somewhere else).

---

<div class="post-metadata">

**Author:** ![Really\_Not\_All\_That\_Bright](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Really\_Not\_All\_That\_Bright](https://boards.straightdope.com/u/Really_Not_All_That_Bright)\
**Post date:** [November 13, 2008, 6:06pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/17 "2008-11-13T18:06:40Z")

</div>

> [@LSLGuy](#):
>
> I’m a bit confused. Plain old for-free adobe reader has the ability to extract text from pdf files (at least modern ones). This has been true back to at least version 5 of the freebie. While it’s not great for dozens of pages, it’ll work OK if you just need to grab a couple pages.
> 
> What program & what process is the OP using to get the gibberish sh/she is getting now?

Acrobat Reader can extract text from files that are converted/published to .pdf, but not from files scanned to .pdf. You need Acrobat (the full version that you pay for) to do that.

---

<div class="post-metadata">

**Author:** ![Reply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/reply/32/15952_2.png) [@Reply](https://boards.straightdope.com/u/Reply)\
**Post date:** [November 13, 2008, 6:14pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/18 "2008-11-13T18:14:24Z")

</div>

> [@tomndebb](#):
>
> The TIFF would be only pictures of the pictures of the words. In order to get an electronic copy of the text that can be _edited_, one needs to bring it into a text editor. If all one has is a picture file (GIF, TIFF, whatever), then one “simple” way to move the data (rather than the images) is to get it into a printed document, then use a scanner that will convert the images to text.

You can do this without wasting paper by just OCRing the picture directly (if necessary, by first converting it via a virtual printer to a compatible format). See LSLGuy’s post.

---

<div class="post-metadata">

**Author:** ![robcaro](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@robcaro](https://boards.straightdope.com/u/robcaro)\
**Post date:** [November 13, 2008, 6:39pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/19 "2008-11-13T18:39:01Z")

</div>

If you have MS Word, you can use PDFtoWord. You can download it from [VeryPDF.com](http://VeryPDF.com). If you cannot get it there, let me know.

---

<div class="post-metadata">

**Author:** ![sailor](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sailor](https://boards.straightdope.com/u/sailor)\
**Post date:** [November 13, 2008, 9:06pm UTC](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305/20 "2008-11-13T21:06:14Z")

</div>

> [@tomndebb](#):
>
> The TIFF would be only pictures of the pictures of the words. In order to get an electronic copy of the text that can be _edited_, one needs to bring it into a text editor. If all one has is a picture file (GIF, TIFF, whatever), then one “simple” way to move the data (rather than the images) is to get it into a printed document, then use a scanner that will convert the images to text.

I think you missed the intention of my post. Someone said to print it to paper and then scan it and I am saying there is no need for that as you can print to image much faster and with better quality. That’s my point. That printing to paper and then scanning makes no sense whatsoever.

[Next page](https://boards.straightdope.com/t/extracting-text-from-a-pdf-file/472305.md?page=2)
