Package Exports
- kdf-tools
- kdf-tools/pdf.worker.min.js
Readme
@your-scope/pdf-tools
React components that bundle MinerU parsing and OSS multimedia workflows for PDF annotation experiences. The implementation ships exactly as used in the original project, so MinerU / OSS network requests remain inside each component.
Installation
ash npm install @your-scope/pdf-tools
Peer dependencies are eact, eact-dom, eact-pdf, and pdfjs-dist; make sure they are available in your host application.
Usage
`jsx import React from 'react'; import { KDFReader, KDFViewer } from '@your-scope/pdf-tools';
const Example = () => (
<>
<KDFReader file={{ id: '123', name: 'demo.pdf' }} />
export default Example; `
Both components automatically import the bundled stylesheet (./styles/pdf-tools.css). No additional setup is required beyond providing a ile prop consistent with the original project.
Building the library
ash npm run build
This runs Rollup and emits both CommonJS (dist/index.cjs.js) and ES Module (dist/index.esm.js) bundles, ready for publishing to npm.
Development notes
- The MinerU parsing endpoints and OSS upload logic remain embedded inside KDFReader.jsx and KDFViewer.jsx.
- Styles that used to live alongside the components have been centralized in src/styles/pdf-tools.css; both components import this file at the top.
- If you add new styles, keep them in the same stylesheet so consumers do not need extra CSS imports.
- Ensure your host app configures any required environment (e.g., MinerU backend URLs, authentication) expected by the original components.