Skip to content

DEP: Deprecate support for abbreviations in decode_stream_data#3617

Merged
stefan6419846 merged 2 commits intopy-pdf:mainfrom
stefan6419846:decode_stream_data
Jan 27, 2026
Merged

DEP: Deprecate support for abbreviations in decode_stream_data#3617
stefan6419846 merged 2 commits intopy-pdf:mainfrom
stefan6419846:decode_stream_data

Conversation

@stefan6419846
Copy link
Collaborator

The inline image abbreviations were previously supported in the publicly facing decode_stream_data function. Doing some analysis showed that this support was limited:

  • Our own code would always map to the "proper" names beforehand, thus we possibly never tested this variant and it has been incomplete.
  • Only abbreviations for the filter names were supported. Already using /F instead of /Filter for the filter names itself or specifying /DP instead of /DecodeParams would fail, as well as all other keys from table 91 and 92 of the PDF 2.0 specification.

With this in mind, only external API users might have used this API in the full manner, although we never seem to have received specific reports about the not supported/mapped parameters. Thus, deprecating the abbreviations specific to inline images in this generic function seems like the best way to move forward.

While I was working on this to analyze the current behavior, I wrote some basic inline image tests for the previously unsupported filter abbreviations CCF and DCT (at least in decode_stream_data). The new abbreviations were added for completeness (although deprecated directly), showing that using PageObject.images never errored out or would run into the deprecation now due to properly mapping them in our own code.

The inline image abbreviations where previously supported in the
publicly facing `decode_stream_data` function. Doing some analysis
showed that this support was limited:

  * Our own code would always map to the "proper" names beforehand, thus
    we possibly never tested this variant and it has been incomplete.
  * Only abbreviations for the filter names were supported. Already
    using `/F` instead of `/Filter` for the filter names itself or
    specifying `/DP` instead of `/DecodeParams` would fail, as well as
    all other keys from table 91 and 92 of the PDF 2.0 specification.

With this in mind, only external API users might have used this API in
the full manner, although we never seem to have received specific
reports about the not supported/mapped parameters. Thus, deprecating the
abbreviations specific to inline images in this generic function seems
like the best way to move forward.

While I was working on this to analyze the current behavior, I wrote
some basic inline image tests for the previously unsupported filter
abbreviations CCF and DCT (at least in `decode_stream_data`). The new
abbreviations were added for completeness (although deprecated
directly), showing that using `PageObject.images` never errored out or
would run into the deprecation now due to proper mapping in our own
code.
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.36%. Comparing base (eb84ca5) to head (8420e38).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3617   +/-   ##
=======================================
  Coverage   97.36%   97.36%           
=======================================
  Files          55       55           
  Lines        9835     9845   +10     
  Branches     1798     1798           
=======================================
+ Hits         9576     9586   +10     
  Misses        153      153           
  Partials      106      106           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefan6419846 stefan6419846 merged commit 5d6d7f0 into py-pdf:main Jan 27, 2026
18 checks passed
@stefan6419846 stefan6419846 deleted the decode_stream_data branch January 27, 2026 13:07
stefan6419846 added a commit that referenced this pull request Feb 8, 2026
## What's new

### Deprecations (DEP)
- Deprecate support for abbreviations in decode_stream_data (#3617) by @stefan6419846

### New Features (ENH)
- Add ability to add font resources for 14 Adobe Core fonts in text widget annotations (#3624) by @PJBrs

### Bug Fixes (BUG)
- Avoid invalid load for ICCBased FlateDecode images in mode 1 (#3619) by @stefan6419846

### Robustness (ROB)
- Fix AESV2 decryption when /Length missing in encrypt dict (#3629) by @dmitry-kostin
- Fix merging when annotations point to NullObject (#3613) by @stefan6419846
- Check for `self._info` being None in `compress_identical_objects` (#3612) by @stefan6419846

[Full Changelog](6.6.2...6.7.0)
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.

1 participant