How to use the react-pdf.pdfjs.GlobalWorkerOptions 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 arinyguedes / safenotes / src / fileManager.js View on Github external
import {  
    listFiles,
    getFile,
    putFile,
    deleteFile
} from 'blockstack'
import { pdfjs } from 'react-pdf'
pdfjs.GlobalWorkerOptions.workerSrc = `/pdf.worker.min.js`

const metadataFilePrefix = "metadata__"
const filePrefix = "file__"
const highlightsFilePrefix = "highlights__"
const firstPageFilePrefix = "firstpage__"

export default class FileManager {
    static create (name, size, type, lastModified, arrayBuffer) {
        return new Promise(function (resolve, reject) {
            var simpleName = name
            name = FileManager._getFileName(name)
            var metadataFileName = metadataFilePrefix + name
            var fileName = filePrefix + name
            var firstPageFileName = firstPageFilePrefix + name
            var content = FileManager._getFileUrl(arrayBuffer, type)
            pdfjs.disableWorker = true

react-pdf

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

MIT
Latest version published 23 hours ago

Package Health Score

79 / 100
Full package analysis