
Renderizar HTML en un componente hecho con @react-pdf/renderer
Publicado por Jose Moreno Gomez (3 intervenciones) el 20/10/2021 23:42:17
Un componente hecho con react-pdf de por si no admite html entonces quiero crear una tabla con datos pero que este hecha con react-pdf y no se como hacerlo.
Este es el ejemplo en npm =>
Este es el ejemplo en npm =>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 = () => (
<Document>
<Page size="A4" style={styles.page}>
<View style={styles.section}>
<Text>Section #1</Text>
</View>
<View style={styles.section}>
<Text>Section #2</Text>
</View>
</Page>
</Document>
);
Valora esta pregunta


0