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

Fix word aggregation with many whitespaces #28

Open
fl4p opened this issue Sep 30, 2024 · 1 comment
Open

Fix word aggregation with many whitespaces #28

fl4p opened this issue Sep 30, 2024 · 1 comment

Comments

@fl4p
Copy link
Owner

fl4p commented Sep 30, 2024

Exclude whitespace chars or chars with a small bbox from word aggregation.

image

Thes whitespace here collapse the table structure:

image

datasheets/littelfuse/IXFP110N15T2.pdf

@fl4p
Copy link
Owner Author

fl4p commented Sep 30, 2024

using this interpreter class helps:

class PDFPageInterpreter_NOWS(PDFPageInterpreter):
    def render_contents(
        self,
        resources: Dict[object, object],
        streams: Sequence[object],
        ctm: Matrix = MATRIX_IDENTITY,
    ) -> None:
        r = super().render_contents(resources, streams, ctm)
        for obj in list(self.device.cur_item):
            if isinstance(obj, LTChar):
                c = obj.get_text()
                if c.isspace():
                    self.device.cur_item._objs.remove(obj)
        return r

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

No branches or pull requests

1 participant