Hi Dan,

You can grab the Mac OS X installer package for pdftotext from Carsten Blüm's 
web page:
http://www.bluem.net/en/mac/packages/

Just download the latest version, which is  pdftotext 3.01pl5 (13/07/2011, 686 
KB, for Intel Macs).  Double-clicking the Installer.pkg on the pdftotext.dmg 
installs the pdftotext utility but not the suite of other xpdf utilities.  If 
you need to install the full version of xpdf, I'd check the macports web pages 
about Lion problems, and also read the instructions for Xcode 4.3 migration of 
macports before proceeding.  

Using the command;
pdftotext <filename.pdf>
in Terminal creates a .txt version of the file in the same directory as the pdf 
file.  This does not convert pdf files that are purely graphics images.

If you want to run this from the Terminal command line, I'd recommend that you 
get the free Go2Shell utility from the Mac App Store:
http://itunes.apple.com/us/app/go2shell/id445770608?mt=12
This is a low-footprint app that opens up a Terminal window in the directory of 
the file you've highlighted in Finder, and saves you having to type long 
pathnames either for the file you want to convert (although you can do a 
Command-C copy in Finder and then a Command-V paste in Terminal), or cd to a 
change directory to that pathname before applying your command.

Alternatively, you can put an AppleScript wrapper around the pdftotext command 
and use this from the GUI. Just open your AppleScript Editor (use 
Command+Shift+U in Finder to go to your Utilities folder, press "a p" to go to 
the AppleScript Editor and use Command+Down Arrow or Command+O to launch it) 
and paste in the following code (staring below the line labeled "Cut Here", and 
ending with the line "end run"):
---Cut Here---
(*
Use pdftotext to create a text version of the selected PDF file
      Created 17 May 2011
*)
on run
       tell application "Finder"
               set chosenFile to the selection as alias
       end tell
       do shell script "/usr/local/bin/pdftotext " & quoted form of POSIX path 
of chosenFile
end run

Since Lion now hides the Library file for your account, and you'd usually store 
this AppleScript in a Library/Scripts folder, I'll post a neat solution for 
unhiding your ~/Library folder from Doug Adams' AppleScripts for iTunes web 
pages on "Installing AppleScript under Mac OS X Lion". Simply go to the 
"download this AppleScript applet" link on the "Make Users Library Folder 
VIsible" page at:
http://dougscripts.com/itunes/2011/07/installing-applescripts-under-os-x-lion/
Opening the downloaded applet will make the Library folder on your account 
visible without having to type a command on the Terminal command line or 
download and run an application like TinkerTool to reconfigure your account 
preference settings.

Either compile the AppleScript with Command-K, or else select a pdf file in 
Finder and switch back to the AppleScript Editor with Command-Tab, then run the 
AppleScript with Command-R (which also compiles it) to test this. You can save 
the file to the Library/Scripts folder on your home directory, with a name of 
your choice (e.g., "PDF to Text").  (You may need to create this folder if this 
is the first time you are using AppleScripts.)  If you also bring up the 
preferences menu before quitting the AppleScript Editor with Command-comma, and 
check the box for "Show Script menu on menu bar" on the general tab, "PDF to 
Text" (or whatever name you saved) will show up under the "AppleScript" menu on 
the status menu bar.  

Another alternative to navigating to the status menu bar (VO-M-M or Control-F8) 
and navigating to the "PDF to Text" entry of the AppleScript menu is to use 
Automator, and set this up as a service by pasting text into the "run 
AppleScript" action. This was also previously described in the forum posts in 
the "Re: something like pdf2txt on the mac?" thread:
http://www.mail-archive.com/macvisionaries%40googlegroups.com/msg45375.html

HTH.  Note that both the AppleScript and Automator solutions also allow you to 
process multiple PDF files that you have selected in Finder.

Cheers,

Esther
 

On Mar 2, 2012, at 9:25 AM, .dan. wrote:

> 
> I tried to install the macport version of xpdf.  The universal version is:
> 
> xpdf 3.02pl5
> 
> I get an error message saying the "3.02pl5" dependency is not present.
> 
> Has anyone install this package?  It is for use in terminal and converts the 
> text in a pdf file into text among other things.
> 
> 
>                               XB
>                                IC|XC
> 

-- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To post to this group, send email to macvisionaries@googlegroups.com.
To unsubscribe from this group, send email to 
macvisionaries+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/macvisionaries?hl=en.

  • Xpdf for mac .dan.
    • pdftotext utility [was Re: Xpdf for mac] Esther

Reply via email to