metachris / pdfx

Extract text, metadata and references (pdf, url, doi, arxiv) from PDF. Optionally download all referenced PDFs.
http://www.metachris.com/pdfx
Apache License 2.0
1.03k stars 113 forks source link

Adding a close() method and context manager methods for class PDFx #44

Open PierreSelim opened 3 years ago

PierreSelim commented 3 years ago

Currently the PDFx class does not provide any means to ellegantly close the IO stream after the end of it's usage, which prevents deleting files or moving them somewhere else.

Here is a proposal to add a close() method and a context manager.

hugh2632 commented 3 years ago

p = pdfx.PDFx(filename). After all, you can call p.stream.close()