Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ultimate-react-pdf

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ultimate-react-pdf

The most complete React PDF for everyone without dependencies.

  • 1.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49
increased by32.43%
Maintainers
0
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 25 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc