+0
Daily
16,858
stars
1,348
forks
103
watchers
1,254
prs
2,094
issues
496
releases
README
React renderer for creating PDF files on the browser and server
Lost?
This package is used to _create_ PDFs using React. If you wish to _display_ existing PDFs, you may be looking for react-pdf.
How to install
sh
yarn add @react-pdf/renderer
How it works
jsx
import React from 'react';
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,
},
});
// Create Document Component
const MyDocument = () = (
Section 1
Section 2
);
Web. Render in DOM
jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { PDFViewer } from '@react-pdf/renderer';
const App = () = (
);
ReactDOM.render(, document.getElementById('root'));
Node. Save in a file
jsx
import React from 'react';
import ReactPDF from '@react-pdf/renderer';
ReactPDF.render(, ${__dirname}/example.pdf);
Contributors
This project exists thanks to all the people who contribute. Looking to contribute? Please check our [[contribute]](https://github.com/diegomura/react-pdf/blob/master/.github/CONTRIBUTING.md) document for more details about how to setup a development environment and submitting code.
Sponsors
Thank you to all our sponsors! [Become a sponsors]
Backers
Thank you to all our backers! [Become a backer]
License
MIT © Diego Muracciole
---Top issues
#714PDFViewer not working in mobile browsers?54 comments · 2019-09-11#2675Using custom font causes usePDF instance to indefinitely remain as 'loading'44 comments · 2024-03-14#735Inject external PDFs into react-pdf document21 comments · 2019-10-12#34Add react-native support21 comments · 2017-05-05#664Duplicate rendering of png image20 comments · 2019-07-15#522React Context not handled correctly (react-redux and react-intl)20 comments · 2019-03-11#479Table of Contents19 comments · 2019-02-07#2994Next.js 15 broken renderToStream17 comments · 2024-12-04
Discussions
#3620Is @react-pdf/renderer affected by CVE-2026-122146 (transitive fflate)?1 comments · 2026-11-06#3490HTML export support from react-pdf document1 comments · 2026-08-13#3439Fail to fetch when using URL in <Image/> src1 comments · 2026-06-11#3428Embedded image disappears when zooming or scrolling the PDF in Apple Preview0 comments · 2026-05-20#3378@react-pdf/renderer this package is not able to install2 comments · 2026-04-15#3361How can I force no wrap after a heading <Text> component?1 comments · 2026-04-11#3307React-PDF and maplibre1 comments · 2026-03-11#3276Using react-pdf/renderer inside a browser extension0 comments · 2026-01-15
Latest release
@react-pdf/[email protected] @react-pdf/[email protected] 2026-08-27Minor Changes - 3537 77285e289dcaa588637d19b82461434763709728 Thanks @diegomura! - Add @react-pdf/ui, headless React primitives for building PDF preview and editor interfaces. Repl plus Files, Editor, Document, Pagination, Status, CopyButton and DownloadButton, each taking a Component prop so the library holds the behaviour and the consumer holds the markup. The render pipeline is injected, so the package depends on neither a compiler nor pdfjs-dist. Patch Changes - 3541 47670de4dd12b688c7742160d1b5b77677bb7895 Thanks @diegomura! - Allow playground code to import @react-pdf/tailwind, loade