If you goal is just to view the pdf in your application, the easiest way is using the object tag in HTML. You don't need to import any libraries and works most of the browsers. But this is lack of customization and styles.

  <object data="http://africau.edu/images/default/sample.pdf" type="application/pdf" width="100%" height="100%">
      <p>Alternative text - include a link <a href="http://africau.edu/images/default/sample.pdf">to the PDF!</a></p>
  </object>
Answer from Dhanuka Perera on Stack Overflow
🌐
npm
npmjs.com › package › react-pdf
react-pdf - npm
February 25, 2026 - If you want to use text layer in PDFs rendered by React-PDF, then you would need to include stylesheet necessary for text layer to be correctly displayed like so: ... If you want to ensure that PDFs with non-latin characters will render perfectly, or you have encountered the following warning: Warning: The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided. then you would also need to include cMaps in your build and tell React-PDF where they are. First, you need to copy cMaps from pdfjs-dist (React-PDF's dependency - it should be in your node_modules if you have React-PDF installed).
      » npm install react-pdf
    
Published   Feb 25, 2026
Version   10.4.1
Discussions

Best library for showing a pdf in react
If you don't need direct control over the PDF in any way, then just use an IFrame. It'll make the browser use their default viewer, which is generally a pretty decent one. There's also one made by Mozilla ( PDF.js ), but any PDF viewer is going to be pretty heavy in terms of code size. More on reddit.com
🌐 r/reactjs
26
34
December 2, 2022
How do I load a PDF from url in React with react-pdf
The pdf I'm loading is coming from firebase. When I try to run the program, the app renders but the pdf document fails to load. Here are the errors: Uncaught SyntaxError: Unexpected token ' More on stackoverflow.com
🌐 stackoverflow.com
View PDF from URL : Example
Dear All, We are trying to use react PDF to preview document from back-End. We are using this command, but it do not work; More on github.com
🌐 github.com
2
September 4, 2019
reactjs - How to show pdf file in react.js - Stack Overflow
i just try to sample application for ios, android and web using react-native-web. Here i have to download a pdf file from server and while click the showpdf button the downloaded file need to open in More on stackoverflow.com
🌐 stackoverflow.com
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-display-a-pdf-as-an-image-in-react-app-using-url
How to display a PDF as an image in React app using URL? - GeeksforGeeks
January 9, 2025 - But if you don't want that then there is a way to do so. You can use the package called react-pdf, by using this package you can render the PDF in your React app by using the PDF URL...
🌐
GitHub
github.com › wojtekmaj › react-pdf
GitHub - wojtekmaj/react-pdf: Display PDFs in your React app as easily as if they were images. · GitHub
If you want to use text layer in PDFs rendered by React-PDF, then you would need to include stylesheet necessary for text layer to be correctly displayed like so: ... If you want to ensure that PDFs with non-latin characters will render perfectly, or you have encountered the following warning: Warning: The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided. then you would also need to include cMaps in your build and tell React-PDF where they are. First, you need to copy cMaps from pdfjs-dist (React-PDF's dependency - it should be in your node_modules if you have React-PDF installed).
Starred by 11K users
Forked by 999 users
Languages   TypeScript 94.5% | CSS 5.4% | HTML 0.1%
🌐
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
Find elsewhere
🌐
DEV Community
dev.to › mohitkyadav › display-online-offline-pdf-files-in-react-using-react-pdf-2482
Display online/offline pdf files in React using react-pdf - DEV Community
September 6, 2020 - import { Document, Page, pdfjs ...adSuccess} > // pages here, we will get back to that later </Document> in above code urlPDF is url to pdf....
🌐
Medium
medium.com › @stheodorejohn › a-guide-to-display-pdf-documents-in-react-bcd9fb0f56b0
Display PDF documents in React. Create an interactive PDF viewing… | by Theodore John.S | Medium
July 10, 2023 - You can embed the PDF file within an `<iframe>` tag and set the source to the URL of the PDF file. import React from ‘react’; const PDFViewer = () => { return ( <div> <iframe src=”path_to_pdf_file.pdf” width=”100%” height=”500px” ...
🌐
MESCIUS
developer.mescius.com › blogs › how-to-load-view-pdf-files-in-a-react-application
How to Load & View PDF Files in a React Application | Document Solutions
September 23, 2025 - To do this, use the open method and pass the URL of the PDF as an argument: viewer.open("/document-solutions/javascript-pdf-viewer/demos/product-bundles/assets/pdf/helloworld.pdf"); This method works for any PDF file that is accessible within ...
🌐
React-pdf
docs.react-pdf.dev › examples › load-pdf-via-url
Load via URL | React PDF Documentation
You want to display a static file that doesn’t require user interaction or API processing · Refer to Handling Source of PDF File (URL) for more information. JSX · TSX · import { RPConfig, RPProvider, RPDefaultLayout, RPPages, } from "@pdf-viewer/react"; const DEFAULT_FILE_URL = "https://cdn.codewithmosh.com/image/upload/v1721763853/guides/web-roadmap.pdf"; const App = () => { return ( <> <p style={{ textAlign: "center" }}>PDF file : {DEFAULT_FILE_URL}</p> <RPConfig> <RPProvider src={DEFAULT_FILE_URL}> <RPDefaultLayout> <RPPages /> </RPDefaultLayout> </RPProvider> </RPConfig> </> ); }; exp
🌐
GitHub
github.com › wojtekmaj › react-pdf › issues › 449
View PDF from URL : Example · Issue #449 · wojtekmaj/react-pdf
September 4, 2019 - 'use strict'; import React from "react"; import { Document, Page } from 'react-pdf'; import Path from 'path'; export default class ImageList extends React.Component { constructor(props) { super(props); this.state = { src:"", format: "", numPages: null, pageNumber: 1, }; } onDocumentLoadSuccess = ({ numPages }) => { this.setState({ numPages }); } render() { const { pageNumber, numPages } = this.state; return ( <div> <Document file={"/document/download/toto.pdf"} onLoadSuccess={this.onDocumentLoadSuccess} > <Page pageNumber={pageNumber} /> </Document> <p>Page {pageNumber} of {numPages}</p> </div> ) } }
Author   PaulB2Code
🌐
Syncfusion
help.syncfusion.com › documentation › document processing › pdf › pdf viewer › react › open pdf files
Load and Open PDF Files in the React PDF Viewer | Syncfusion
March 4, 2026 - const viewerRef = useRef(null); fetch(url) .then(r => r.blob()) .then(blob => { const objectUrl = URL.createObjectURL(blob); viewerRef.current?.load(objectUrl, null); }); To load a PDF file from SQL Server database in a PDF Viewer, you can follow the steps below · Step 1: Create a Simple PDF Viewer Sample in React
🌐
GitConnected
levelup.gitconnected.com › displaying-pdf-in-react-app-6e9d1fffa1a9
Displaying PDF in React app. I want to show you an easy and simple… | by Sagar Shrestha | Level Up Coding
January 11, 2023 - npx create-react-app display-pdf-app cd display-pdf-app npm start · After this, add the react-pdf library to the project using the following command: ... To render the PDF file, react-pdf has a Document component where you need to pass a file prop.
🌐
GitHub
github.com › forthealllight › react-read-pdf
GitHub - forthealllight/react-read-pdf: a mobile-friendly PDF Reader in browser for React 16.5 · GitHub
import { PDFReader } from 'react-read-pdf' ... <PDFReader url={"http://localhost:3000/test.pdf"} ...>
Starred by 77 users
Forked by 32 users
Languages   TypeScript 48.1% | CSS 36.2% | JavaScript 13.8% | HTML 1.9%
🌐
StackBlitz
stackblitz.com › edit › react-9wseew
React pdf display pdf - StackBlitz
A React project based on react, react-dom, react-pdf and @babel/runtime
🌐
Medium
medium.com › @9haroon_dev › best-4-methods-to-build-a-pdf-viewer-in-react-js-pdf-js-react-pdf-and-more-2024-guide-6f5f658d30cf
Best 4 Methods to Build a PDF Viewer in React.js: PDF.js, react-pdf, and More (2024 Guide) 🚀 | by Kittisak Ma | Medium
July 21, 2025 - A simple way to display PDFs in React is by using an <iframe>, <embed>, or <object> element. These methods leverage the browser’s built-in PDF capabilities, allowing you to embed the PDF directly into your app.
🌐
Nutrient
nutrient.io › blog › sdk › how to display a pdf in react
How to display a PDF in React - Nutrient
April 21, 2025 - Nutrient’s web library can open PDFs from various input sources, including: ... In this post, you learned how to display a PDF in React using Nutrient’s Web library. You successfully set up a React project using Vite and displayed a PDF using Nutrient. This setup provides a fast, efficient, ...