'Index PDF documents'

def _index_pdf(self, bin_data):

    buf = u''
    if bin_data.startswith('%PDF-'):
        f = StringIO(bin_data)
        try:
            pdf = pyPdf.PdfFileReader(f)
            for page in pdf.pages:
                buf += page.extractText()
        except Exception:
            pass
    return buf
