MCPcopy Index your code
hub / github.com/mindee/doctr / from_url

Method from_url

doctr/io/reader.py:41–60  ·  view source on GitHub ↗

Interpret a web page as a PDF document >>> from doctr.io import DocumentFile >>> doc = DocumentFile.from_url("https://www.yoursite.com") Args: url: the URL of the target web page **kwargs: additional parameters to :meth:`pypdfium2.PdfPage.render`

(cls, url: str, **kwargs)

Source from the content-addressed store, hash-verified

39
40 @classmethod
41 def from_url(cls, url: str, **kwargs) -> list[np.ndarray]:
42 """Interpret a web page as a PDF document
43
44 >>> from doctr.io import DocumentFile
45 >>> doc = DocumentFile.from_url("https://www.yoursite.com")
46
47 Args:
48 url: the URL of the target web page
49 **kwargs: additional parameters to :meth:`pypdfium2.PdfPage.render`
50
51 Returns:
52 the list of pages decoded as numpy ndarray of shape H x W x 3
53 """
54 requires_package(
55 "weasyprint",
56 "`.from_url` requires weasyprint installed.\n"
57 + "Installation instructions: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation",
58 )
59 pdf_stream = read_html(url)
60 return cls.from_pdf(pdf_stream, **kwargs)
61
62 @classmethod
63 def from_images(cls, files: Sequence[AbstractFile] | AbstractFile, **kwargs) -> list[np.ndarray]:

Callers 1

test_document_fileFunction · 0.80

Calls 3

requires_packageFunction · 0.90
read_htmlFunction · 0.85
from_pdfMethod · 0.80

Tested by 1

test_document_fileFunction · 0.64