1.2.0 • Published 3 years ago

react-pdfobject v1.2.0

Weekly downloads
3,619
License
MIT
Repository
github
Last release
3 years ago

react-pdfobject

CircleCI Codecov npm version License

A React component for PDFObject .

npm install react-pdfobject

Usage

import * as React from 'react'
import { PDFObject } from 'react-pdfobject'

<PDFObject url="path/to/example.pdf" />

Props

interface Props {
  url: string;
  containerId?: string;
  containerProps?: React.HTMLProps<HTMLDivElement>;
  width?: string;
  height?: string;
  page?: string | number;
  id?: string;
  fallbackLink?: string | false;
  pdfOpenParams?: OpenParams;
  PDFJS_URL?: string;
  forcePDFJS: boolean;
  assumptionMode: boolean;
}

export interface OpenParams {
  page?: number;
  zoom?: ZoomMode;
  nameddest?: string;
  pagemode?: PageMode;
  view?: ViewMode;
}

export type ZoomMode = 'scale' | 'scale,left,top';

export type PageMode = 'bookmarks' | 'thumbs' | 'none';

export type ViewMode =
  | 'Fit'
  | 'FitH'
  | 'FitH,top'
  | 'FitV'
  | 'FitV,left'
  | 'FitB'
  | 'FitBH'
  | 'FitBH,top'
  | 'FitBV'
  | 'FitBV,left';

API / Static Methods Supported

PDFObject.supportsPDFs Function

if(PDFObject.supportsPDFs){
   console.log("Yay, this browser supports inline PDFs.");
} else {
   console.log("Boo, inline PDFs are not supported by this browser");
}

PDFObject.pdfobjectversion Function

console.log(PDFObject.pdfobjectversion); //"2.1.1"

ref: https://pdfobject.com/#api

License

MIT

© sugarshin