SciTeX Rich PDF
Rich PDF is the SciTeX browser component for PDF regions, comments, and a synchronized feed. A host application supplies document access, feed content, and actions. The SciTeX SDK supplies PDF rendering and coordinate transforms. Live Paper supplies scientific content and actions through those ports.
Installation
Install the published wheel with pip install scitex-rich-pdf. Use the
directory printed by the following command as an npm file dependency.
python -c 'from scitex_rich_pdf import get_frontend_package_dir; print(get_frontend_package_dir())'
The browser package uses a compatible @scitex/sdk version from the host.
Quick start
Import createRichPdfViewer from @scitex/rich-pdf and supply the SDK
renderer, a container, and ports.documents.resolve. Add feedContainer
and ports.feed.list to show feed entries. Use overlayId to link an
entry to a named PDF region. Call load with a document key and
destroy when the host removes the viewer.
import { createPdfViewer } from "@scitex/sdk/ui/pdf-viewer";
import { createRichPdfViewer } from "@scitex/rich-pdf";
import "@scitex/rich-pdf/pdf-provider.css";
// Supply a PDF.js instance and the worker URL from the host application.
export async function mountExample({ container, feedContainer, pdfUrl, rendererOptions }) {
const viewer = createRichPdfViewer({
container,
feedContainer,
createPdfViewer,
rendererOptions,
ports: {
documents: { resolve: (revision) => ({ id: revision, src: pdfUrl }) },
feed: { list: () => [{ id: "note", label: "Reading note" }] },
},
});
await viewer.load("example-v1");
return viewer;
}
Python API
- scitex_rich_pdf.get_frontend_package_dir() Path
Return the installed directory usable as an npm file dependency.