react-pdfjs-dist
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

📄 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-dist

Or 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.


Package Sidebar

Install

npm i react-pdfjs-dist

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

9.95 kB

Total Files

8

Last publish

Collaborators

  • praveenkumar-kalidass