Skip to content

Commit

Permalink
Fix #865 - PDF metadata not encrypted (#867)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Cimon <[email protected]>
  • Loading branch information
lfavole and Lucas-C committed Jul 26, 2023
1 parent 892d58a commit 5da2dae
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
- [`FPDF.image()`](https://pyfpdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.image): allowing images path starting with `data` to be passed as input
- text overflow is better handled by `FPDF.write()` & `FPDF.write_html()` - _cf._ [issue #847](https://github.com/PyFPDF/fpdf2/issues/847)
- the initial text color is preserved when using `FPDF.write_html()` - _cf._ [issue #846](https://github.com/PyFPDF/fpdf2/issues/846)
- PDF metadata not encrypted - _cf._ [issue #865](https://github.com/PyFPDF/fpdf2/issues/865)
- handle superscript and subscript correctly when rendering `TextLine`- thanks to @Tolker-KU - _cf._ [Pull Request #862](https://github.com/PyFPDF/fpdf2/pull/862)
### Deprecated
- the `center` optional parameter of [`FPDF.cell()`](https://pyfpdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.cell) is **no more** deprecated, as it allows for horizontal positioning, which is different from text alignment control with `align="C"`
Expand Down
12 changes: 6 additions & 6 deletions fpdf/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ def __init__(
creation_date: PDFDate,
):
super().__init__()
self.title = PDFString(title) if title else None
self.subject = PDFString(subject) if subject else None
self.author = PDFString(author) if author else None
self.keywords = PDFString(keywords) if keywords else None
self.creator = PDFString(creator) if creator else None
self.producer = PDFString(producer) if producer else None
self.title = PDFString(title, encrypt=True) if title else None
self.subject = PDFString(subject, encrypt=True) if subject else None
self.author = PDFString(author, encrypt=True) if author else None
self.keywords = PDFString(keywords, encrypt=True) if keywords else None
self.creator = PDFString(creator, encrypt=True) if creator else None
self.producer = PDFString(producer, encrypt=True) if producer else None
self.creation_date = creation_date


Expand Down
Binary file modified test/encryption/encryption_aes128.pdf
Binary file not shown.
Binary file modified test/encryption/encryption_rc4.pdf
Binary file not shown.
Binary file modified test/encryption/encryption_rc4_permissions.pdf
Binary file not shown.
Binary file modified test/encryption/encryption_rc4_user_password.pdf
Binary file not shown.

0 comments on commit 5da2dae

Please sign in to comment.