-
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
ROB: page._get_fonts() gives KeyError: '/BaseFont' #2289
Labels
is-robustness-issue
From a users perspective, this is about robustness
Comments
MartinThoma
changed the title
page._get_fonts() gives KeyError: '/BaseFont'
BUG: page._get_fonts() gives KeyError: '/BaseFont'
Nov 9, 2023
MartinThoma
changed the title
BUG: page._get_fonts() gives KeyError: '/BaseFont'
ROB: page._get_fonts() gives KeyError: '/BaseFont'
Nov 9, 2023
MartinThoma
added
the
is-robustness-issue
From a users perspective, this is about robustness
label
Nov 9, 2023
@pubpub-zz I would replace # the list comprehension ensures there is FontFile
emb.add(cast(str, f["/BaseFont"])) in if (...) and "/BaseFont" in f:
emb.add(cast(str, f["/BaseFont"])) That would at least make the exception go away. But I don't know why we have that big if-block. I guess there is something else wrong? |
The problem here is that the font is a Type 3 that does not contains /BaseFont property.
about the big if block, so far from I remember I've written it as a list of if but ruff/black optimized it |
pubpub-zz
added a commit
to pubpub-zz/pypdf
that referenced
this issue
Feb 25, 2024
stefan6419846
pushed a commit
that referenced
this issue
Feb 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wanted to get the fonts of a page and got a
KeyError: '/BaseFont'
Environment
Which environment were you using when you encountered the problem?
Code + PDF
This is a minimal, complete example that shows the issue:
The PDF:
missing-base-font.pdf
Traceback
This is the complete Traceback I see:
The text was updated successfully, but these errors were encountered: