Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diegomura/react-pdf
๐ Create PDF files using React
https://github.com/diegomura/react-pdf
flexbox pdf react renderer
Last synced: 7 days ago
JSON representation
๐ Create PDF files using React
- Host: GitHub
- URL: https://github.com/diegomura/react-pdf
- Owner: diegomura
- License: mit
- Created: 2016-10-18T21:33:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-17T21:51:10.000Z (6 months ago)
- Last Synced: 2024-05-23T08:01:51.445Z (6 months ago)
- Topics: flexbox, pdf, react, renderer
- Language: JavaScript
- Homepage: https://react-pdf.org
- Size: 29.5 MB
- Stars: 14,241
- Watchers: 101
- Forks: 1,113
- Open Issues: 484
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-react-cn - react-pdf - Create PDF files using React (Uncategorized / Uncategorized)
- awesome - react-pdf - ๐ Create PDF files using React (JavaScript)
- awesome-react - @react-pdf/renderer - React renderer for creating PDF files on the browser and server. ![](https://img.shields.io/github/stars/diegomura/react-pdf.svg?style=social&label=Star) (UI Components / Viewer)
- awesome-web-cn - react-pdf - ไฝฟ็จ React ๅๅปบ PDF ๆไปถ (Uncategorized / Uncategorized)
- awesome-pdf - pdf
- awesome - diegomura/react-pdf - ๐ Create PDF files using React (JavaScript)
- awesome-learning-resources - react-pdf - Create PDF files using React (Uncategorized / Uncategorized)
- awesome-github-star - react-pdf
- awesome-list - react-pdf
- best-of-react - GitHub - 27% open ยท โฑ๏ธ 17.05.2024): (Others)
- awesome-react-renderer - react-pdf - Create PDF files using React. (File)
- awesome-react - react-pdf - Create PDF files using React (**Awesome React** [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) / React)
- awesome - react-pdf - ๐ Create PDF files using React (JavaScript)
- awesome-react - react-pdf - Create PDF files using React ` ๐ 21 days ago` (React [๐](#readme))
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](https://github.com/wojtekmaj/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](https://opencollective.com/react-pdf#sponsors)]
## Backers
Thank you to all our backers! [[Become a backer](https://opencollective.com/react-pdf#backer)]
## License
MIT ยฉ [Diego Muracciole](http://github.com/diegomura)
---
![](https://img.shields.io/npm/dt/@react-pdf/renderer.svg?style=flat)