You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Vitalik 898f30ebe3 Init 2 years ago
public Init 2 years ago
src Init 2 years ago
.gitignore Init 2 years ago
README.md Init 2 years ago
package.json Init 2 years ago

README.md

This folder demonstrates how to use React PDF viewer with Create React App.

Install

  • Install the dependencies
$ npm install
  • Build
$ npm run build
  • Run locally
$ npm run start

Visit http://localhost:3000 to see it in action.

Spotlights

App.js:

import { Viewer, Worker } from '@react-pdf-viewer/core';
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout';

import '@react-pdf-viewer/core/lib/styles/index.css';
import '@react-pdf-viewer/default-layout/lib/styles/index.css';

const defaultLayoutPluginInstance = defaultLayoutPlugin();

return (
    <Worker workerUrl="https://unpkg.com/pdfjs-dist@2.15.349/build/pdf.worker.js">
        <div style={{ height: '750px' }}>
            <Viewer
                fileUrl={`${process.env.PUBLIC_URL}/pdf-open-parameters.pdf`}
                plugins={[
                    defaultLayoutPluginInstance,
                ]}
            />
        </div>
    </Worker>
);