1 <object data="http://africau.edu/images/default/sample.pdf" type="application/pdf" width="100%" height="100%">
2 <p>Alternative text - include a link <a href="http://africau.edu/images/default/sample.pdf">to the PDF!</a></p>
3 </object>
4
1/*
2Make sure to install the library
3with yarn
4yarn add @react-pdf/renderer
5with npm
6npm install @react-pdf/renderer --save
7*/
8
9import React from 'react';
10import { Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer';
11
12// Create styles
13const styles = StyleSheet.create({
14 page: {
15 flexDirection: 'row',
16 backgroundColor: '#E4E4E4'
17 },
18 section: {
19 margin: 10,
20 padding: 10,
21 flexGrow: 1
22 }
23});
24
25// Create Document Component
26const MyDocument = () => (
27 <Document>
28 <Page size="A4" style={styles.page}>
29 <View style={styles.section}>
30 <Text>Section #1</Text>
31 </View>
32 <View style={styles.section}>
33 <Text>Section #2</Text>
34 </View>
35 </Page>
36 </Document>
37);