Toggle Menu
Prev Up Next

# `langchain_community.document_loaders.parsers.pdf`.PyMuPDFParser

class langchain_community.document_loaders.parsers.pdf.PyMuPDFParser(text_kwargs: Optional[Mapping[str, Any]] = None, extract_images: bool = False)

  Parse PDF using PyMuPDF.

  Initialize the parser.

  Parameters

    - text_kwargs (Optional[Mapping[str, Any]]) – Keyword arguments to pass to `fitz.Page.get_text()`.

    - extract_images (bool) –

  Methods

  `__init__`([text_kwargs, extract_images]) | Initialize the parser.
  `lazy_parse`(blob) | Lazily parse the blob.
  `parse`(blob) | Eagerly parse the blob into a document or documents.

  __init__(text_kwargs: Optional[Mapping[str, Any]] = None, extract_images: bool = False) → None

    Initialize the parser.

    Parameters

      - text_kwargs (Optional[Mapping[str, Any]]) – Keyword arguments to pass to `fitz.Page.get_text()`.

      - extract_images (bool) –

    Return type

      None

  lazy_parse(blob: Blob) → Iterator[Document]

    Lazily parse the blob.

    Parameters

      blob (Blob) –

    Return type

      Iterator[Document]

  parse(blob: Blob) → List[Document]

    Eagerly parse the blob into a document or documents.

    This is a convenience method for interactive development environment.

    Production applications should favor the lazy_parse method instead.

    Subclasses should generally not over-ride this parse method.

    Parameters

      blob (Blob) – Blob instance

    Returns

      List of documents

    Return type

      List[Document]