Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Shenile
Copy link

@Shenile Shenile commented Oct 18, 2024

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:

  • A unit test is covering the code added/modified by this PR
  • This PR is ready to be merged
  • In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder
  • A mention of the change is present in CHANGELOG.md

@Lucas-C
Copy link
Member

Lucas-C commented Oct 18, 2024

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

@Shenile
Copy link
Author

Shenile commented Oct 18, 2024

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
Copy link
Member

Lucas-C commented Oct 20, 2024

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
Copy link
Member

Lucas-C commented Oct 30, 2024

Hi @Shenile 🙂

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreationDate metadata shows wrong timezone offset for UTC
2 participants