This commit is contained in:
2025-09-30 08:32:57 +02:00
parent b45a8b2d00
commit e88167fe33
2 changed files with 81 additions and 0 deletions

17
PDFmanipulationBetter.py Normal file
View File

@@ -0,0 +1,17 @@
from pathlib import Path
import os
from pikepdf import Pdf, Name
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"
pdf.save(filepdfin, static_id=True, linearize=True)
cesta = r"z:\dropbox\ordinace\Dokumentace_ke_zpracování"
for name in os.listdir(cesta):
p = os.path.join(cesta, name)
if os.path.isfile(p) and name.upper().endswith(".PDF"):
set_single_page_view(p)