Dash PDF Plus
Display and annotate PDFs in your Dash apps with enhanced features.
Features
- PDF Display: Render PDF documents directly in your Dash applications
- Interactive Annotations: Add comments, highlights, and rectangle annotations
- Navigation Controls: Navigate through PDF pages with built-in controls
- URL Loading: Load PDFs from URLs or local files
- Customizable UI: Customize button and control styling
Installation
pip install dash-pdf-plus
Usage
Basic PDF Display
import requests
from dash import Dash, html
import dash_pdf_plus
app = Dash(__name__)
# Download the PDF and read it as bytes
url = "https://css4.pub/2015/textbook/somatosensory.pdf"
response = requests.get(url)
pdf_bytes = response.content
# Alternatively, you can read a local PDF file
# pdf_bytes = Path('path/to/local/file.pdf').read_bytes()
app.layout = html.Div(
[
dash_pdf_plus.DashPDF(
id="pdf-viewer",
data=pdf_bytes,
enable_annotations=True,
selected_annotation_tool="none",
annotations=[],
),
]
)
if __name__ == "__main__":
app.run(debug=True)
Advanced Usage with Annotations
The demo application (demo/app.py) showcases advanced features including:
- Annotation Tools: Comment, rectangle, and highlight tools
- Interactive Controls: Load PDFs from URLs, navigate pages
- Real-time Updates: Handle annotation changes with callbacks
- Responsive Design: Bootstrap-based UI with resizable panels
Key features demonstrated:
- PDF loading from URLs
- Annotation tool selection (comment, rectangle, highlight, none)
- Page navigation controls
- Annotation change handling
- Responsive layout with control panel
Run Demo Locally
cd demo
uv venv
uv pip install -r requirements.txt
uv run app.py
Open: http://localhost:8060
Development Setup
# Install JavaScript dependencies
npm install
# Install Python package in editable mode
uv venv
uv pip install -e .
# Install other Python dependencies
uv pip install -r requirements.txt
uv pip install -r tests/requirements.txt
Development Workflow
# Build the component
npm run build
# Run the demo
uv run demo/app.py
Release Process
# Generate distribution files
rm -rf dist
npm run build
uv build
# Test the artifact
uv pip install dash dist/dash_pdf_plus-0.0.4.tar.gz
uv run demo/app.py
# Upload to PyPI
# uv pip install twine
# twine upload dist/*
# Or with UV
uv publish
# Clean up
rm -rf dist
Credits
This project is derived from the original dash-pdf implementation by Ploomber Inc.. We extend our gratitude to the original authors for their foundational work that made this enhanced version possible.
License
See LICENSE file for details.
Metadata
Release files for dash-pdf-plus 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dash_pdf_plus-0.0.5.tar.gz | 821.8 kB | Without provenance | Details for dash_pdf_plus-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dash_pdf_plus-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for dash_pdf_plus-0.0.5-py3-none-any.whl |
Total release size: 1.6 MB
Release files / dash_pdf_plus-0.0.5.tar.gz
| Download URL | dash_pdf_plus-0.0.5.tar.gz |
|---|---|
| Size | 821.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a82cbf9cac2e09a4d9147436688aa38c317de8f135b1699cf06ebed8aef85783
|
|
BLAKE2b-256 checksum How to use checksums |
8caa005d37968a82e1bee66c255aa16a88f19b88647678e4c60d30c8471f46c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Release files / dash_pdf_plus-0.0.5-py3-none-any.whl
| Download URL | dash_pdf_plus-0.0.5-py3-none-any.whl |
|---|---|
| Size | 826.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32ddae075afa18122df2006ac300b2ce0bc6c1aa70d52c784d6cdc4995de0292
|
|
BLAKE2b-256 checksum How to use checksums |
4ef64d4b5620a7dede01b07881e598d0ca156fca62cb52a1d60e3c35466589e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Security for dash-pdf-plus 0.0.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.