Reflex custom component pdf-viewer
Project description
Reflex PDF Viewer
A powerful and easy-to-use PDF viewer component for Reflex applications. Built on top of react-pdf, it provides seamless PDF viewing capabilities with full control over navigation, zoom, and display options.
📦 Installation
pip install reflex-pdf-viewer
🚀 Quick Start
import reflex as rx
from reflex_pdf_viewer import Document, Page
class State(rx.State):
current_page: int = 1
n_pages: int = 1
@rx.event
def load_success(self, info: dict):
self.n_pages = info.get("numPages", 1)
def index():
return rx.vstack(
rx.heading("Reflex pdf preview", size="8"),
Document.create(
Page.create(page_number=State.current_page),
file="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
on_load_success=State.load_success,
),
)
app = rx.App()
app.add_page(index)
Don't forget to add the frontend package to your rxconfig.py:
import reflex as rx
config = rx.Config(
app_name="your_app",
frontend_packages=[
"react-pdf@10.1.0", # Required for PDF viewing
],
)
📝 Changelog
v0.0.1 (2025-12-09)
- Initial release
- Basic PDF viewing functionality
- Page navigation support
- Zoom controls
- Error handling
- Loading states
v0.0.2 (2025-11-01)
- Added loading prop to avoid failed to load pdf issue
🐛 Issues & Support
If you encounter any issues or have questions:
- Check the GitHub Issues
- Join the Reflex Discord community
- Create a new issue with detailed information
🙏 Acknowledgments
- Built with Reflex - The web framework for Python
- Powered by react-pdf - React PDF viewer component
- Uses PDF.js - JavaScript PDF rendering engine
Made with ❤️ for the Reflex community
Star ⭐ this repo if you find it useful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reflex_pdf_viewer-0.0.3.tar.gz.
File metadata
- Download URL: reflex_pdf_viewer-0.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2cc7451a775bcef5b42e19a52cca2bfd1f064a698ab94c28b8595d55850fbd0
|
|
| MD5 |
63b6f46537f4041c936cca6abfebd45b
|
|
| BLAKE2b-256 |
c09cda498a65c5c66a5fa4f7ae1d9a44218a4fa8f41070da188c9ffd67489608
|
File details
Details for the file reflex_pdf_viewer-0.0.3-py3-none-any.whl.
File metadata
- Download URL: reflex_pdf_viewer-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fd70775e6c27ec64b94e9f81ffa5b3f0102680ff9238a306332143d6ff81c1b
|
|
| MD5 |
b5ca9c1bd152de3fe733f8c5cae5c145
|
|
| BLAKE2b-256 |
4563bbd2bf3147bd55b2d5ad22151eead0e70e7f578ec563b041a1ef55b07b6c
|