Skip to content

BUG: Use the correct name StandardEncoding for the predefined cmap#3156

Merged
stefan6419846 merged 3 commits intopy-pdf:mainfrom
stefan6419846:standard-encoding
Feb 26, 2025
Merged

BUG: Use the correct name StandardEncoding for the predefined cmap#3156
stefan6419846 merged 3 commits intopy-pdf:mainfrom
stefan6419846:standard-encoding

Conversation

@stefan6419846
Copy link
Copy Markdown
Collaborator

Sometimes, running text extraction on specific PDF files would state:

Advanced encoding /StandardEncoding not implemented yet

This has always been surprising to me, until I finally found enough time to further debug this. Turns out that #924 introduced the wrong name StandardCoding instead of StandardEncoding for the predefined cmaps. StandardCoding is not part of the PDF specification, while StandardEncoding is indeed (for example in Annex D of the PDF 2.0 specification). As this encoding is the default encoding for undefined names, this would not have any side effects on the actual text extraction results.

@stefan6419846
Copy link
Copy Markdown
Collaborator Author

I still need to have a look at getting hold of an actual test file to share publicly before merging this.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.52%. Comparing base (0714711) to head (937f460).
Report is 99 commits behind head on main.

Files with missing lines Patch % Lines
pypdf/_cmap.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3156   +/-   ##
=======================================
  Coverage   96.52%   96.52%           
=======================================
  Files          53       53           
  Lines        8903     8903           
  Branches     1631     1631           
=======================================
  Hits         8594     8594           
  Misses        185      185           
  Partials      124      124           

☔ 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
Copy link
Copy Markdown
Collaborator Author

Example file: standard-encoding.pdf

@stefan6419846 stefan6419846 merged commit f65245f into py-pdf:main Feb 26, 2025
15 of 16 checks passed
@stefan6419846 stefan6419846 deleted the standard-encoding branch February 26, 2025 12:32
stefan6419846 added a commit that referenced this pull request Mar 2, 2025
## What's new

### Bug Fixes (BUG)
- Use the correct name StandardEncoding for the predefined cmap (#3156) by @stefan6419846
- Handle inline images containing `EI ` sequences (#3152) by @stefan6419846
- Fix check box value which should be name object (#3124) by @stefan6419846
- Fix stream position on inline image fallback extraction (#3120) by @stefan6419846
- Fix object count for incremental writer (#3117) by @m32

### Robustness (ROB)
- Avoid index errors on empty lines in xref table (#3162) by @stefan6419846
- Improve handling of LZW decoder table overflow (#3159) by @stefan6419846
- Ignore non-numbers for width when building font width map (#3158) by @stefan6419846
- Avoid negative seek values when reading partially broken files (#3157) by @stefan6419846

### Documentation (DOC)
- Fixed PageObject.images example usage for replacing image (#3149) by @jutoth

[Full Changelog](5.3.0...5.3.1)
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