react-pdfjs-dist
v1.0.1
Published
A lightweight React library for rendering PDF documents in HTML using PDF.js
Maintainers
Readme
📄 react-pdfjs-dist
A lightweight React library for rendering PDF documents in HTML using PDF.js
✨ Features
- 🧩 Easy integration with React
- ⚡ Fast rendering using PDF.js
- 🖼️ Display PDFs directly in your HTML containers
- 🪶 Lightweight and dependency-minimal
📦 Installation
Install using npm:
npm install --save react-pdfjs-distOr with Yarn:
yarn add react-pdfjs-dist🚀 Quick Start
Here’s a basic example to render a PDF in your React component:
import React, { useEffect, useRef } from 'react';
import { useReactPdf } from 'react-pdfjs-dist';
const App = () => {
const ref = useRef(null);
const { renderPdf } = useReactPdf({ containerRef: ref });
useEffect(() => {
renderPdf('http://localhost:3000/sample_document.pdf');
}, [renderPdf]);
return (
<div className="App">
<div className="pdf-container" ref={ref} />
</div>
);
};
export default App;📚 Documentation
Full documentation is coming soon. For now, check out the example code above or dive into the source code on GitHub.
🤝 Contributing
Pull requests, issues, and feature requests are welcome! Feel free to check the issues page.
❤️ Support
If you find this project helpful, consider donating via PayPal 🙏
📝 License
This project is licensed under the MIT License.
