1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3 " Description: Use the pdftotext program to filter .pdf files into plain text
4 " Author: Marc Prud'hommeaux <mwp1@cornell.edu>
5 " Last Change: 18 May, 2004
7 " Licence: This program is free software; you can redistribute it
8 " and/or modify it under the terms of the GNU General Public
9 " License. See http://www.gnu.org/copyleft/gpl.txt
10 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 " run pdftotext to read PDF files
13 autocmd BufReadPost,FileReadPost *.pdf call s:readpdf()
16 if (!executable("pdftotext"))
17 echo "Error: pdftotext not installed or not in path"
22 " invoke: pdftotext sourcefile.pdf tempfile
23 call system ("pdftotext '" . escape (expand("<afile>"), "'") . "' " . tmp)
25 execute "silent '[-1r " . tmp
26 " clean up the temporary file
29 " make the buffer unwritable: we don't want to clobber the PDF file!