st.pdf
Display a PDF viewer.
Important
You must install streamlit-pdf to use this command. You can install it as an extra with Streamlit:
pip install streamlit[pdf]
| Function signature[source] | |
|---|---|
st.pdf(data, *, height=500, key=None, alt=None) | |
| Parameters | |
data (str, Path, BytesIO, or bytes) | The PDF file to show. This can be one of the following:
|
height (int or "stretch") | The height of the PDF viewer. This can be one of the following:
|
key (str or None) | An optional string to use for giving this element a stable identity. If this is None (default), the element's identity will be determined based on the values of the other parameters. |
alt (str or None) | A short, plain-text accessible name for the PDF viewer. If this is None (default), the viewer has no accessible name. An empty or whitespace-only string is treated the same as None and is logged so authors notice the dual meaning of alt="" across commands (decorative only on st.image / st.pyplot). Describe what the document is rather than repeating text that is already visible on the page. This names the viewer for assistive technologies; it is not a full text alternative for the PDF's contents. |
Examples
st.pdf("https://example.com/sample.pdf")
st.pdf("https://example.com/sample.pdf", height=600)
st.pdf("report.pdf", alt="Q3 2026 financial report")
Tip
Want a new st.pdf feature or found a bug? Browse open issues and react with a 👍 on the initial post of the ones that matter to you. Your votes help us prioritize what to work on next.
Still have questions?
Our forums are full of helpful information and Streamlit experts.