{"id":25909089,"url":"https://github.com/pdf-viewer-react/starter-rp-react-ts-webpack","last_synced_at":"2025-07-17T22:37:15.778Z","repository":{"id":279939122,"uuid":"936418874","full_name":"pdf-viewer-react/starter-rp-react-ts-webpack","owner":"pdf-viewer-react","description":"React PDF Starter toolkit with React + TypeScript + Webpack","archived":false,"fork":false,"pushed_at":"2025-02-28T09:59:41.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-28T16:47:42.285Z","etag":null,"topics":["pdf-viewer","pdf-viewer-react","pdfjs","pdfjs-dist","react-pdf","react-pdf-viewer","reactjs","typescript","webpack"],"latest_commit_sha":null,"homepage":"https://www.react-pdf.dev","language":"TypeScript","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}},"created_at":"2025-02-21T03:47:01.000Z","updated_at":"2025-02-28T09:59:45.000Z","dependencies_parsed_at":"2025-02-28T16:53:53.956Z","dependency_job_id":"f5582496-67e8-47f5-a389-0977991c09a1","html_url":"https://github.com/pdf-viewer-react/starter-rp-react-ts-webpack","commit_stats":null,"previous_names":["pdf-viewer-react/starter-rp-react-ts-webpack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Fstarter-rp-react-ts-webpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Fstarter-rp-react-ts-webpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Fstarter-rp-react-ts-webpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf-viewer-react%2Fstarter-rp-react-ts-webpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdf-viewer-react","download_url":"https://codeload.github.com/pdf-viewer-react/starter-rp-react-ts-webpack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241629768,"owners_count":19993710,"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","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":["pdf-viewer","pdf-viewer-react","pdfjs","pdfjs-dist","react-pdf","react-pdf-viewer","reactjs","typescript","webpack"],"created_at":"2025-03-03T08:16:13.791Z","updated_at":"2025-07-09T13:37:58.809Z","avatar_url":"https://github.com/pdf-viewer-react.png","language":"TypeScript","readme":"# React PDF Starter Toolkit in React.js, TypeScript and Webpack\n\n[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github.com/pdf-viewer-react/starter-rp-react-ts-webpack)\n\nWelcome to the React PDF Starter Toolkit! This repository provides a comprehensive guide on integrating React PDF with React, TypeScript and Webpack. It showcases how React PDF can be integrated and rendered as part of a React.js project.\n\n## Table of Contents\n\n- [Usage](#usage)\n  - [Project Setup](#project-setup)\n  - [Running the Example Project](#running-the-example-project)\n- [Examples](#examples)\n\n## Usage\n\n### Project Setup\n\n1. **Clone the Repository**: If you haven't already, clone the repository and navigate into the project directory.\n\n   ```bash\n   git clone https://github.com/pdf-viewer-react/starter-rp-react-ts-webpack.git\n   cd starter-rp-react-ts-webpack\n   ```\n\n2. **Install Dependencies**: Install the necessary dependencies using npm, yarn, pnpm or bun.\n\n   ```bash\n   npm install\n   # or\n   yarn install\n   # or\n   pnpm install\n   # or\n   bun install\n   ```\n\n### Running the Example Project\n\nThis repository includes an example project to demonstrate React PDF in action.\n\n1. **Start the Development Server**: Use the following command to start the development server\n\n   ```bash\n   npm run dev\n   # or\n   yarn dev\n   # or\n   pnpm run dev\n   # or\n   bun run dev\n   ```\n\n2. **Open in Browser**: Open your browser and navigate to `http://localhost:5173` (or the port specified in your terminal) to see the example project in action\n\n### Using the React PDF Component\n\nOnce the example project is running, you can explore the source code to see how the React PDF component is integrated. Here is a brief overview:\n\n1.  **Import the component**: Import the desired React PDF component into your codes\n\n```tsx\nimport React from \"react\";\nimport {\n  RPProvider,\n  RPDefaultLayout,\n  RPPages,\n  RPProviderProps,\n  RPLayoutProps,\n} from \"@pdf-viewer/react\";\n\ninterface Props {\n  showToolbar?: boolean;\n  providerProps?: RPProviderProps;\n  defaultLayoutProps?: RPLayoutProps;\n}\n\nexport const AppPDFViewer = (props: Props) =\u003e {\n  const { showToolbar = true, providerProps, defaultLayoutProps } = props;\n\n  return (\n    \u003cRPProvider\n      src=\"https://cdn.codewithmosh.com/image/upload/v1721763853/guides/web-roadmap.pdf\"\n      {...providerProps}\n    \u003e\n      {showToolbar ? (\n        \u003cRPDefaultLayout {...defaultLayoutProps}\u003e\n          \u003cRPPages /\u003e\n        \u003c/RPDefaultLayout\u003e\n      ) : (\n        \u003cdiv style={{ width: \"100%\", height: \"550px\" }}\u003e\n          \u003cRPPages/\u003e\n        \u003c/div\u003e\n      )}\n    \u003c/RPProvider\u003e\n  );\n};\n```\n\n2. **Use the component in the template**: Add the React PDF component to your template section\n\n```tsx\nimport React from \"react\";\nimport \"./App.css\";\nimport { RPConfig } from \"@pdf-viewer/react\";\nimport { AppPDFViewer } from \"./components/AppPDFViewer\";\n\nfunction App() {\n  return (\n    \u003cRPConfig licenseKey=\"\"\u003e\n      \u003cdiv className=\"container\"\u003e\n        \u003ch1\u003eReact PDF Starter Toolkit in React.js, Typescript and Webpack\u003c/h1\u003e\n        \u003cbr /\u003e\n        \u003ch2\u003eDefault Toolbar\u003c/h2\u003e\n        \u003cAppPDFViewer /\u003e\n        \u003ch2\u003eWithout Toolbar\u003c/h2\u003e\n        \u003cAppPDFViewer\n          showToolbar={false}\n          defaultLayoutProps={{\n            style: { width: \"100%\", height: \"550px\" },\n          }}\n        /\u003e\n        \u003ch2\u003eMobile\u003c/h2\u003e\n        \u003cAppPDFViewer\n          defaultLayoutProps={{\n            style: { width: \"500px\" },\n          }}\n        /\u003e\n      \u003c/div\u003e\n    \u003c/RPConfig\u003e\n  );\n}\n\nexport default App;\n```\n\n## Examples\n\nFor more examples, please refer to the `src/App.tsx` file in this repository:\n\n- Default Toolbar\n- Without Toolbar\n- Mobile View\n\n_Remark: If you would like more examples, feel free open an issue._\n\nFor more configurations, please check the [documentation](https://docs.react-pdf.dev) site.\n\n## Meta\n- Homepage: [https://www.react-pdf.dev](https://www.react-pdf.dev)\n- Docs: [https://docs.react-pdf.dev](https://docs.react-pdf.dev)\n\n---\n\nThank you for using React PDF! We hope this toolkit helps you build amazing React.js applications. If you have any questions or need further assistance on this example, please feel free to open an issue. Happy coding!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdf-viewer-react%2Fstarter-rp-react-ts-webpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdf-viewer-react%2Fstarter-rp-react-ts-webpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdf-viewer-react%2Fstarter-rp-react-ts-webpack/lists"}