In case you face the same problem, I found something that help. Replace PDFViewer for the code below:
<PDFDownloadLink document={<FeeAcceptance />} fileName="fee_acceptance.pdf">
{({ blob, url, loading, error }) => (loading ? 'Loading document...' : 'Download now!')}
</PDFDownloadLink>
https://react-pdf.org/components
Answer from Ronildo Braga Junior on Stack OverflowCodeSandbox
codesandbox.io › examples › package › @react-pdf › renderer
react-pdf/renderer examples
react-responsive-navigationA simple React.JS Responsive Navigation with React Router and Styled Components.
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
Videos
14:28
This React PDF-Viewer Component Is Amazing! - YouTube
21:17
Dynamically Render Resume PDFs In Next.js With react-pdf - YouTube
15:35
How to generate PDF in React using React pdf - YouTube
15:24
Ultimate Guide to Create PDFs in React with react-pdfrenderer | ...
07:26
Create Custom PDF Viewer using React PDF & React Hooks - YouTube
11:12
ReactPDF Basic Setup - YouTube
npm
npmjs.com › package › @react-pdf › renderer
react-pdf/renderer
import { Document, Page, Text, View, StyleSheet } from '@react-pdf/renderer'; // Create styles const styles = StyleSheet.create({ page: { flexDirection: 'row', backgroundColor: '#E4E4E4', }, section: { margin: 10, padding: 10, flexGrow: 1, }, ...
» npm install @react-pdf/renderer
Published Sep 23, 2025
Version 4.3.1
Author Diego Muracciole
Repository https://github.com/diegomura/react-pdf
GitHub
github.com › diegomura › react-pdf
GitHub - diegomura/react-pdf: 📄 Create PDF files using React
import React from 'react'; import ReactDOM from 'react-dom'; import { PDFViewer } from '@react-pdf/renderer'; const App = () => ( <PDFViewer> <MyDocument /> </PDFViewer> ); ReactDOM.render(<App />, document.getElementById('root'));
Starred by 16.2K users
Forked by 1.3K users
Languages TypeScript 83.1% | JavaScript 16.8%
GitHub
github.com › wojtekmaj › react-pdf
GitHub - wojtekmaj/react-pdf: Display PDFs in your React app as easily as if they were images.
Check the sample directory in this repository for a full working example. For more examples and more advanced use cases, check Recipes in React-PDF Wiki. If you want to use annotations (e.g. links) in PDFs rendered by React-PDF, then you would need to include stylesheet necessary for annotations ...
Starred by 10.7K users
Forked by 981 users
Languages TypeScript 94.3% | CSS 5.6% | HTML 0.1%
npm
npmjs.com › package › react-pdf
react-pdf - npm
Check the sample directory in this repository for a full working example. For more examples and more advanced use cases, check Recipes in React-PDF Wiki. If you want to use annotations (e.g. links) in PDFs rendered by React-PDF, then you would need to include stylesheet necessary for annotations ...
» npm install react-pdf
Published Oct 09, 2025
Version 10.2.0
Author Wojciech Maj
Repository https://github.com/wojtekmaj/react-pdf
Top answer 1 of 2
21
In case you face the same problem, I found something that help. Replace PDFViewer for the code below:
<PDFDownloadLink document={<FeeAcceptance />} fileName="fee_acceptance.pdf">
{({ blob, url, loading, error }) => (loading ? 'Loading document...' : 'Download now!')}
</PDFDownloadLink>
https://react-pdf.org/components
2 of 2
4
We can also use ReactPDF.pdf. here's a small code sample of an async function that returns a url (or even blob if the case requires !). We can use this url to download our PDF.
renderUrl = async() => new Promise((resolve, reject) => {
const blob = await ReactPDF.pdf(<FeeAcceptance member_detail={'test'} />).toBlob()
const url = URL.createObjectURL(blob)
if(url && url.length>0){
resolve(url)
}
}
).then(res => res).catch(err => console.log(err))
To Download the generated url we can use the download attribute of a tag. Here's an example
let sampleTab = window.open()
if(sampleTab) {
renderUrl().then(generatedUrl => {
if( generatedUrl ){
let aTag = document.createElement('a')
aTag.href = generatedUrl
aTag.style = "display: none";
aTag.download = 'FeeAcceptance.pdf'
document.body.appendChild(aTag)
aTag.click()
} // else -> means something went wrong during pdf generation
}).catch(err => console.log(err))
} // else -> means new tab can't be opened ... (some Adblock issue)
LogRocket
blog.logrocket.com › home › generating pdfs in react with react-pdf
Generating PDFs in React with react-pdf - LogRocket Blog
January 24, 2025 - Furthermore, in the viewer object, we are using the width and height properties. As a result, this will tell react-pdf that we want the browser’s PDF viewer to take up all of the space on the page · As the name suggests, the PDFViewer component will render a PDF viewer on the browser
CodeSandbox
codesandbox.io › examples › package › react-pdf
react-pdf examples - CodeSandbox
reactReact example starter project · pdf-viwer · pdf-reader · pdf-view · coolenginner/pdf-edit-react · pdf-sign · react-doc-viewerDocument viewer for react. Renders online/local documents. react-pdf-react-pageflip · react-pdf-sample-forked-displaying-pdf-using-react ·
React-pdf
v1.react-pdf.org
React-pdf
Inside, two different blocks, each of them rendering a different text. These are not the only valid primitives you can use. Please refer to the Components or Examples sections for more information. React-pdf enables you to render the document in three different environments: web, server and ...
Apryse
apryse.com › blog › build-custom-react-pdf-viewer-v2
Build a React PDF Viewer |Apryse
If you are using React 18 (which is the current default version at the time of writing this article), then it is likely to implement StrictMode which causes the React Components to render twice during development. While that does not occur with production builds, it can be very confusing during development, so you may wish to remove the <React.StrictMode> element from main.jsx. You can now create a reusable PDF Viewer component in your React app. In our example, though, we will keep things simple and just add the code directly to `App.js`.
Published October 14, 2024