Need help with react-pdf?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

diegomura
9.8K Stars 732 Forks MIT License 697 Commits 183 Opened issues

Description

📄 Create PDF files using React

Services available

!
?

Need anything else?

Contributors list

React renderer for creating PDF files on the browser and server

New react-pdf 2.0 was released. Read about the announcement

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

yarn add @react-pdf/renderer

How it works

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

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

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] 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

FOSSA Status


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.