Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Conversation

@massongit
Copy link

I enabled pdfminer.pdfdevice.PDFDevice and it's inherited classes in the with statement.

Example (Use pdfminer.converter.TextConverter which is pdfminer.pdfdevice.PDFDevice's inherited classes):

import io

import pdfminer.converter
import pdfminer.layout
import pdfminer.pdfinterp
import pdfminer.pdfpage


def main():
    with io.StringIO() as return_text:
        resource_manager = pdfminer.pdfinterp.PDFResourceManager()

        with pdfminer.converter.TextConverter(resource_manager, return_text, laparams=pdfminer.layout.LAParams(detect_vertical=True)) as device:
            ...


if __name__ == '__main__':
    main()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant