/usr/lib/python2.7/dist-packages/xapers/parsers/pdf.py is in xapers 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from ..parser import ParserBase
import subprocess
def extract(data):
cmd = ['pdftotext', '-', '-']
proc = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=open('/dev/null','w'),
)
(stdout, stderr) = proc.communicate(input=data)
proc.wait()
return stdout
class Parser(ParserBase):
def extract(self):
cmd = ['pdftotext', self.path, '-']
text = subprocess.check_output(cmd, stderr=open('/dev/null','w'))
return text
|