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

Enabled PDFDevice in the with statement #88

Merged
merged 1 commit into from
Aug 18, 2017
Merged

Enabled PDFDevice in the with statement #88

merged 1 commit into from
Aug 18, 2017

Conversation

massongit
Copy link
Contributor

@massongit massongit commented Aug 4, 2017

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()

@goulu goulu merged commit d4118cf into pdfminer:master Aug 18, 2017
@massongit massongit deleted the feature/closeable branch August 24, 2017 10:58
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

Successfully merging this pull request may close these issues.

2 participants