dash-pdf-components
Lightweight React-PDF rendering components for Plotly Dash.
uv add dash-pdf-components
For the common single-page viewer, use PDF:
import dash_pdf_components as dpc
dpc.PDF(
id="pdf",
file="/assets/document.pdf",
pageNumber=1,
width=720,
)
PDF combines document loading and one rendered page. Navigation controls can update PDF.pageNumber, PDF.scale, and PDF.rotate; callbacks can read PDF.numPages, PDF.loadProgress, PDF.pageData, PDF.renderData, and PDF.errorData from the same component.
API
Use the smallest API that fits the layout:
| Component | Use case |
|---|---|
PDF |
Default single-page viewer and callback target |
Document |
Shared PDF context for custom or continuous layouts |
Page |
One page inside Document |
Thumbnail |
Clickable page preview inside Document |
Outline |
PDF table of contents inside Document |
PDF accepts the commonly used React-PDF options directly: file, pageNumber, width, height, scale, rotate, renderTextLayer, renderAnnotationLayer, renderForms, loading, error, and noData. Advanced PDF.js loading options remain available through options, assetBaseUrl, and workerSrc.
Use the composable API only when the layout needs multiple pages, thumbnails, or an outline:
dpc.Document(
[
dpc.Outline(),
dpc.Thumbnail(pageNumber=1, width=120),
dpc.Page(pageNumber=1),
dpc.Page(pageNumber=2),
],
file="/assets/document.pdf",
)
The package intentionally has no toolbar, theme system, locale system, or Ant Design dependency. Build navigation, zoom, rotation, and download controls with ordinary Dash components. See usage.py for a complete example.
React-PDF uses PDF.js internally. The matching Worker, character maps, standard fonts, WASM, ICC profiles, and annotation images load from this package by default. Set assetBaseUrl on PDF or Document to replace them with a version-matched CDN:
dpc.PDF(
file="/assets/document.pdf",
assetBaseUrl="https://registry.npmmirror.com/pdfjs-dist/5.4.296/files/",
)
workerSrc, imageResourcesPath, and individual options values such as cMapUrl, standardFontDataUrl, wasmUrl, and iccUrl override the defaults. These options are also available on Document.
Internal PDF links navigate automatically. PDF and a single rendered Page switch to the destination page, while documents rendering multiple pages scroll to the mounted destination. itemClickData remains available for observing navigation.
Development
pnpm install
uv sync
pnpm build
uv build --no-sources
Release files for dash-pdf-components 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dash_pdf_components-0.1.0.tar.gz | 2.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dash_pdf_components-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.4 MB
Release files / dash_pdf_components-0.1.0.tar.gz
| Download URL | dash_pdf_components-0.1.0.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0cad52903eb62f804c0965ca4c77e2188b7b99f4ae0270cca0dd14575ad966e
|
|
BLAKE2b-256 checksum How to use checksums |
2f4b96247a538272196c9391c9757a0723f94bdecb49053d6a1ac601f9bfd0d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dash_pdf_components-0.1.0-py3-none-any.whl
| Download URL | dash_pdf_components-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a21a60f65303f8676d3c211679baf74583e44b47ffe7224ccefb72bbe088c7e9
|
|
BLAKE2b-256 checksum How to use checksums |
0579d9782a20467d6753490057ad321084f506a9b84ad7619c5a84c6a04a9733
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|