diegomura /react-pdf

📄 Create PDF files using React

★ 16,858⑂ 1,348👁 103⑃ 1,254● 2,094▤ 496
TypeScriptMITCreated 2016-10-18react-pdf.org
Download: @react-pdf/[email protected]@react-pdf/[email protected] ↓1.0.02026-08-27
+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

Discussions

Latest release

@react-pdf/[email protected] @react-pdf/[email protected] 2026-08-27
Minor 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

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON