from pypdf import PdfReader, PdfWriter

# Load the existing PDF
reader = PdfReader(r"u:\Dropbox\!!!Days\Downloads Z230\output11.pdf")
writer = PdfWriter()

# Copy all pages to the writer
for page in reader.pages:
    writer.add_page(page)

#Get metadata
metadata = reader.metadata
author = metadata.get("/Author","")
author=author+', YourName'
print(author)

# Set metadata
writer.add_metadata({"/Author": ""})
writer.add_metadata({"/Author": author})

# Save the updated PDF
with open(r"u:\Dropbox\!!!Days\Downloads Z230\output11.pdf", "wb") as f:
    writer.write(f)

