An open API service indexing awesome lists of open source software.

https://github.com/peterdee/pdf-view

A demonstration of how the react-pdf should work with CRA-generated application
https://github.com/peterdee/pdf-view

create-react-app express react react-pdf

Last synced: 11 months ago
JSON representation

A demonstration of how the react-pdf should work with CRA-generated application

Awesome Lists containing this project

README

          

## Viewing PDF files with React

A demonstration of how the `react-pdf` should work with CRA-generated application.

Stack: React, React-PDF.

### Deploy

```shell script
git clone https://github.com/peterdee/pdf-view
cd ./pdf-view
nvm use 14
npm i -g yarn
yarn
```

### Modules locking

Module versions are locked.

This is necessary only for the `react-pdf` though, as the contents of `worker.js` in the `public` directory was copied from the `pdfjs-dist/build/pdf.worker.min.js` file.

### Launch

```shell script
yarn start
```

Application is available at http://localhost:3000

### Build

```shell script
yarn build
```

The `public` directory contains a `worker.js` file that should be copied to the `build` folder, otherwise `react-pdf` will not work properly when static files are created.

### Serve static

```shell script
yarn serve
```

Static files are served with `express` on http://localhost:5500

### LICENSE

[MIT](LICENSE)