pdf for Dash
Project description
Dash PDF
Display PDFs in your Dash apps.
Made by Ploomber with ❤️
Deploy your Dash application on Ploomber.io for free.
https://github.com/user-attachments/assets/bcc9ba7d-5110-4fb9-ba58-551684890ae9
Live demo: dash-pdf.ploomberapp.io
Installation
pip install dash-pdf
Usage
from dash import Dash, html
import dash_pdf
import requests
from pathlib import Path
import dash
dash._dash_renderer._set_react_version("18.2.0")
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.PDF(
id='pdf-viewer',
# Pass the PDF content as bytes, you can also pass a URL
data=pdf_bytes,
# use these to customize the class names
buttonClassName="",
labelClassName="",
controlsClassName="",
)
])
if __name__ == '__main__':
app.run_server(debug=True)
Run demo locally
cd demo
pip install -r requirements.txt
python app.py
Open: http://localhost:8050
Documentation
Setup
# install js dependencies
npm install
# install python package in editable mode
pip install -e .
# install other python dependencies
pip install -r requirements.txt
pip install -r tests/requirements.txt
Development
npm run build
python demo.py
Release
# generate
npm run build
python setup.py sdist bdist_wheel
ls dist
# test artifact
pip install dash dist/dash_pdf-0.0.1.tar.gz
python demo/app.py
# upload
pip install twine
twine upload dist/*
# clean up
rm -rf dist
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 dash_pdf-0.0.1.tar.gz.
File metadata
- Download URL: dash_pdf-0.0.1.tar.gz
- Upload date:
- Size: 399.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94e9de3ef1e3560919bf1e306405c5c9c649ed482fd1b7b8e5fdfa226fa79400
|
|
| MD5 |
9c8277a578039a520ebe9692ce37ba82
|
|
| BLAKE2b-256 |
d921a71d6af431a39b68d1e767507cbadf52d283878bfc657152b20b58db5139
|
File details
Details for the file dash_pdf-0.0.1-py3-none-any.whl.
File metadata
- Download URL: dash_pdf-0.0.1-py3-none-any.whl
- Upload date:
- Size: 402.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a776e5e0828e1622b55a78cd4c1bedbb2ba7f2f6dc059cf64cbac7d7710d151c
|
|
| MD5 |
6ea76487b9d1f33010caa08091a2427d
|
|
| BLAKE2b-256 |
a3f68d899df76ad55517cc51c8f24a6d4e46f66097b35c7a3948deaa1412df28
|