py-pdf / fpdf2

Simple PDF generation for Python
https://py-pdf.github.io/fpdf2/
GNU Lesser General Public License v3.0
1.13k stars 253 forks source link

Fix UTC Serialization in PDFDate.serialize() Method #1290

Closed Shenile closed 5 days ago

Shenile commented 1 month ago

This pull request fixes a bug in the PDFDate.serialize() method in in fpdf/syntax.py related to the serialization of UTC dates in PDF metadata. Previously, UTC dates were incorrectly serialized to include timezone information, resulting in formats like "Z00'00'" or "Z15:22". The expected format for UTC dates should simply be "Z".

e.g. Fixes #1261

Checklist:

Lucas-C commented 1 month ago

Thank you for your contribution @Shenile 👍

There a few minor details preventing this PR to be merged for now:

Shenile commented 1 month ago

Thank you for your contribution @Shenile 👍

There a few minor details preventing this PR to be merged for now:

  • test/linearization.pdf should not be added as part of this PR. It is not needed, and currently makes the GitHub Actions pipeline fail.
  • the reference PDF file test/image/image_types/image_types_insert_jpg_flatedecode_windows.pdf has significantly grown, which is a bit strange... Do you have all fpdf2 dependencies up-to-date ? Maybe try to run pip install --update . -r test/requirements.txt

Thank you for your feedback!

I have removed the test/linearization.pdf file from the PR, as it was not needed. Additionally, I have updated the dependencies by running pip install --update . -r test/requirements.txt .

Please let me know if there's anything else I need to address!

Lucas-C commented 1 month ago

A few unit tests are still failing in the GitHub Actions pipeline:

test/image/image_types/test_insert_images.py::test_insert_jpg_jpxdecode FAILED [ 37%]
test/image/image_types/test_insert_images.py::test_insert_jpg_flatedecode FAILED [ 37%]
test/image/image_types/test_insert_images.py::test_insert_png_alpha_dctdecode FAILED [ 38%]
test/layout/test_page_background.py::test_page_background FAILED         [ 43%]

Each time it's due to the /CreationDate

Could you check if those 4 unit tests pass on the your own development environment @Shenile?

Lucas-C commented 4 weeks ago

Hi @Shenile 🙂

Just to get a quick update: do you still want to implement this bugfix?

Lucas-C commented 6 days ago

Hi @Shenile

Given your absence of response, I'm planning to finish the work you initiated in this PR soon. If you still want to complete this, just drop a comment 🙂