Skip to content

Commit

Permalink
DOC: Document easier way to update metadata (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan6419846 authored Feb 13, 2024
1 parent 3fb63f7 commit 8cacb0f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/user/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,24 @@ writer.add_metadata(
with open("meta-pdf.pdf", "wb") as f:
writer.write(f)
```

## Updating metadata

```python
from pypdf import PdfReader, PdfWriter

writer = PdfWriter(clone_from="example.pdf")

# Change some values.
writer.add_metadata(
{
"/Author": "Martin",
"/Producer": "Libre Writer",
"/Title": "Title",
}
)

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

0 comments on commit 8cacb0f

Please sign in to comment.