{"id":24662,"library":"streamlit-pdf","title":"Streamlit PDF Viewer","description":"A Streamlit custom component that renders PDF files directly in the browser. Version 2.0.1 supports embedded viewing, page navigation, and zoom controls. Maintained by the community with monthly releases.","status":"active","version":"2.0.1","language":"python","source_language":"en","source_url":"https://github.com/streamlit-pdf/streamlit-pdf","tags":["streamlit","pdf","component","viewer"],"install":[{"cmd":"pip install streamlit-pdf","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required to run the component as a Streamlit app","package":"streamlit","optional":false}],"imports":[{"note":"Correct import path for version 2.x","symbol":"st_pdf","correct":"from streamlit_pdf import st_pdf"}],"quickstart":{"code":"import streamlit as st\nfrom streamlit_pdf import st_pdf\n\nst.title(\"PDF Viewer\")\n\n# Example: load PDF from URL\npdf_url = \"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf\"\n\n# Or from local file: open('example.pdf', 'rb')\nst_pdf(pdf_url, width=700, height=900)","lang":"python","description":"Minimal example to display a PDF from a URL."},"warnings":[{"fix":"Replace `from streamlit_pdf import render_pdf` with `from streamlit_pdf import st_pdf`.","message":"Version 2.x majorly changed the API. The function `render_pdf` from 1.x is removed. Use `st_pdf` instead.","severity":"breaking","affected_versions":"<=1.x"},{"fix":"Use `open('file.pdf', 'rb').read()` for local files or a string URL.","message":"Local file paths must be passed as bytes or as a string path. If you pass a string URL, it is fetched; if you pass a Path object, it may fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Apply custom CSS via `st.markdown` or use Streamlit's `st.columns` to control layout.","message":"The `height` parameter in version 2.x might be ignored in some Streamlit builds; use CSS styling instead.","severity":"deprecated","affected_versions":"2.0.0 - 2.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install streamlit-pdf` and ensure import uses underscore: `from streamlit_pdf import st_pdf`","cause":"Old import path `streamlit-pdf` used in code, but the module is `streamlit_pdf` (underscore) or package not installed.","error":"ModuleNotFoundError: No module named 'streamlit_pdf'"},{"fix":"Upgrade to v2.0.1: `pip install --upgrade streamlit-pdf` and use `from streamlit_pdf import st_pdf`","cause":"Version 2.x removed `render_pdf`. Using v1.x syntax.","error":"ImportError: cannot import name 'render_pdf' from 'streamlit_pdf'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}