Adding these lines seems to fix the code for me:

    
const bytes  = new Uint8Array( pdfBytes ); 
const blob   = new Blob( [ bytes ], { type: "application/pdf" } );
const docUrl = URL.createObjectURL( blob );
setPdfInfo( docUrl );

Or use it directly:

return <iframe src={docUrl} type="application/pdf" />
Answer from Saed Jaber on Stack Overflow
🌐
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
Styling
React renderer for creating PDF files on the browser and server
Advanced
React renderer for creating PDF files on the browser and server
Components
React renderer for creating PDF files on the browser and server
Rendering process
React renderer for creating PDF files on the browser and server
🌐
PDF-LIB
pdf-lib.js.org
PDF-LIB · Create and modify PDF documents in any JavaScript environment.
Works in any JavaScript runtime, including browsers, Node, Deno, and even React Native. Add, insert, and remove pages. Split a single PDF into separate ones. Or merge multiple PDFs into a single document.
🌐
GitHub
github.com › Hopding › react-native-pdf-lib
GitHub - Hopding/react-native-pdf-lib: Library for creating and editing PDFs in React Native.
This library's purpose is to fill the gap that currently exists in the React Native ecosystem for PDF creation and editing. It aims to provide an easy, simple, and consistent API for both creating new and editing existing PDF documents in React ...
Starred by 200 users
Forked by 78 users
Languages   C 75.5% | C++ 22.6% | Objective-C++ 0.9% | Java 0.7% | JavaScript 0.3% | Ruby 0.0%
🌐
npm
npmjs.com › package › react-pdf
react-pdf - npm
Display PDFs in your React app as easily as if they were images.. Latest version: 10.2.0, last published: 2 months ago. Start using react-pdf in your project by running `npm i react-pdf`. There are 986 other projects in the npm registry using ...
      » npm install react-pdf
    
Published   Oct 09, 2025
Version   10.2.0
Author   Wojciech Maj
🌐
npm
npmjs.com › package › pdf-lib
pdf-lib - npm
Designed to work in any modern JavaScript runtime. Tested in Node, Browser, Deno, and React Native environments. ... pdf-lib was created to address the JavaScript ecosystem's lack of robust support for PDF manipulation (especially for PDF ...
      » npm install pdf-lib
    
Published   Nov 06, 2021
Version   1.17.1
Author   Andrew Dillon
🌐
GitHub
github.com › Hopding › pdf-lib
GitHub - Hopding/pdf-lib: Create and modify PDF documents in any JavaScript environment
Designed to work in any modern JavaScript runtime. Tested in Node, Browser, Deno, and React Native environments. ... pdf-lib was created to address the JavaScript ecosystem's lack of robust support for PDF manipulation (especially for PDF ...
Starred by 8.1K users
Forked by 827 users
Languages   TypeScript 80.9% | HTML 9.9% | JavaScript 8.5% | Objective-C 0.3% | CSS 0.2% | Starlark 0.1% | Java 0.1%
Find elsewhere
🌐
GitHub
github.com › Shogobg › rn-pdf-lib
GitHub - Shogobg/rn-pdf-lib: Library for creating and editing PDFs in React Native.
Library for creating and editing PDFs in React Native. - Shogobg/rn-pdf-lib
Starred by 10 users
Forked by 2 users
Languages   C 75.4% | C++ 22.6% | Objective-C++ 0.9% | Java 0.8% | JavaScript 0.3% | Ruby 0.0%
🌐
GitHub
github.com › diegomura › react-pdf
GitHub - diegomura/react-pdf: 📄 Create PDF files using React
React renderer for creating PDF files on the browser and server
Starred by 16.2K users
Forked by 1.3K users
Languages   TypeScript 83.1% | JavaScript 16.8%
🌐
Nutrient
nutrient.io › web › react
React PDF library: Fast & easy implementation | Nutrient SDK
Add PDF viewing, annotation, and editing capabilities to your React-based web application with Nutrient Web SDK. It offers developers a client-side JavaScript library that's fully compatible with React and enables seamless integration into both ...
🌐
npm
npmjs.com › package › react-native-pdf-lib
react-native-pdf-lib - npm
This library's purpose is to fill the gap that currently exists in the React Native ecosystem for PDF creation and editing. It aims to provide an easy, simple, and consistent API for both creating new and editing existing PDF documents in React ...
      » npm install react-native-pdf-lib
    
Published   Feb 09, 2020
Version   1.0.0
Author   Andrew Dillon
🌐
React PDF Viewer
react-pdf-viewer.dev
A React component to view PDF documents - React PDF Viewer
import '@react-pdf-viewer/core/lib/styles/index.css'; import '@react-pdf-viewer/default-layout/lib/styles/index.css'; // Create new plugin instance · const defaultLayoutPluginInstance = defaultLayoutPlugin(); <Viewer · fileUrl='/assets/pdf-open-parameters.pdf' plugins={[ // Register plugins ·
🌐
Bitstack
blog.bitsrc.io › top-react-pdf-libraries-in-2021-d0cfbeccdbf8
Top React PDF Libraries in 2021. Recommended PDF Viewer Libraries for… | by Piumi Liyana Gunawardhana | Bits and Pieces
March 5, 2025 - Note: This library well functions ... and the below example shows a simple example of React-file-viewer. @mikecousins/react-pdf is a component that uses PDF.js to render PDF documents....
🌐
GitHub
github.com › wojtekmaj › react-pdf
GitHub - wojtekmaj/react-pdf: Display PDFs in your React app as easily as if they were images.
This package is used to display existing PDFs. If you wish to create PDFs using React, you may be looking for @react-pdf/renderer.
Starred by 10.7K users
Forked by 981 users
Languages   TypeScript 94.3% | CSS 5.6% | HTML 0.1%
🌐
CodeSandbox
codesandbox.io › examples › package › react-native-pdf-lib
react-native-pdf-lib examples - CodeSandbox
Use this online react-native-pdf-lib playground to view and fork react-native-pdf-lib example apps and templates on CodeSandbox.
🌐
GitHub
github.com › ZEISS › react-view-pdf
GitHub - ZEISS/react-view-pdf: A simple and powerful PDF Viewer library for React.js
A simple and powerful PDF Viewer library for React.js - ZEISS/react-view-pdf
Starred by 112 users
Forked by 5 users
Languages   TypeScript 97.8% | JavaScript 2.2%
🌐
React PDF
blog.react-pdf.dev › 6-open-source-pdf-generation-and-modification-libraries-every-react-dev-should-know-in-2025
Top 6 Open-Source PDF Libraries for React Developers
September 2, 2025 - Discover 6 essential open-source React libraries for seamless PDF creation and editing, enhancing client-side document handling in 2025
🌐
npm
npmjs.com › package › @react-pdf › pdfkit
react-pdf/pdfkit
A JavaScript PDF generation library for Node and the browser. This project is a fork of pdfkit by @devongovett and continued under the scope of this project since it has react-pdf specific features.
      » npm install @react-pdf/pdfkit
    
Published   Sep 23, 2025
Version   4.0.4
Author   Devon Govett
🌐
CodeSandbox
codesandbox.io › examples › package › pdf-lib
pdf-lib examples - CodeSandbox
Use this online pdf-lib playground to view and fork pdf-lib example apps and templates on CodeSandbox.