I have used this code to convert pdf to text.
input1 = '//Home//Sai Krishna Dubagunta.pdf'
output = '//Home//Me.txt'
os.system(("pdftotext %s %s") %( input1, output))
I have created the Home directory and pasted the source file in it.
The output I get is
1
And no file with .txt was created. Where is the Problem?
Your expression
("pdftotext %s %s") %( input1, output)
will translate to
pdftotext //Home//Sai Krishna Dubagunta.pdf //Home//Me.txt
which means that the first parameter passed to pdftotext
is //Home//Sai
, and the second parameter is Krishna
. That obviously won't work.
Enclose the parameters in quotes:
os.system("pdftotext '%s' '%s'" % (input1, output))