When Importing in Mathematica (v10.3) a pdf file containing some text, the text is "vectorialized", meaning that it does not seem to be loaded as text, and re-exporting the imported file produces a file in which the text is not selectable.

Consider for example the following code:

 Plot[x, {x, 0, 1}]

As you can test, while the text in test.pdf can be selected, the text in test2.pdf cannot, and opening it for example with Inkscape shows that it is not really exported as text.

How can I import the text in external pdf files as text?

  • $\begingroup$ From the Docs: Import["test.pdf", "TextOutlines" -> False]. $\endgroup$ Dec 1, 2015 at 13:38
  • $\begingroup$ @AlexeyPopkov somehow I missed that on the docs, thanks! $\endgroup$
    – glS
    Dec 1, 2015 at 13:44
  • $\begingroup$ @AlexeyPopkov now that was useful for me, too (never needed before, but filed for future reference). How about answering anyway? Personally, I would be in favor of reopening, as this may be useful for others. $\endgroup$
    – Yves Klett
    Dec 1, 2015 at 18:26
  • 1
    $\begingroup$ @YvesKlett I will post an answer if the question will be reopened. Actually I thought that this option is widely known (it is used in many answers on this site). But if an experienced user like you find it useful I think we should reopen the question! Also, not every PDF file can be imported correctly with this option, but it is another and quite long story... I'm voting to reopen. $\endgroup$ Dec 1, 2015 at 20:08
  • $\begingroup$ Looking forward to your answer 😊 $\endgroup$
    – Yves Klett
    Dec 1, 2015 at 20:52

1 Answer 1


According to the Documentation page for PDF format (under the "Options" section) there is "TextOutlines" option which controls "whether to import characters as outlines". You should set it to False for importing text as characters instead of outlines:

Import["test.pdf", "TextOutlines" -> False]

Note that this feature can work incorrectly when characters inside of a PDF file have nonstandard encoding. Due to this reason it usually incorrectly imports non-ASCII characters, for example:

ImportString[ExportString["αβγ", "PDF"], "PDF", "TextOutlines" -> False]


At the same time I seem to remember situations when Import correctly recognized Greek letters in PDF files NOT created by Mathematica. I guess that this is encoding issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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