python pdf to text convert

i want to convert pdf into text.i try this code in python command prompt but it not showing any output may be im wrong can u plz tel me where im wrong.Thanx in advance.



import pyPdf

def getPDFContent(path):
    content = ""
    # Load PDF into pyPDF
    pdf = pyPdf.PdfFileReader(file(path, "rb"))
    # Iterate pages
    for i in range(0, pdf.getNumPages()):
        # Extract text from page and add to content
        content += pdf.getPage(i).extractText() + "\n"
    # Collapse whitespace
    content = " ".join(content.replace(u"\xa0", " ").strip().split())
    return content

print getPDFContent("test.pdf").encode("ascii", "ignore")
python pdf to text convert
===


i want to convert pdf into text.i try this code in python command prompt but it not showing any output may be im wrong can u plz tel me where im wrong.Thanx in advance.



import pyPdf

def getPDFContent(path):
    content = ""
    # Load PDF into pyPDF
    pdf = pyPdf.PdfFileReader(file(path, "rb"))
    # Iterate pages
    for i in range(0, pdf.getNumPages()):
        # Extract text from page and add to content
        content += pdf.getPage(i).extractText() + "\n"
    # Collapse whitespace
    content = " ".join(content.replace(u"\xa0", " ").strip().split())
    return content

print getPDFContent("test.pdf").encode("ascii", "ignore")