{"id":30035027,"url":"https://github.com/streamlit/streamlit-pdf","last_synced_at":"2025-10-29T08:34:10.259Z","repository":{"id":308619759,"uuid":"1028655215","full_name":"streamlit/streamlit-pdf","owner":"streamlit","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-06T23:04:10.000Z","size":111,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T23:36:33.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamlit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-29T21:27:12.000Z","updated_at":"2025-08-06T23:04:14.000Z","dependencies_parsed_at":"2025-08-06T23:36:48.565Z","dependency_job_id":"4317fa1b-a589-45e3-b08c-2a452f54692f","html_url":"https://github.com/streamlit/streamlit-pdf","commit_stats":null,"previous_names":["streamlit/streamlit-pdf"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/streamlit/streamlit-pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fstreamlit-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fstreamlit-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fstreamlit-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fstreamlit-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamlit","download_url":"https://codeload.github.com/streamlit/streamlit-pdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fstreamlit-pdf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269181055,"owners_count":24373853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-07T01:00:41.563Z","updated_at":"2025-10-29T08:34:05.216Z","avatar_url":"https://github.com/streamlit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# streamlit-pdf\n\nA lightweight **Streamlit** feature that seamlessly displays **PDF** files in your apps, allowing for simple, responsive, and clean document viewing with minimal effort.\n\n---\n\n## 📦 Installation\n\n```bash\npip install streamlit[pdf]\n```\n\nEnsure you have **Streamlit** installed:\n\n---\n\n## 💡 Usage\n\nHere's how to display a PDF file in your Streamlit app:\n\n```python\nimport streamlit as st\n\n# Display PDF from URL\nst.pdf(\"https://example.com/document.pdf\")\n\n# Display with custom height\nst.pdf(\"path/to/document.pdf\", height=600)\n\n# Display uploaded file\nuploaded_file = st.file_uploader(\"Choose a PDF file\", type=\"pdf\")\nif uploaded_file is not None:\n    st.pdf(uploaded_file)\n```\n\n---\n\n## ⚙️ API Reference\n\n### `st.pdf(data, height=600)`\n\n#### Parameters:\n\n- **`data`** (_str | Path | bytes | BytesIO_): The PDF file to show. This can be one of the following:\n\n  - A URL (string) for a hosted PDF file (`\"https://example.com/doc.pdf\"`)\n  - A path to a local PDF file (`\"./documents/sample.pdf\"`)\n  - A file-like object, e.g. a file opened with `open` or an `UploadedFile` returned by `st.file_uploader`\n  - Raw bytes data\n\n- **`height`** (_int_, optional): Height of the PDF viewer in pixels. Default: 600\n\n---\n\n## 🖼️ Examples\n\n### Basic PDF Display\n\n```python\nimport streamlit as st\n\nst.title(\"PDF Viewer Example\")\n\n# Display a PDF from URL\nst.pdf(\"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf\")\n```\n\n### File Upload with PDF Display\n\n```python\nimport streamlit as st\n\nst.title(\"Upload and View PDF\")\n\nuploaded_file = st.file_uploader(\"Choose a PDF file\", type=\"pdf\")\nif uploaded_file is not None:\n    st.pdf(uploaded_file)\n```\n\n### Custom Height\n\n```python\nimport streamlit as st\n\n# Display PDF with specific height\nst.pdf(\"document.pdf\", height=800)\n\n# Display PDF with default height\nst.pdf(\"document.pdf\")\n```\n\n### Reading from Local File\n\n```python\nimport streamlit as st\n\nwith open(\"document.pdf\", \"rb\") as file:\n    st.pdf(file.read(), height=700)\n```\n\n---\n\n## 📝 Contributing\n\nFeel free to file issues in [our Streamlit Repository](https://github.com/streamlit/streamlit/issues/new/choose).\n\nContributions are welcome 🚀, however, please inform us before building a feature.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamlit%2Fstreamlit-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamlit%2Fstreamlit-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamlit%2Fstreamlit-pdf/lists"}