from registration import update_reg from anvil.tables import app_tables from PyPDF2 import PdfReader from io import BytesIO # from notebook_funcs import get_message def get_files(): update_reg('get_files') retval='' query=app_tables.files.search() for r in query: retval+=r['filename']+'\n' return retval def get_file(name): update_reg('get_file') retval='' r=app_tables.files.get(filename=name) bts=r['file'].get_bytes() sio=BytesIO(bts) with sio as f: reader=PdfReader(f) fpage=reader.pages[0].extract_text() retval+=r['filename']+'\n'+ fpage return retval