1.4.1 • Published 11 months ago

ultimate-react-pdf v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

version downloads minzipsize license

Ultimate React PDF

The most complete React PDF viewer for everyone, without dependencies and fully typed.

Demo

demo

Requirements

React 16 or later.

Installation

NPM:

npm install ultimate-react-pdf

YARN:

yarn add ultimate-react-pdf

Usage

import { Document, Page } from "ultimate-react-pdf"

<>
  <Document src="https://pdfobject.com/pdf/sample.pdf">
    <Page controls />
  </Document>
</>

Or for infinity page:

import { Document, InfinityPage } from "ultimate-react-pdf"

<>
  <Document src={new URL("https://pdfobject.com/pdf/sample.pdf")}>
    <InfinityPage />
  </Document>
</>

Props

Document

Prop nameDescriptionDefault value
srcThe PDF itself. Can be a URL string where a PDF file is located or a base64 string. NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or XHR as fallback) is used, which means it must follow same origin rules. e.g. no cross-domain requests without CORS.
optionsSome extra options such as password, headers..{}
documentRefReference to the inner HTML element of the document.
externalLinkTargetLink rel for links rendered in annotations.
externalLinkRelLink target for external links rendered in annotations.
onDocumentErrorFunction called when the document load fails.
onDocumentLoadFunction called when the document loads successfully.
messagesList of messages used.Default english messages.
classNameCustom classname for the document container.

Page

Prop nameDescriptionDefault value
controlsShow or hide the control buttons.false
initialPageInitial page number.1
pageRefReference to the inner HTML element of the page.
viewPortScaleCustom viewport scale.window.devicePixelRatio
annotationsEnable or disable the annotations.true
onPageChangeFunction called when the page changes.
onPageErrorFunction called when the page loads fails.
onPageLoadFunction called when the page loads successfully.
classNameCustom classname for the page container.

Infinity page

Prop nameDescriptionDefault value
pageRefReference to the inner HTML element of the page.
viewPortScaleFunction called when the document load fails.window.devicePixelRatio
annotationsEnable or disable the annotations.true
onPageErrorFunction called when the page loads fails.
onPageLoadFunction called when the page loads successfully.
classNameCustom classname for the page container.

License

Under MIT License.

1.4.1

11 months ago

1.4.0

11 months ago

1.3.0

11 months ago

1.2.0

11 months ago

1.1.0

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago