-
Notifications
You must be signed in to change notification settings - Fork 944
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
Pdfstream as cmap #283
Pdfstream as cmap #283
Conversation
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 PR with batteries included:
- new functionality
- a bit of refactoring
- added functional tests
- an example pdf
Wow! Let's merge it!
@@ -140,7 +142,13 @@ def do_keyword(self, pos, token): | |||
|
|||
|
|||
NIBBLES = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'e', 'e-', None, '-') | |||
|
|||
IDENTITY_ENCODER = {'Identity-H':'Identity-H', |
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.
You mentioned that DLIdent-* is not in the PDF reference manual. Did you find other pdf documentation that mentions this? If so, you could add a comment that refers to it such that we do not remove DLIdent-* by accident.
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 haven't seen any pdf with DLIdent-* but have included it due to its harmless nature. Will also include code comment to avoid DLIdent-* being removed by accident.
pdfminer/cmapdb.py
Outdated
return struct.unpack('>%dB' % n, code) | ||
else: | ||
return () | ||
|
||
## UnicodeMap |
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.
There are a lot of these unnecessary code comments in cmapdb.py
. Since you are editing this file anyway, could you remove those? And likewise for pdffont.py
?
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.
Sure, Can do that.
pdfminer/pdffont.py
Outdated
@@ -140,12 +130,18 @@ def do_keyword(self, pos, token): | |||
|
|||
|
|||
NIBBLES = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'e', 'e-', None, '-') | |||
""" |
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 might be nitpicking here: according to pep8 block comments should start with a hashtag instead of using a multi-line string.
Advantage of using hashtag: an intelligent editor can understand that it is a comment
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.
Got it, Done.
@pietermarsman Hi, Have removed the comments. Can you please review it once again and merge if no other changes are required. :) |
Hi @fakabbir, sorry for the miscommunication but I do not have commit rights right now. I do my bit by reviewing and creating PR's. I hope to get commit rights soon though. |
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 looks like euske/pdfminer/pull/179 with some extra features and tests. It'd be great to have this merged asap.
Resolves #210 .
The previous work #264 maps "OneByteEncodingH/V" to default CMap initialization. It also ignores the fact that "DLIdent-H/V" is a valid encoding since it isn't mentioned in any PDF Reference the author can dig in.
While looking for the output of pdf2text.py the OneByteEncoding characters were absent denoting that default CMap encoding is ineffective to capture the glyph.
I have added the decode function for OneByteEncoding and also added DLIdent as there is a possibility of this being in many PDF.
Both OneByteEncoding and DLIdent aren't available in any PDF Reference referred.