Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to import a PDF file whose text I'd like to parse, but I'm getting an error with no explanation:

Import["foobar.pdf", {"PDF", "Plaintext"}]
(* $Failed *)

I know the file exists as named, because if it didn't, $Mathematica$ would show a message:

Import["foobaz.pdf", {"PDF", "Plaintext"}]
(* Import::nffil: File not found during Import. *)
(* $Failed *)

Is there any way to get more information than the $Failed?

share|improve this question

If the PDF file was composed with one of the latest security features of Adobe, you will not be able to parse. You need adobe Acrobat Pro to remove the security feature. This is assuming you have the priviledge to do so.

Another option is to print the file to Paperport PDF convert to PDF format and re export to PDF. But this might defeat your purpose to extract all the text from the orginal file.

share|improve this answer
That was exactly the problem. Thanks! – Andrew Cheong Apr 19 '14 at 16:12
up vote 3 down vote accepted

I'm posting a separate answer to show what I did but please upvote @JoseECalderon if you find this answer useful, as he led me in the right direction regarding security settings.

Unfortunately the security settings on my document prevented even printing to a (clean) PDF:

enter image description here

I found a blog post where someone needed to unlock exactly the documents I'm working with: downloadable American Express statements. This person ended up using MuPDF, which worked for me as well. After downloading and extracting the Windows executable from their Downloads page (and adding the executable to my Windows $PATH), I ran

mutools.exe clean foobar.pdf foobar-unlocked.pdf

and then was able to import the PDF.

share|improve this answer

Your Answer


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.