{"id":26919212,"url":"https://github.com/pdf-viewer-react/react-pdf","last_synced_at":"2025-07-27T02:08:42.879Z","repository":{"id":284663433,"uuid":"891846655","full_name":"pdf-viewer-react/react-pdf","owner":"pdf-viewer-react","description":"React PDF is a lightweight, feature-rich PDF viewer for React applications. Powered by PDF.js, it offers seamless integration for rendering and interacting with PDF documents. With customizable toolbars, search, and smooth navigation, it’s designed to deliver a professional PDF viewing experience tailored to your needs.","archived":false,"fork":false,"pushed_at":"2025-07-01T03:19:23.000Z","size":84,"stargazers_count":9,"open_issues_count":10,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T04:26:05.853Z","etag":null,"topics":["javascript","nextjs","pdf-viewer","pdf-viewer-react","pdfjs","pdfjs-dist","react","react-pdf","react-pdf-viewer","reactjs","typescript"],"latest_commit_sha":null,"homepage":"https://www.react-pdf.dev/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdf-viewer-react.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-21T03:56:48.000Z","updated_at":"2025-07-01T03:19:26.000Z","dependencies_parsed_at":"2025-03-27T03:23:23.969Z","dependency_job_id":"f1cc131d-34d6-4d57-982d-15901d90a4ce","html_url":"https://github.com/pdf-viewer-react/react-pdf","commit_stats":null,"previous_names":["pdf-viewer-react/react-pdf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pdf-viewer-react/react-pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Freact-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Freact-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Freact-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Freact-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdf-viewer-react","download_url":"https://codeload.github.com/pdf-viewer-react/react-pdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Freact-pdf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267285616,"owners_count":24064198,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nextjs","pdf-viewer","pdf-viewer-react","pdfjs","pdfjs-dist","react","react-pdf","react-pdf-viewer","reactjs","typescript"],"created_at":"2025-04-01T21:30:40.970Z","updated_at":"2025-07-27T02:08:42.852Z","avatar_url":"https://github.com/pdf-viewer-react.png","language":"CSS","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.react-pdf.dev/\" target=\"_blank\"\u003e\n    \u003cpicture\u003e\n      \u003csource srcset=\"./assets/img/react-pdf_cover.webp\" width=\"100%\"\u003e\n      \u003cimg alt=\"React PDF\" src=\"./assets/img/react-pdf_cover.webp width=\"100%\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\n  Works seamlessly on your React.js websites. Fast, Customizable and Web Responsive PDF viewer. Save you weeks of development time.\n\u003c/div\u003e  \n\u003cbr/\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n  [React PDF Home][reactpdf] - [License](#page_facing_up-license) - [Documentation][reactpdf-docs]\n\n[![NPM Version](https://img.shields.io/npm/v/%40pdf-viewer%2Freact)][npm]\n[![Twitter](https://img.shields.io/twitter/follow/ReactPDF?label=ReactPDF\u0026style=social)][twitter]\n\n\u003c/div\u003e\n\n# :star: Why React PDF\n\n- **Save Weeks of Development Time**: React PDF simplifies PDF integration with ready-to-use tools, minimizing the need for custom development and saving you valuable time.\n- **Tailored for React.js**: React PDF is native to React.js, ensuring smooth integration into your projects.\n- **Customizability at Its Core**: Built with flexibility in mind, allowing you to match your application’s unique style and functionality.\n- **High-Performance \u0026 Rapid Rendering**: Optimized for rendering large PDFs efficiently, React PDF delivers lightning-fast load times with features like virtual scrolling.\n- **Accessibility**: Designed with inclusivity in mind, React PDF supports ARIA attributes, catering to diverse user bases.\n- **Modern Browser Compatibility**: Works seamlessly across modern browsers, eliminating compatibility headaches.\n- **Active Development \u0026 Support**: With regular updates and a responsive support team, React PDF evolves to meet developer needs.\n\n# 📜 Background\n\nAs developers ourselves, we faced many issues such as browser incompatibility and customizability while trying to render a PDF document or working with PDF libraries. Having faced issues using PDF libraries, we want the solution to be flexible for React.js developers and teams. More importantly, the technical document must be easy to use!\n\n# :sparkles: Features\n\n- 🎯 **Interactive \u0026 Immersive Viewing Experience** with features like rotation, zoom, and keyboard navigation.\n- 📱 **Responsive Across All Devices** for a consistent experience on desktops, tablets and mobile devices.\n- 🎨 **Customizable UI and Styling** to tailor the viewer’s appearance to match your website’s theme.\n- 🧭 **Advanced Navigation Options** to browse documents easily with table of contents, hyperlinks, and a powerful search tool.\n- ⚡ **High-Performance Rendering** to load large PDF documents quickly and handle complex elements like vector graphics with ease.\n- 🔧 **Programmatic Control with Hooks and Props**, allowing you to interact with the viewer programmatically.\n- 📂 **Document Management Tools**, including features like downloading and printing.\n- 👁️ **Accessibility Support** to built-in support for ARIA attributes and tooltips, catering to diverse user bases.\n\nFor the full feature set, visit [React PDF Features](https://www.react-pdf.dev/features?utm_source=github).\n\n# :zap: Quick Start Guide\n\nHere’s how to get started with React PDF in your React.js project:\n\n## 1. Check Prerequsities\n\nHere are the basic system requirements to run the React PDF component:\n\n- React version: \u003e= 18.0\n\nIf you are working with a React framework such as Next and Gatsby, React PDF can run smoothly as long as you are using React 18 and above.\n\nReact PDF viewer also works well with other React.js UI libraries such as MUI, Ant Design and Chakra UI.\n\nAlthough React PDF can run on most JavaScript module bundlers, it is more vigorously tested on Vite and Webpack.\n\n_Remark: \u003cbr/\u003e- If using TypeScript, it requires \u003e= TypeScript 4.6._\n\n### Browser support\n\n| Chrome | Firefox | Edge | Safari | Safari iOS | Chrome Android |\n| ------ | ------- | ---- | ------ | ---------- | -------------- |\n| 115+   | 115+    | 115+ | 16.5+  | 16.5+      | 126+           |\n\n## 2. Install the Package\n\nThere are a few ways you can install React PDF, namely `bun`, `npm`, `pnpm` or `yarn`.\n\n### Using bun:\n\n```bash\nbun add @pdf-viewer/react\n```\n\n##### Caching of previous Worker version with `bun`\n\nTo clear cache, try running `bun pm cache rm` to remove cache in the global cache directory. If the error remains, try executing the following steps:\n\n```shell\nrm bun.lockb\nrm -R node_modules\n```\n\n### Using npm:\n\n```bash\nnpm install @pdf-viewer/react\n```\n\n### Using yarn:\n\n```bash\nyarn add @pdf-viewer/react\n```\n\n### Using pnpm:\n\n```bash\npnpm add @pdf-viewer/react\n```\n\nFor more information on how to use different package managers, please visit our [installation guide](https://docs.react-pdf.dev/introduction/getting-started.html#installation?utm_source=github).\n\n## 3. Import and Use the Component\n\nThe following structure demonstrates how to build a React PDF viewer by importing and assembling components. This modular approach gives you the flexibility to customize the viewer as needed.\n\n```tsx\n  \u003cRPConfig\u003e               {/* Configuration license and pdfjs-dist worker */}\n    \u003cRPProvider\u003e           {/* Viewer context provider */}\n      \u003cRPTheme\u003e            {/* Theme customization (optional) */}\n        \u003cRPDefaultLayout\u003e  {/* Default layout container */}\n          \u003cRPPages /\u003e      {/* PDF pages renderer */}\n        \u003c/RPDefaultLayout\u003e\n      \u003c/RPTheme\u003e\n    \u003c/RPProvider\u003e\n  \u003c/RPConfig\u003e\n```\n\n_Remark: For more information on each component, please refer to [Component](https://docs.react-pdf.dev/components/overview?utm_source=github)._\n\n### Basic Usage\n\nThe most basic usage of React PDF viewer needs four components, namely: `RPConfig`, `RPProvider`, `RPDefaultLayout`, and `RPPages`.\n\nHere's how to implement a basic PDF viewer in a React application:\n\n```jsx\nimport { RPProvider, RPDefaultLayout, RPPages, RPConfig } from '@pdf-viewer/react'\n\nconst App = () =\u003e {\n  return (\n    \u003cRPConfig\u003e\n      \u003cRPProvider src=\"https://cdn.codewithmosh.com/image/upload/v1721763853/guides/web-roadmap.pdf\"\u003e\n        \u003cRPDefaultLayout style={{ height: '660px' }}\u003e\n          \u003cRPPages /\u003e\n        \u003c/RPDefaultLayout\u003e\n      \u003c/RPProvider\u003e\n    \u003c/RPConfig\u003e\n  )\n}\nexport default App\n```\n\nThe PDF viewer will automatically adjust to fit its container's dimensions. You can control the size by setting the `style` prop on `RPDefaultLayout`. For more information on using React PDF, visit our [basic usage guide](https://docs.react-pdf.dev/introduction/basic-usage?utm_source=github)\n\nYou may also check out our [Starter Toolkit](#pushpin-starter-toolkit) for examples to get you started.\n\n### 4. Customize with Hooks and Props\n\nTo enhance React PDF further, we offer built-in hooks and props that let you fine-tune functionality, adjust appearance, and integrate custom behaviors into your application.\n\nFor detailed usage, refer to our [Documentation][reactpdf-docs].\n\n# :pushpin: Starter Toolkit\n\nHere are some sample projects to get started on React PDF quickly:\n\n1. [React (webpack) - JavaScript](https://github.com/pdf-viewer-react/starter-rp-react-js-webpack)\n2. [React (webpack) - TypeScript](https://github.com/reactpdf/pdf-viewer-react/starter-rp-react-ts-webpack)\n3. [React (vite) - JavaScript](https://github.com/pdf-viewer-react/starter-rp-react-js-vite)\n4. [React (vite) - TypeScript](https://github.com/pdf-viewer-react/starter-rp-react-ts-vite)\n6. [Next - JavaScript](https://github.com/pdf-viewer-react/starter-rp-next-js)\n7. [Next - TypeScript](https://github.com/pdf-viewer-react/starter-rp-next-ts)\n\n# :raising_hand: Need Help?\n\nWe are more than happy to help you. If you have any questions, run into any errors or face any problems, please feel free to create an issue in [Issues](../../issues) or PM us directly in [Twitter][twitter]. Anything related to React PDF is on the table!\n\n# :page_facing_up: License\n\nReact PDF is distributed under our proprietary license. Please refer to our [License page](https://www.react-pdf.dev/license-agreement?utm_source=github) file for more details.\n\nIf you would like to use React PDF commercially, please purchase a license from [our website][reactpdf] or reach out to us directly at [david@react-pdf.dev](mailto:david@react-pdf.dev).\n\n# Acknowledgement\n\n- [pdf.js](https://github.com/mozilla/pdf.js)\n- [Img Shields](https://shields.io)\n- [React.js](https://reactjs.org/)\n\n[reactpdf]: https://www.react-pdf.dev\n[reactpdf-docs]: https://docs.react-pdf.dev\n[npm]: https://www.npmjs.com/package/@pdf-viewer/react\n[twitter]: https://www.x.com/ReactPDF\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdf-viewer-react%2Freact-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdf-viewer-react%2Freact-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdf-viewer-react%2Freact-pdf/lists"}