LLM plugin for loading text from PDF files (local or URL) using PyMuPDF.
Install this plugin in the same environment as LLM.
llm install llm-plugin-pdf
This plugin requires the PyMuPDF
and requests
packages.
This plugin adds support for the pdf:
fragment prefix. You can use it to load the full text content of a PDF from a local file path or a web URL.
# Load from a local file
llm fragment pdf:/path/to/your/document.pdf
# Load from a URL
llm fragment pdf:https://example.com/some-document.pdf
You can pipe the output to LLM commands:
llm fragment pdf:https://arxiv.org/pdf/2310.06825.pdf | llm -s "Summarize this PDF"
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-pdf
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
# Install in editable mode with test dependencies
python -m pip install -e '.[test]'
To run the tests:
pytest