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

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

Merged
merged 3 commits into from
Feb 26, 2025

Conversation

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

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

Copy link

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 1 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.

@stefan6419846
Copy link
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