How to use the react-pdf.pdfjs 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 doches / lilypond-ui / src / renderer / output.tsx View on Github external
import * as React from "react";
import * as ReactPDF from "react-pdf";
import Pagination from "react-js-pagination";
import {
  Spinner,
  Intent,
  NonIdealState,
} from "@blueprintjs/core";
import Toast from "./toast";

ReactPDF.pdfjs.GlobalWorkerOptions.workerSrc = "../dist/pdf.worker.js";

import "./output.less";

const translateScale = (scale: string) => {
  if (scale.indexOf("%") > -1) {
    return (+scale.replace(/[^\d]+/g, ""))/100.0;
  }

  return 1;
}

export interface IOutputProps {
  path: string;
  needsRefresh: boolean;
  hasErrors: boolean;
  showPendingSpinner: boolean;

react-pdf

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

MIT
Latest version published 2 months ago

Package Health Score

79 / 100
Full package analysis