Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need the numerical values from pdf files like this one.

Mathematica graphics

When I use the usual Import command, the PDF imports, but pages of images. How can Mathematica be used to import the numerical values from a PDF?

share|improve this question
    
It is very likely the numbers are rasterized in your PDF. In that case, Import alone won't cut it. Maybe run the PDF through Google Docs to extract the text. –  m_goldberg Jul 16 '13 at 20:50
2  
Take a look at mathematica.stackexchange.com/q/18683/193 –  belisarius Jul 16 '13 at 20:50
    
@m_goldberg That doesn't seem to be the case here. –  Sjoerd C. de Vries Jul 16 '13 at 20:55
    
@belisarius neat trick, alas it produces the error "Expecting an image or graphics instead". Checking the pdf file in Acrobat pro shows that these values are editable and so I should be able to import them. –  R Hall Jul 16 '13 at 21:06
    
the values seem to be in binary (??) Import["/pathto/SoLux Spectral Data.xls.pdf", "Plaintext"] –  Mike Honeychurch Jul 16 '13 at 21:29
add comment

1 Answer

up vote 4 down vote accepted

Using Adobe Acrobat I exported the file as XML and .DOC.

The first file can be read directly using

Import["SoLux Spectral Data.xls.xml", "XML"]

but you have to cut your way through the resulting XML expression tree.

The second method involves using MS Word. After opening the .doc file, I selected the table, copied it and pasted it in the following expression:

ImportString["","TSV"]

The insertion point should be precisely in the empty string (""). After pasting, you will get this dialog box:

Mathematica graphics

Press "Yes", evaluate the result and you get:

{{"Wavelength ", "4700K ", "4100K ", "3500K "}, {280, 0.049379, 0.054292, 0.0503}, {290, 0.075516, 0.037844, 0.034862}, {300, 0.11254, 0.030544, 0.028027}, {310, 0.16051, 0.033413, 0.029238}, {320, 0.23068, 0.067789, 0.055261}, {330, 0.32281, 0.20151, 0.13953}, {340, 0.40282, 0.43615, 0.25661}, {350, 0.45898, 0.57172, 0.52681}, {360, 1.2011, 0.82864, 1.3278}, {370, 1.8647, 1.5222, 1.6987}, {380, 2.5338, 2.3844, 3.61}, {390, 3.5809, 4.5686, 3.9927}, {400, 4.4137, 8.4548, 8.168}, {410, 5.2228, 14.205, 13.863}, {420, 6.0387, 17.949, 17.46}, {430, 6.9944, 21.068, 20.103}, ... }

If Word seems to copy only part of the table, try pasting it first in Excel before going to Mathematica, doing a bit of polishing there. Copying to the welcoming quotes in Mathematica will then do the trick.

share|improve this answer
    
+1 Slick solution! Thanks very much! –  R Hall Jul 16 '13 at 21:22
1  
@RHall Glad you like it, though I would be more pleased if a direct solution could be found. –  Sjoerd C. de Vries Jul 16 '13 at 21:29
add comment

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.