def parse_pages(pdf_buffer, password):
 parser = PDFParser(pdf_buffer)
 document = PDFDocument(parser, password)
 resource_manager = PDFResourceManager()
 la_params = LAParams()
 device = PDFPageAggregator(resource_manager, laparams=la_params)
 interpreter = PDFPageInterpreter(resource_manager, device)
 text_content = []
 for page in PDFPage.create_pages(document):
  interpreter.process_page(page)
  layout = device.get_result()
  text_content.append(parse_lt_objects(layout._objs))
 return text_content

def parse_pages ( pdf_buffer , password ) : parser = PDFParser ( pdf_buffer ) document = PDFDocument ( parser , password ) resource_manager = PDFResourceManager ( ) la_params = LAParams ( ) device = PDFPageAggregator ( resource_manager , laparams = la_params ) interpreter = PDFPageInterpreter ( resource_manager , device ) text_content = [ ] for page in PDFPage . create_pages ( document ) : interpreter . process_page ( page ) layout = device . get_result ( ) text_content . append ( parse_lt_objects ( layout . _objs ) ) return text_content
with an pdf buffer object .