from pikepdf import Pdf, Name inputpdf=r"u:\Dropbox\!!!Days\Downloads Z230\Dokumentace\a.pdf" # # Open the PDF file # with Pdf.open(inputpdf) as pdf: # # Ensure the PDF has a Catalog dictionary # if '/Catalog' not in pdf.Root: # pdf.Root['/Catalog'] = {} # # # Set the OpenAction to fit the page # pdf.Root['/Catalog']['/OpenAction'] = [pdf.pages[0], Name.Fit] # # # Save the modified PDF # pdf.save('output.pdf') from pikepdf import Pdf, Dictionary, Name pdf = Pdf.open(inputpdf) pdf.Root.PageLayout = Name('/SinglePage') pdf.Root.PageMode = Name('/UseNone') pdf.save('output.pdf')