I want to update the metadata of pdf files.

My additional requirements:

  • Python library
  • open source (but not viral licences like GPL)
  • Still maintained

The list of outdated libraries:

  • 1
    "open source (not GPL)" — Do you mean it need not be GPLed, or it must not be GPLed? Are other copyleft licenses acceptable, or do you need a permissive license? Aug 21, 2017 at 18:19
  • @Kodiologist I updated the question (but not viral licences like GPL). Is it clear now, our should I update it again?
    – guettli
    Aug 22, 2017 at 6:30

2 Answers 2


I took over the pypdf and PyPDF2 projects and merged them. pypdf is the way to go. We use the BSD license.

We also have docs about how to write metadata

from pypdf import PdfReader, PdfWriter

reader = PdfReader("example.pdf")
writer = PdfWriter()

# Add all pages to the writer
for page in reader.pages:

# Add the metadata
        "/Author": "Martin",
        "/Producer": "Libre Writer",

# Save the new PDF to a file
with open("meta-pdf.pdf", "wb") as f:

Non-python-centric answer:

If your workflow is as follows:

  1. On the command line, Interactively try single edit in single metadata field,
  2. Apply same editing-command on bunch of PDF files
  3. Apply it routinely by calling a script

then you can call Command-line tool exiftool (see github) from Python and set PDF metadata.

More links are given in this Reddit Post from 2022: Bulk add PDF metadata from the command line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.