Professional Documents
Culture Documents
Install React and React-Pdf: Something, You Still Need To Have React To Make It Work (And React
Install React and React-Pdf: Something, You Still Need To Have React To Make It Work (And React
Install React and React-Pdf: Something, You Still Need To Have React To Make It Work (And React
// 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.
ReactPDF.render(<MyDocument />,
`${__dirname}/example.pdf`);
Render in DOM
import React from 'react';
import ReactDOM from 'react-dom';
import { PDFViewer } from '@react-pdf/renderer';
Render in mobile
In progress...
4. Have fun!