PyPDFium2
Note that this module was formerly called bindings_pdfium. While you may still import from this module, the logic has since been moved to gmft.pdf_bindings.pdfium.
- class gmft.pdf_bindings.pdfium.PyPDFium2Document(filename: str)
Bases:
BasePDFDocumentWraps a pdfium.PdfDocument object. Note that you (the user) are responsible for calling doc.close() once you are done, otherwise the document will remain open and consume resources.
- close()
Close the document
- class gmft.pdf_bindings.pdfium.PyPDFium2Page(page: pypdfium2.PdfPage, filename: str, page_no: int, *, parent: PyPDFium2Document = None)
Bases:
BasePageNote: This follows PIL’s convention of (0, 0) being top left. Therefore, beware: y0 and y1 are flipped from PyPDFium2’s convention.
- close()
Not recommended: use close_document instead.
- close_document()
- class gmft.pdf_bindings.pdfium.PyPDFium2Utils
Bases:
objectHelper class for pypdfium2
- static load_page_from_dict(d: dict) BasePage
Helper method to load a BasePage from a serialized CroppedTable or TATRFormattedTable. This method reads a pdf from disk! You will need to close it manually! (through page.close_document())
ie. page.close_document()
- static reload(ct: CroppedTable, doc=None) Tuple['CroppedTable', 'PyPDFium2Document']
Reloads the
CroppedTablefrom disk. This is useful for aCroppedTablewhose document has been closed.- Parameters:
ct – The
CroppedTableto reload.doc – The
PyPDFium2Documentto reload from. If None, the document is loaded from disk.