feat : PDF 적용
parent
43507632ab
commit
23a1adfb05
@ -0,0 +1,55 @@
|
||||
import { Document, Page, Text, View, StyleSheet, PDFViewer } from '@react-pdf/renderer';
|
||||
// Create styles
|
||||
const styles = StyleSheet.create({
|
||||
page: {
|
||||
flexDirection: 'row',
|
||||
backgroundColor: '#d11fb6',
|
||||
color: 'white'
|
||||
},
|
||||
section: {
|
||||
margin: 10,
|
||||
padding: 10,
|
||||
flexGrow: 1
|
||||
},
|
||||
viewer: {
|
||||
// width: window.innerWidth / 2, // the pdf viewer will take up all of the width and height
|
||||
// height: window.innerHeight / 2
|
||||
width: '95%', // the pdf viewer will take up all of the width and height
|
||||
height: 650
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
const styles = StyleSheet.create({
|
||||
page: {
|
||||
flexDirection: 'row',
|
||||
backgroundColor: '#E4E4E4'
|
||||
},
|
||||
section: {
|
||||
margin: 10,
|
||||
padding: 10,
|
||||
flexGrow: 1
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
// Create Document Component
|
||||
function BasicDocument() {
|
||||
return (
|
||||
<PDFViewer style={styles.viewer}>
|
||||
{/* Start of the document */}
|
||||
<Document>
|
||||
{/* render a single page */}
|
||||
<Page size="A4" style={styles.page}>
|
||||
<View style={styles.section}>
|
||||
<Text>Hello</Text>
|
||||
</View>
|
||||
<View style={styles.section}>
|
||||
<Text>World</Text>
|
||||
</View>
|
||||
</Page>
|
||||
</Document>
|
||||
</PDFViewer>
|
||||
);
|
||||
}
|
||||
export default BasicDocument;
|
Loading…
Reference in New Issue