This commit is contained in:
2025-10-04 17:08:59 +02:00
parent 5d377c822c
commit 637ba3a123
2 changed files with 15 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ def get_dropbox_path() -> Path:
raise FileNotFoundError("Dropbox folder not found on any drive.") raise FileNotFoundError("Dropbox folder not found on any drive.")
print(get_dropbox_path())
def get_medicus_connection(): def get_medicus_connection():
@@ -51,4 +51,4 @@ def get_medicus_connection():
print(f"⚠️ Error connecting to Medicus on {computer_name}: {e}") print(f"⚠️ Error connecting to Medicus on {computer_name}: {e}")
raise raise
print(get_medicus_connection())

View File

@@ -1,6 +1,13 @@
from pathlib import Path from pathlib import Path
import os import os
from pikepdf import Pdf, Name 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): def set_single_page_view(filepdfin: str | os.PathLike):
filepdfin = Path(filepdfin) filepdfin = Path(filepdfin)
@@ -8,10 +15,14 @@ def set_single_page_view(filepdfin: str | os.PathLike):
pdf.Root.PageLayout = Name('/SinglePage') # one page at a time, no continuous scroll pdf.Root.PageLayout = Name('/SinglePage') # one page at a time, no continuous scroll
pdf.Root.PageMode = Name('/UseNone') # no thumbnails/bookmarks on open pdf.Root.PageMode = Name('/UseNone') # no thumbnails/bookmarks on open
# Optional: keep file ID stable and re-linearize for "Fast Web View" # Optional: keep file ID stable and re-linearize for "Fast Web View"
print(filepdfin)
pdf.save(filepdfin, static_id=True, linearize=True) pdf.save(filepdfin, static_id=True, linearize=True)
cesta = r"z:\dropbox\ordinace\Dokumentace_ke_zpracování"
for name in os.listdir(cesta): for name in os.listdir(cesta):
p = os.path.join(cesta, name) p = os.path.join(cesta, name)
if os.path.isfile(p) and name.upper().endswith(".PDF"): if os.path.isfile(p) and name.upper().endswith(".PDF"):
try:
set_single_page_view(p) set_single_page_view(p)
except:
pass