react-pdfobject
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i react-pdfobject

Weekly Downloads

9,192

Version

1.2.0

License

MIT

Unpacked Size

8.67 kB

Total Files

4

Last publish

Collaborators

  • sugarshin