-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Introducing a pypdf CLI program - close #2160 #2170
Conversation
@@ -847,7 +847,7 @@ def bits2byte(data: bytes, size: Tuple[int, int], bits: int) -> bytes: | |||
lookup: Any | |||
base: Any | |||
hival: Any | |||
if isinstance(color_space, ArrayObject) and color_space[0] == "/Indexed": | |||
if isinstance(color_space, ArrayObject) and len(color_space) == 4 and color_space[0] == "/Indexed": |
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.
How is this change related to the CLI?
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 is a fixup for a bug.
Introducing this CLI and the related unit tests revealed this issue:
File "/opt/pypdf/pypdf/filters.py", line 851, in _handle_flate
color_space, base, hival, lookup = (
ValueError: not enough values to unpack (expected 4, got 3)
There is also another bug spotted there:
https://github.com/py-pdf/pypdf/blob/issue-2160/tests/test_cli.py#L91
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.
@Lucas-C
can you provide the pdf showing the issue
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.
Yes, this is one of py-pdf
test samples: https://github.com/py-pdf/pypdf/blob/main/resources/AutoCad_Diagram.pdf
The error was raised by simply calling pypdf extract-images AutoCad_Diagram.pdf
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 reported the 2nd bug there: #2176
Should I open a distinct issue for the 1st bug, regarding filters.py
& color_space
?
This PR can probably be closed, given that https://github.com/py-pdf/pdfly offers similar functionalities |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2170 +/- ##
==========================================
+ Coverage 94.25% 94.29% +0.04%
==========================================
Files 42 43 +1
Lines 7556 7630 +74
Branches 1487 1499 +12
==========================================
+ Hits 7122 7195 +73
Misses 266 266
- Partials 168 169 +1
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
I will not merge the change done with However, the change to |
@Lucas-C How should we continue with this PR? |
@Lucas-C Friendly reminder :-) How do you want to continue with this PR? |
I'm closing this PR as I assume that this will not have a follow-up. If I'm wrong, we can still re-open :-) |
What's missing: