def parse_lt_objects(lt_objects):
 text_content = []
 for lt_object in lt_objects:
  if (isinstance(lt_object, LTTextBox) or isinstance(lt_object, LTTextLine)):
   text_content.append(lt_object.get_text().encode('utf-8'))
  elif isinstance(lt_object, LTFigure):
   text_content.append(parse_lt_objects(lt_object._objs))
 return '\n'.join(text_content)

def parse_lt_objects ( lt_objects ) : text_content = [ ] for lt_object in lt_objects : if ( isinstance ( lt_object , LTTextBox ) or isinstance ( lt_object , LTTextLine ) ) : text_content . append ( lt_object . get_text ( ) . encode ( 'utf-8' ) ) elif isinstance ( lt_object , LTFigure ) : text_content . append ( parse_lt_objects ( lt_object . _objs ) ) return '\n' . join ( text_content )
iterate through the list of lt* objects and capture the text data contained in each object .