How to use the react-pdf.pdfjs.version function in react-pdf

To help you get started, we’ve selected a few react-pdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rieckpil / blog-tutorials / pdf-preview-react / src / index.js View on Github external
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'semantic-ui-css/semantic.min.css'
import { pdfjs } from 'react-pdf';
import * as serviceWorker from './serviceWorker';

pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

ReactDOM.render(, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();
github pluto-net / scinapse-web-client / app / components / pdfViewer / index.tsx View on Github external
import { ActionCreators } from '../../actions/actionTypes';
import { AUTH_LEVEL, blockUnverifiedUser } from '../../helpers/checkAuthDialog';
import EnvChecker from '../../helpers/envChecker';
import RelatedPapers from '../relatedPapers';
import AfterDownloadContents from './component/afterDownloadContents';
import { PDFViewerProps } from './types';
import { AppState } from '../../reducers';
import ProgressSpinner from './component/progressSpinner';
import BlurBlocker from './component/blurBlocker';
import { addPaperToRecommendPool } from '../recommendPool/actions';
import { PDFViewerState } from '../../reducers/pdfViewer';
import { getBestPdf } from '../../actions/pdfViewer';
const useStyles = require('isomorphic-style-loader/useStyles');
const styles = require('./pdfViewer.scss');

pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

const DIRECT_PDF_PATH_PREFIX = 'https://asset-pdf.scinapse.io/';

function trackClickButton(actionTag: Scinapse.ActionTicket.ActionTagType, paperId: string) {
  ActionTicketManager.trackTicket({
    pageType: 'paperShow',
    actionType: 'fire',
    actionArea: 'pdfViewer',
    actionTag,
    actionLabel: String(paperId),
  });
}

function getDirectPDFPath(path: string) {
  return `${DIRECT_PDF_PATH_PREFIX + path}`;
}
github ntrvn / personal-website / src / components / Resume.js View on Github external
import React, {useState} from 'react';
import {withStyles, Button, Dialog} from '@material-ui/core';
import {Document, Page, pdfjs} from 'react-pdf';
import nhantran from './nhantran.pdf'

pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

const style = {
    root : {
        position: 'absolute',
        bottom: '25px',
        right: '100px',
    },
    link: {
        textDecoration: "none",
        color: "white",
        marginTop: '-35px'
    },
}

const Resume = (props) => {
    const [modalOpen, setModalOpen] = useState(false);

react-pdf

Display PDFs in your React app as easily as if they were images.

MIT
Latest version published 3 days ago

Package Health Score

79 / 100
Full package analysis