Read a PDF file >>> from doctr.io import DocumentFile >>> doc = DocumentFile.from_pdf("path/to/your/doc.pdf") Args: file: the path to the PDF file or a binary stream **kwargs: additional parameters to :meth:`pypdfium2.PdfPage.render` Returns
(cls, file: AbstractFile, **kwargs)
| 23 | |
| 24 | @classmethod |
| 25 | def from_pdf(cls, file: AbstractFile, **kwargs) -> list[np.ndarray]: |
| 26 | """Read a PDF file |
| 27 | |
| 28 | >>> from doctr.io import DocumentFile |
| 29 | >>> doc = DocumentFile.from_pdf("path/to/your/doc.pdf") |
| 30 | |
| 31 | Args: |
| 32 | file: the path to the PDF file or a binary stream |
| 33 | **kwargs: additional parameters to :meth:`pypdfium2.PdfPage.render` |
| 34 | |
| 35 | Returns: |
| 36 | the list of pages decoded as numpy ndarray of shape H x W x 3 |
| 37 | """ |
| 38 | return read_pdf(file, **kwargs) |
| 39 | |
| 40 | @classmethod |
| 41 | def from_url(cls, url: str, **kwargs) -> list[np.ndarray]: |