react pdf

Solutions on MaxInterview for react pdf by the best coders in the world

showing results for - "react pdf"
Angelo
20 Nov 2016
1import React from 'react';
2import { Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer';
3
4// Create styles
5const styles = StyleSheet.create({
6  page: {
7    flexDirection: 'row',
8    backgroundColor: '#E4E4E4'
9  },
10  section: {
11    margin: 10,
12    padding: 10,
13    flexGrow: 1
14  }
15});
16
17// Create Document Component
18const MyDocument = () => (
19  <Document>
20    <Page size="A4" style={styles.page}>
21      <View style={styles.section}>
22        <Text>Section #1</Text>
23      </View>
24      <View style={styles.section}>
25        <Text>Section #2</Text>
26      </View>
27    </Page>
28  </Document>
29);
30