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
Metadata
Release files for dash-pdf 0.0.1
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-0.0.1.tar.gz | 399.0 kB | Without provenance | Details for dash_pdf-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dash_pdf-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for dash_pdf-0.0.1-py3-none-any.whl |
Total release size: 801.0 kB
Release files / dash_pdf-0.0.1.tar.gz
| Download URL | dash_pdf-0.0.1.tar.gz |
|---|---|
| Size | 399.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94e9de3ef1e3560919bf1e306405c5c9c649ed482fd1b7b8e5fdfa226fa79400
|
|
BLAKE2b-256 checksum How to use checksums |
d921a71d6af431a39b68d1e767507cbadf52d283878bfc657152b20b58db5139
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.10
|
Release files / dash_pdf-0.0.1-py3-none-any.whl
| Download URL | dash_pdf-0.0.1-py3-none-any.whl |
|---|---|
| Size | 402.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a776e5e0828e1622b55a78cd4c1bedbb2ba7f2f6dc059cf64cbac7d7710d151c
|
|
BLAKE2b-256 checksum How to use checksums |
a3f68d899df76ad55517cc51c8f24a6d4e46f66097b35c7a3948deaa1412df28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.10
|
Security for dash-pdf 0.0.1
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.