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

Merged
merged 1 commit into from
Nov 21, 2024

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?

@Lucas-C
Copy link
Member

Lucas-C commented Nov 20, 2024

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 🙂

Removed linearization.pdf and updated dependencies
@Lucas-C Lucas-C merged commit 5b7fce3 into py-pdf:master Nov 21, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreationDate metadata shows wrong timezone offset for UTC
2 participants