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

[loaders] Loads accept LTTextLines as top level pdfminer elements, which breaks things #154

Closed
jstockwin opened this issue Jan 15, 2021 · 0 comments · Fixed by #155
Closed
Assignees
Labels

Comments

@jstockwin
Copy link
Owner

In the loaders, we do

elements = [element for element in page if isinstance(element, LTTextContainer)]

however, I have an example PDF (which I can't share) where one of these elements is an LTTextLine.

LTTextBox and LTTextLine are both LTTextContainers.

We're expecting to get LTTextBoxes, containing LTTextLines, which in turn contain LTChars. In this case, we're only getting an LTTextLine containing an LTChar. This breaks the code, for example when trying to find the font, since we try to iterate through the 2nd level, which should be an LTTextLine, but is now an LTChar which is not iterable.

I think the fix here is to search for instances of LTTextBox instead of LTTextLine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant