-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ENH: Add support for BrotliDecode filter (PDF 2.0) #3223 #3254
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3254 +/- ##
==========================================
- Coverage 96.71% 96.69% -0.02%
==========================================
Files 53 53
Lines 9029 9048 +19
Branches 1674 1677 +3
==========================================
+ Hits 8732 8749 +17
- Misses 177 179 +2
Partials 120 120 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1573164
to
d339bc8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Is the official specification available in the meantime?
Apart from this, I have left some comments I stumbled upon during the review.
274ed94
to
4dd3fa0
Compare
Reverting the requirements.txt files to main will show an error that the package is not installed. Is there any other way to get them installed? - I have added them in dev.in and ci.in - expecting that the req will be generated while running the pipeline. |
The official specification for Brotli compression in PDF is not yet released. However, the PDF Association has announced its upcoming inclusion in PDF 2.0. Sample PDF files are available for developers to begin testing. https://pdfa.org/brotli-compression-coming-to-pdf/ |
You can change the |
8b4514f
to
b7a5245
Compare
672f080
to
a4fdd61
Compare
…y-pdf#3255) Variabke NumberSigns is unused. Also tweak some comments.
Also change kw to kwargs for familiarity.
aee4bf8
to
3ba2235
Compare
tests/test_filters.py
Outdated
@pytest.mark.skipif(importlib.util.find_spec("brotli") is None, reason="brotli library not installed") | ||
def test_brotli_import_handling_available(): | ||
"""Verify brotli module is properly imported in pypdf.filters when available.""" | ||
# This test only runs when brotli is actually installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is superfluous.
tests/test_filters.py
Outdated
|
||
assert extracted_text.strip() == "Hello, Brotli!" | ||
|
||
def test_brotli_import_error_with_patch(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still do not really understand why we need this complexity. Could you please elaborate?
Implements the BrotliDecode filter as specified in ISO 32000-2:2020, Section 7.4.11. Adds necessary constants, integrates the filter into the decoding logic, includes brotli as an optional dependency, adds unit tests, and updates documentation.
Closes #3223