Skip to main content
This guide walks you through installing RAG PDF Highlighter, starting the local server, and sending your first request to get back a highlighted PDF — all in under five minutes. You only need a terminal, Python 3.10 or later, and a publicly accessible PDF URL to follow along.
1

Install the package

Install RAG PDF Highlighter from PyPI using pip. All runtime dependencies are pulled in automatically.
pip install rag-pdf-highlighter
2

Start the server

Launch the FastAPI service with Uvicorn. The server will be available at http://localhost:8000 by default.
uvicorn rag_pdf_highlighter.main:app --host 0.0.0.0 --port 8000
You should see Uvicorn report that it is running. You can confirm the service is healthy by visiting http://localhost:8000/ in your browser or with curl — it returns {"status": "ok the app is running"}.
3

Make your first request

Send a POST request to /highlight with a PDF URL and the list of document chunks you want to highlight. Choose your preferred approach:
curl -X POST http://localhost:8000/highlight \
  -H "Content-Type: application/json" \
  -d '{
    "pdf_url": "https://example.com/document.pdf",
    "documents": [
      {
        "page_content": "The quick brown fox jumps over the lazy dog",
        "metadata": {"page": 0}
      }
    ]
  }' \
  --output highlighted.pdf
Page numbers in metadata.page are 0-indexed, so the first page of a PDF is 0, the second is 1, and so on. If you omit the page key, RAG PDF Highlighter searches the entire document for the chunk.
4

Save the highlighted PDF

The /highlight endpoint returns the annotated PDF as a raw binary response with content-type application/pdf. Write the response body directly to a file to save it.If you used curl, the --output highlighted.pdf flag already handled this for you. If you used the Python requests example above, the file is written via response.content. Open highlighted.pdf in any PDF viewer and you will see your text chunk highlighted in yellow on the page you specified.