React-pdf-344334
React-pdf-344334
org/
Edit
React-pdf
React renderer for creating PDF files on the browser and server.
Try it out!
Using npm
Using Yarn
1 of 5 20/12/24, 4:18 pm
React-pdf https://react-pdf.org/
Using pnpm
Using Bun
2 of 5 20/12/24, 4:18 pm
React-pdf https://react-pdf.org/
// Create styles
const styles = StyleSheet.create({
page: {
flexDirection: 'row',
backgroundColor: '#E4E4E4'
},
section: {
margin: 10,
padding: 10,
flexGrow: 1
}
});
This will produce a PDF document with a single page. 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.
3 of 5 20/12/24, 4:18 pm
React-pdf https://react-pdf.org/
Save in a file
Render to a stream
ReactPDF.renderToStream(<MyDocument />);
Render in DOM
4 of 5 20/12/24, 4:18 pm
React-pdf https://react-pdf.org/
4. Have fun!
Compatibility →
5 of 5 20/12/24, 4:18 pm