NAMEps2ascii - Ghostscript translator from PostScript or PDF to ASCII
SYNOPSISps2ascii [ input.ps [ output.txt ] ]
ps2ascii input.pdf [ output.txt ]
DESCRIPTIONps2ascii uses gs(1) to extract ASCII text from PostScript(tm) or Adobe Portable Document Format (PDF) files. If no files are specified on the command line, gs reads from standard input; but PDF input must come from an explicitly-named file, not standard input. If no output file is specified, the ASCII text is written to standard output.
ps2ascii doesn't look at font encoding, and isn't very good at dealing with kerning, so for PostScript (but not currently PDF), you might consider pstotext (see below).