from pathlib import Path import os from pikepdf import Pdf, Name from FunkceWhereIsDropbox import get_dropbox_path,get_medicus_connection #Get cesta to Dropbox on working computer dropbox=get_dropbox_path() cesta=dropbox/"Ordinace"/"Dokumentace_ke_zpracování" cestazpracovana=dropbox/"Ordinace"/"Dokumentace_zpracovaná" def set_single_page_view(filepdfin: str | os.PathLike): filepdfin = Path(filepdfin) with Pdf.open(filepdfin, allow_overwriting_input=True) as pdf: pdf.Root.PageLayout = Name('/SinglePage') # one page at a time, no continuous scroll pdf.Root.PageMode = Name('/UseNone') # no thumbnails/bookmarks on open # Optional: keep file ID stable and re-linearize for "Fast Web View" print(filepdfin) pdf.save(filepdfin, static_id=True, linearize=True) for name in os.listdir(cesta): p = os.path.join(cesta, name) if os.path.isfile(p) and name.upper().endswith(".PDF"): try: set_single_page_view(p) except: pass