react-pdf

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

MIT License

Downloads
4.3M
Stars
8.6K
Committers
57

Bot releases are hidden (Show)

react-pdf - Latest Release

Published by wojtekmaj 6 months ago

❗️ = breaking change

What's new?

  • Added support for React 19.

What's changed?

  • ❗️ New JSX transform is now required. Most likely, you’re already using it, but if you’re not, you’ll need to enable it by following the instructions in the linked blog post.
  • ❗️ propTypes were removed. If you’re using propTypes, we recommend migrating to TypeScript or another type-checking solution.
react-pdf - v7.7.1

Published by wojtekmaj 8 months ago

Bug fixes

  • Fixed Outline, Page and Thumbnail components crashing when placed outside Document, but provided with pdf prop (#1709).
  • Fixed documentation for using vite-plugin-static-copy suggesting a solution that doesn't work on Windows.
react-pdf - v7.7.0

Published by wojtekmaj 9 months ago

What's new?

  • Detect not memoized file and options props.

What's changed?

  • Updated documentation to make it clear SVG renderMode is deprecated and will be removed in the future.
  • Replaced tiny-warning with more popular (and equally tiny!) warning.
react-pdf - v7.6.0

Published by wojtekmaj 10 months ago

What's new?

  • Improved developer experience by moving prop documentation to JSDoc. This means that you can now see descriptions, default values, and examples for all props in your IDE.
  • Improved documentation.
react-pdf - v7.5.1

Published by wojtekmaj almost 1 year ago

What's new?

react-pdf - v7.5.0

Published by wojtekmaj about 1 year ago

What's new?

  • Exported PasswordResponses type to make it easier to create custom password prompts (#1615). Thanks, @pstevovski!
  • Updated documentation on options prop and usage with Next.js.

Bug fixes

  • Fixed customTextRenderer not called on items outside of marked content (#1593, #1623).
react-pdf - v7.4.0

Published by wojtekmaj about 1 year ago

What's new?

  • Improved Next.js compatibility.
    • Updated documentation
    • Added samples for Next.js App Router and Next.js Pages Router
  • Updated PDF.js to 3.11.174.
    • Accessibility improvements
    • Form rendering improvements
    • Font conversion and substitution improvements
    • Performance improvements
    • Text selection improvements
    • TypeScript improvements
    • Other features/bugfixes

Bug fixes

  • Fixed index.test.js entry not working in pure ESM mode with "moduleResolution": "node16" TypeScript option enabled.
react-pdf - v7.3.3

Published by wojtekmaj about 1 year ago

Bug fixes

  • Fixed "Cannot set properties of undefined (setting 'workerSrc')" error in legacy Next.js setups (#1579).
react-pdf - v7.3.2

Published by wojtekmaj about 1 year ago

Bug fixes

  • Fixed "Cannot destructure property 'PDFDataRangeTransport' of 'pdfjs' as it is undefined." error in some environments.
react-pdf - v7.3.1

Published by wojtekmaj about 1 year ago

Bug fixes

  • Fixed "Named export 'PDFDataRangeTransport' not found." error in some environments (#1578).
react-pdf - v7.3.0

Published by wojtekmaj about 1 year ago

What's new?

  • Added support for native ESM modules (#1574).
  • Added documentation on cMaps and standard fonts for Vite.

What's changed?

  • Improved propTypes.

Bug fixes

  • Fixed propTypes declared twice in every declaration file (#1542).
  • Fixed raw-loader installation instructions using Yarn (#1569). Thanks, @felipelssilva!
react-pdf - v7.2.0

Published by wojtekmaj about 1 year ago

What's new?

  • Added support for new renderMode: "custom". When set, you can pass custom renderer function to customRenderer prop (#1408).
  • Improved RSC compatibility. You no longer need to add 'use client'; to the parent component for this component to work.

What's changed?

  • Improved documentation not to suggest using inline object as options prop value (#1567).
  • Added guidelines for installation in Next.js app (#1508).

Bug fixes

  • @types/react and @types/react-dom are now optional peerDependencies, which eliminates errors caused by duplicate typings.
react-pdf - v7.1.3

Published by wojtekmaj over 1 year ago

What's changed?

  • Updated clsx dependency to 2.0.0 to enable ESM support in the near future.
react-pdf - v7.1.2

Published by wojtekmaj over 1 year ago

Bug fixes

  • Fixed customTextRenderer not working on documents without marked content (#1530, #1531). Thanks, @MattL75!
react-pdf - v7.1.1

Published by wojtekmaj over 1 year ago

Bug fixes

  • Improved performance by avoiding unnecessary re-renders (#1526).
react-pdf - v7.1.0

Published by wojtekmaj over 1 year ago

Large and exciting release, full of improvements and new features, mainly thanks to our contributors, @kostassite, @iamandrewluca and @MattL75, and sponsors. Become a sponsor and help making React-PDF even better!

What's new?

  • Added Thumbnail component which lets you render thumbnails (#898, #1519).
  • Forms rendered by annotation layer are now using AnnotationStorage. This allows you to hook into pdf.annotationStorage in pdf provided in onDocumentLoadSuccess callback and listen for form data changes (#1518). Thanks, @kostassite!
  • New hooks: useDocumentContext, useOutlineContext and usePageContext. These hooks allow you to build custom components that hook (pun not intended) into React-PDF API (#1505). Thanks, @iamandrewluca!
  • If onItemClick was not provided neither to Document nor Outline components, React-PDF will now attempt to navigate to the page of the clicked outline item on its own, just like it does for internal links.

What's changed?

  • Improved accessibility by introducing structure tree. This also introduces new props in Page: onGetStructTreeSuccess and onGetStructTreeError (#1494, #1498). Thanks, @MattL75!

Bug fixes

  • Fixed onItemClick types incorrectly marking dest as required.
  • Fixed onItemClick not passed from Document to Outline. Previously, you had to manually pass onItemClick to Outline component. Now, you only need to pass it to Document.
react-pdf - v7.0.3

Published by wojtekmaj over 1 year ago

Bug fixes

  • Allowed all DocumentInitParameters to be passed to options prop.
react-pdf - v7.0.2

Published by wojtekmaj over 1 year ago

Bug fixes

  • Fixed "Worker was destroyed" error when Document was unmounted or updated before the worker finished loading the PDF file.
  • Fixed annotations not displaying properly when global CSS had section selector styled.
react-pdf - v7.0.1

Published by wojtekmaj over 1 year ago

Bug fixes

  • Fixed annotation layer rendered under text layer, resulting in some annotations not clickable (#1503). Thanks, @iamandrewluca!
react-pdf - v7.0.0

Published by wojtekmaj over 1 year ago

See Upgrade guide from version 6.x to 7.x.

This is one of the biggest update - for React-PDF and for me personally. React-PDF has been rewritten from scratch using TypeScript and React Hooks. I've put a tremendous amount of effort to modernize the package without introducing any major breaking changes. If, however, something have slipped through 137 unit tests we have, please let me know. I hope you will like it.

❗️ = breaking change

What's new?

  • Converted package to TypeScript (#1420).
  • Rewritten package using React Hooks (#1370).
  • Updated PDF.js to 3.6.172.
    • Preparations for editor mode support
    • Removed support for outdated browser versions
    • Font conversion/text selection improvements
    • Annotation improvements
    • Image rendering improvements that allow rendering big images even if they are larger than the canvas limits
    • Accessibility improvements
    • Improved overall performance
    • Reduced memory usage
    • Other features/bugfixes

What's changed?

  • React-PDF is now considerably smaller.
  • ❗️ Bundler-specific entry points are no longer provided. Don't worry though, the setup should be straightforward.
  • ❗️ Dropped support for older browsers.
  • ❗️ Removed legacy renderInteractiveForms prop

Bug fixes

  • Fixed "The --scale-factor CSS-variable must be set" error.
  • Fixed black flicker when rendering canvas (#1340, #1279). Thanks, @MattL75!
  • Fixed propTypes that could have crashed SSR.
Package Rankings
Top 0.62% on Npmjs.org
Top 3.71% on Proxy.golang.org
Badges
Extracted from project README
npm CI
Related Projects