Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Feb 13, 2024
2 parents 99e00a2 + 8cacb0f commit b8f2ba3
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 b8f2ba3

Please sign in to comment.