Skip to main content

streamlit-pdf

A lightweight Streamlit feature that seamlessly displays PDF files in your apps, allowing for simple, responsive, and clean document viewing with minimal effort.


📦 Installation

pip install streamlit[pdf]

Ensure you have Streamlit installed:


💡 Usage

Here's how to display a PDF file in your Streamlit app:

import streamlit as st

# Display PDF from URL
st.pdf("https://example.com/document.pdf")

# Display with custom height
st.pdf("path/to/document.pdf", height=600)

# Display uploaded file
uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
if uploaded_file is not None:
    st.pdf(uploaded_file)

⚙️ API Reference

st.pdf(data, height=600)

Parameters:

  • data (str | Path | bytes | BytesIO): The PDF file to show. This can be one of the following:

    • A URL (string) for a hosted PDF file ("https://example.com/doc.pdf")
    • A path to a local PDF file ("./documents/sample.pdf")
    • A file-like object, e.g. a file opened with open or an UploadedFile returned by st.file_uploader
    • Raw bytes data
  • height (int, optional): Height of the PDF viewer in pixels. Default: 600


🖼️ Examples

Basic PDF Display

import streamlit as st

st.title("PDF Viewer Example")

# Display a PDF from URL
st.pdf("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")

File Upload with PDF Display

import streamlit as st

st.title("Upload and View PDF")

uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
if uploaded_file is not None:
    st.pdf(uploaded_file)

Custom Height

import streamlit as st

# Display PDF with specific height
st.pdf("document.pdf", height=800)

# Display PDF with default height
st.pdf("document.pdf")

Reading from Local File

import streamlit as st

with open("document.pdf", "rb") as file:
    st.pdf(file.read(), height=700)

📝 Contributing

Feel free to file issues in our Streamlit Repository.

Contributions are welcome 🚀, however, please inform us before building a feature.

Development flow

Prerequisites:

uv venv .venv
source .venv/bin/activate
uv pip install -e '.[with-streamlit]' .
cd streamlit_pdf/frontend && npm install
  • Build the frontend once:
    npm run build
    
  • Or run the frontend in watch/development mode:
    npm run dev
    

Metadata

Release files for streamlit-pdf 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-pdf 2.1.0
File Size Uploaded
streamlit_pdf-2.1.0.tar.gz 2.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-pdf 2.1.0
File Interpreter ABI Platform
streamlit_pdf-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.0 MB

Release files / streamlit_pdf-2.1.0.tar.gz

Download URL streamlit_pdf-2.1.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
2e2a79140335087517e83b024277750fb910d61fd24052d886c0def4f856fc2d
BLAKE2b-256 checksum
How to use checksums
dbeb2d4c6311874469102ee94e20152b775bae762644f4c628d54916daf5b51e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / streamlit_pdf-2.1.0-py3-none-any.whl

Download URL streamlit_pdf-2.1.0-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a5ba2e19571abab0254d5296499fa0fc508f1e66e6a2b3bb13e167037410067e
BLAKE2b-256 checksum
How to use checksums
305b310ff1c5cb48a70a8532b92c523b420a6906d693a2e00e11ef6f3a59dcc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page