react-pdf-levelup 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +40 -0
  2. package/fn/aggAlias.js +21 -0
  3. package/fn/moveComponents.js +129 -0
  4. package/fn/postinstall.js +66 -0
  5. package/fn/upVersion.js +12 -0
  6. package/fn/updateTsconfig.js +10 -0
  7. package/next.config.mjs +6 -0
  8. package/package.json +39 -0
  9. package/public/bg-login.jpg +0 -0
  10. package/public/codigo_guardado.js +1 -0
  11. package/public/css/style.css +751 -0
  12. package/public/dboard/logo.png +0 -0
  13. package/public/favicon.ico +0 -0
  14. package/public/fonts/TimesNewerRoman-Bold.otf +0 -0
  15. package/public/fonts/TimesNewerRoman-BoldItalic.otf +0 -0
  16. package/public/fonts/TimesNewerRoman-Italic.otf +0 -0
  17. package/public/fonts/TimesNewerRoman-Regular.otf +0 -0
  18. package/public/header-pdf.jpg +0 -0
  19. package/public/home/bgHome.jpg +0 -0
  20. package/public/home/bgHome2.jpg +0 -0
  21. package/public/home/download.jpg +0 -0
  22. package/public/home/undraw_elements_re_25t9.svg +1 -0
  23. package/public/home/undraw_project_completed_re_jr7u.svg +1 -0
  24. package/public/home/undraw_shared_goals_re_jvqd.svg +1 -0
  25. package/public/home/undraw_spread_love_re_v3cl.svg +1 -0
  26. package/public/home/undraw_target_re_fi8j.svg +1 -0
  27. package/public/home/undraw_visionary_technology_re_jfp7.svg +1 -0
  28. package/public/logo.png +0 -0
  29. package/public/marca/logo.svg +1 -0
  30. package/src/components/PDF/components/DocumentoTemplate.tsx +140 -0
  31. package/src/components/PDF/components/PDFContent.tsx +192 -0
  32. package/src/components/PDF/core/Etiquetas.tsx +152 -0
  33. package/src/components/PDF/core/Grid.tsx +101 -0
  34. package/src/components/PDF/core/Img.tsx +22 -0
  35. package/src/components/PDF/core/LayoutPDF.tsx +186 -0
  36. package/src/components/PDF/core/Listas.tsx +10 -0
  37. package/src/components/PDF/core/MakePDF.tsx +50 -0
  38. package/src/components/PDF/core/PageElements.tsx +50 -0
  39. package/src/components/PDF/core/Position.tsx +33 -0
  40. package/src/components/PDF/core/Tablet.tsx +121 -0
  41. package/src/components/PDF/core/index.tsx +56 -0
  42. package/src/components/PDF/lib/pdfParser.ts +620 -0
  43. package/src/components/PDF/services/apiService.ts +17 -0
  44. package/src/components/PDF/templates/AllTemplate.tsx +134 -0
  45. package/src/components/PDF/templates/BusinessCardTemplate.tsx +139 -0
  46. package/src/components/PDF/templates/CertificateTemplate.tsx +31 -0
  47. package/src/components/PDF/templates/HeaderFooterTemplate.tsx +61 -0
  48. package/src/components/PDF/templates/InvoiceTemplate.tsx +53 -0
  49. package/src/components/PDF/templates/ProposalTemplate.tsx +246 -0
  50. package/src/components/PDF/templates/ReportTemplate.tsx +57 -0
  51. package/src/components/PDF/templates/ResumeTemplate.tsx +170 -0
  52. package/src/components/PDF/templates/TablasTemplate.tsx +307 -0
  53. package/src/components/PDF/templates/index.ts +9 -0
  54. package/src/components/PDF/view/ColorPicker.tsx +147 -0
  55. package/src/components/PDF/view/Header.tsx +102 -0
  56. package/src/components/PDF/view/HomePDF.tsx +177 -0
  57. package/src/components/PDF/view/SettingsPanel.tsx +703 -0
  58. package/src/pages/AllTemplate.tsx +53 -0
  59. package/src/pages/Documento2.tsx +45 -0
  60. package/src/pages/_app.tsx +6 -0
  61. package/src/pages/_document.tsx +13 -0
  62. package/src/pages/api/generatePDF.ts +74 -0
  63. package/src/pages/api/hello.ts +13 -0
  64. package/src/pages/api/readFile.ts +18 -0
  65. package/src/pages/api/readTemplateFile.ts +26 -0
  66. package/src/pages/api/save.ts +22 -0
  67. package/src/pages/api/saveFile.ts +20 -0
  68. package/src/pages/index.tsx +13 -0
  69. package/src/pages/template/[template].tsx +250 -0
  70. package/tsconfig.json +63 -0
@@ -0,0 +1,152 @@
1
+ import type React from "react"
2
+ import { Text, StyleSheet, Link } from "@react-pdf/renderer"
3
+
4
+ interface TextProps {
5
+ children: React.ReactNode
6
+ style?: any
7
+ href?: string
8
+ }
9
+
10
+ const styles = StyleSheet.create({
11
+ p: {
12
+ fontSize: 12,
13
+ marginBottom: 14,
14
+ lineHeight: 1.5,
15
+ },
16
+ h1: {
17
+ fontSize: 24,
18
+ fontWeight: "bold",
19
+ marginBottom: 12,
20
+ },
21
+ h2: {
22
+ fontSize: 20,
23
+ fontWeight: "bold",
24
+ marginBottom: 10,
25
+ },
26
+ h3: {
27
+ fontSize: 18,
28
+ fontWeight: "bold",
29
+ marginBottom: 8,
30
+ },
31
+ h4: {
32
+ fontSize: 16,
33
+ fontWeight: "bold",
34
+ marginBottom: 6,
35
+ },
36
+ h5: {
37
+ fontSize: 14,
38
+ fontWeight: "bold",
39
+ marginBottom: 4,
40
+ },
41
+ h6: {
42
+ fontSize: 12,
43
+ fontWeight: "bold",
44
+ marginBottom: 0,
45
+ },
46
+ strong: {
47
+ fontWeight: "bold",
48
+ },
49
+ em: {
50
+ fontStyle: "italic",
51
+ },
52
+ u: {
53
+ textDecoration: "underline",
54
+ },
55
+ small: {
56
+ fontSize: 10,
57
+ },
58
+ blockquote: {
59
+ marginLeft: 20,
60
+ marginRight: 20,
61
+ fontStyle: "italic",
62
+ borderLeft: "4px solid #ccc",
63
+ paddingLeft: 10,
64
+ },
65
+ mark: {
66
+ backgroundColor: "yellow",
67
+ },
68
+ A: {
69
+ color: "#3d65fd",
70
+ textDecoration: "none",
71
+ },
72
+ br: {
73
+ width: "100%",
74
+ height: 1,
75
+ marginTop: 7,
76
+ marginBottom: 7,
77
+ },
78
+ })
79
+
80
+ const P: React.FC<TextProps> = ({ children, style }) => {
81
+ return <Text style={[styles.p, style]}>{children}</Text>
82
+ }
83
+
84
+ const H1: React.FC<TextProps> = ({ children, style }) => {
85
+ return <Text style={[styles.h1, style]}>{children}</Text>
86
+ }
87
+
88
+ const H2: React.FC<TextProps> = ({ children, style }) => {
89
+ return <Text style={[styles.h2, style]}>{children}</Text>
90
+ }
91
+
92
+ const H3: React.FC<TextProps> = ({ children, style }) => {
93
+ return <Text style={[styles.h3, style]}>{children}</Text>
94
+ }
95
+
96
+ const H4: React.FC<TextProps> = ({ children, style }) => {
97
+ return <Text style={[styles.h4, style]}>{children}</Text>
98
+ }
99
+
100
+ const H5: React.FC<TextProps> = ({ children, style }) => {
101
+ return <Text style={[styles.h5, style]}>{children}</Text>
102
+ }
103
+
104
+ const H6: React.FC<TextProps> = ({ children, style }) => {
105
+ return <Text style={[styles.h6, style]}>{children}</Text>
106
+ }
107
+
108
+ const Strong: React.FC<TextProps> = ({ children, style }) => {
109
+ return <Text style={[styles.strong, style]}>{children}</Text>
110
+ }
111
+
112
+ const Em: React.FC<TextProps> = ({ children, style }) => {
113
+ return <Text style={[styles.em, style]}>{children}</Text>
114
+ }
115
+
116
+ const U: React.FC<TextProps> = ({ children, style }) => {
117
+ return <Text style={[styles.u, style]}>{children}</Text>
118
+ }
119
+
120
+ const Small: React.FC<TextProps> = ({ children, style }) => {
121
+ return <Text style={[styles.small, style]}>{children}</Text>
122
+ }
123
+
124
+ const Blockquote: React.FC<TextProps> = ({ children, style }) => {
125
+ return <Text style={[styles.blockquote, style]}>{children}</Text>
126
+ }
127
+
128
+ const Mark: React.FC<TextProps> = ({ children, style }) => {
129
+ return <Text style={[styles.mark, style]}>{children}</Text>
130
+ }
131
+
132
+ const A: React.FC<TextProps> = ({ children, style, href }) => {
133
+ return (
134
+ <Link src={href} style={[styles.A, style]}>
135
+ {children}
136
+ </Link>
137
+ )
138
+ }
139
+
140
+ // Add BR component for line breaks
141
+ const BR: React.FC<{ style?: any }> = ({ style }) => {
142
+ return <Text style={[styles.br, style]}>{"\n"}</Text>
143
+ }
144
+
145
+ // Agregar la etiqueta Span después de la etiqueta Mark
146
+ const Span: React.FC<TextProps> = ({ children, style }) => {
147
+ return <Text style={[style]}>{children}</Text>
148
+ }
149
+
150
+ // Exportar la etiqueta Span junto con las demás
151
+ export { P, A, H1, H2, H3, H4, H5, H6, Strong, Em, U, Small, Blockquote, Mark, Span, BR }
152
+
@@ -0,0 +1,101 @@
1
+ import type React from "react"
2
+ import { View, StyleSheet } from "@react-pdf/renderer"
3
+
4
+ interface ContainerProps {
5
+ children: React.ReactNode
6
+ style?: any
7
+ }
8
+
9
+ interface RowProps {
10
+ children: React.ReactNode
11
+ style?: any
12
+ }
13
+
14
+ interface ColProps {
15
+ children: React.ReactNode
16
+ style?: any
17
+ }
18
+
19
+ const styles = StyleSheet.create({
20
+ container: {
21
+ width: "100%",
22
+ paddingHorizontal: 20,
23
+ },
24
+ row: {
25
+ flexDirection: "row",
26
+ flexWrap: "wrap",
27
+ marginHorizontal: -5, // Negative margin to offset column padding
28
+ },
29
+ col: {
30
+ paddingHorizontal: 5,
31
+ },
32
+ col1: { width: "8.33%" },
33
+ col2: { width: "16.66%" },
34
+ col3: { width: "25%" },
35
+ col4: { width: "33.33%" },
36
+ col5: { width: "41.66%" },
37
+ col6: { width: "50%" },
38
+ col7: { width: "58.33%" },
39
+ col8: { width: "66.66%" },
40
+ col9: { width: "75%" },
41
+ col10: { width: "83.33%" },
42
+ col11: { width: "91.66%" },
43
+ col12: { width: "100%" },
44
+ })
45
+
46
+ export const Container: React.FC<ContainerProps> = ({ children, style }) => {
47
+ return <View style={[styles.container, style]}>{children}</View>
48
+ }
49
+
50
+ export const Row: React.FC<RowProps> = ({ children, style }) => {
51
+ return <View style={[styles.row, style]}>{children}</View>
52
+ }
53
+
54
+ export const Col1: React.FC<ColProps> = ({ children, style }) => {
55
+ return <View style={[styles.col, styles.col1, style]}>{children}</View>
56
+ }
57
+
58
+ export const Col2: React.FC<ColProps> = ({ children, style }) => {
59
+ return <View style={[styles.col, styles.col2, style]}>{children}</View>
60
+ }
61
+
62
+ export const Col3: React.FC<ColProps> = ({ children, style }) => {
63
+ return <View style={[styles.col, styles.col3, style]}>{children}</View>
64
+ }
65
+
66
+ export const Col4: React.FC<ColProps> = ({ children, style }) => {
67
+ return <View style={[styles.col, styles.col4, style]}>{children}</View>
68
+ }
69
+
70
+ export const Col5: React.FC<ColProps> = ({ children, style }) => {
71
+ return <View style={[styles.col, styles.col5, style]}>{children}</View>
72
+ }
73
+
74
+ export const Col6: React.FC<ColProps> = ({ children, style }) => {
75
+ return <View style={[styles.col, styles.col6, style]}>{children}</View>
76
+ }
77
+
78
+ export const Col7: React.FC<ColProps> = ({ children, style }) => {
79
+ return <View style={[styles.col, styles.col7, style]}>{children}</View>
80
+ }
81
+
82
+ export const Col8: React.FC<ColProps> = ({ children, style }) => {
83
+ return <View style={[styles.col, styles.col8, style]}>{children}</View>
84
+ }
85
+
86
+ export const Col9: React.FC<ColProps> = ({ children, style }) => {
87
+ return <View style={[styles.col, styles.col9, style]}>{children}</View>
88
+ }
89
+
90
+ export const Col10: React.FC<ColProps> = ({ children, style }) => {
91
+ return <View style={[styles.col, styles.col10, style]}>{children}</View>
92
+ }
93
+
94
+ export const Col11: React.FC<ColProps> = ({ children, style }) => {
95
+ return <View style={[styles.col, styles.col11, style]}>{children}</View>
96
+ }
97
+
98
+ export const Col12: React.FC<ColProps> = ({ children, style }) => {
99
+ return <View style={[styles.col, styles.col12, style]}>{children}</View>
100
+ }
101
+
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Image, StyleSheet } from '@react-pdf/renderer';
3
+
4
+ interface ImgProps {
5
+ src?: string;
6
+ alt?: string;
7
+ style?: any;
8
+ }
9
+
10
+ const styles = StyleSheet.create({
11
+ image: {
12
+ width: '100%',
13
+ height: 'auto',
14
+ marginBottom: 14,
15
+ }
16
+ });
17
+
18
+ const Img: React.FC<ImgProps> = ({ src, alt, style }) => {
19
+ return <Image src={src} style={[styles.image, style]} />;
20
+ }
21
+
22
+ export default Img;
@@ -0,0 +1,186 @@
1
+ import type React from "react"
2
+ import { Page, Document, StyleSheet, Font, Text } from "@react-pdf/renderer"
3
+
4
+ Font.register({
5
+ family: "Times New Roman",
6
+ fonts: [
7
+ { src: "/fonts/TimesNewerRoman-Regular.otf", fontWeight: 400, fontStyle: "normal" },
8
+ { src: "/fonts/TimesNewerRoman-Bold.otf", fontWeight: 700, fontStyle: "normal" },
9
+ { src: "/fonts/TimesNewerRoman-Italic.otf", fontWeight: 400, fontStyle: "italic" },
10
+ { src: "/fonts/TimesNewerRoman-BoldItalic.otf", fontWeight: 700, fontStyle: "italic" }, // Bold Italic
11
+ ],
12
+ })
13
+
14
+ // Definir dimensiones de papel en puntos (1 mm ≈ 2.83 puntos)
15
+ const PAPER_SIZES = {
16
+ A0: [2384, 3370], // 841 × 1189 mm
17
+ A1: [1684, 2384], // 594 × 841 mm
18
+ A2: [1191, 1684], // 420 × 594 mm
19
+ A3: [842, 1191], // 297 × 420 mm
20
+ A4: [595, 842], // 210 × 297 mm
21
+ A5: [420, 595], // 148 × 210 mm
22
+ A6: [298, 420], // 105 × 148 mm
23
+ A7: [210, 298], // 74 × 105 mm
24
+ A8: [147, 210], // 52 × 74 mm
25
+ A9: [105, 147], // 37 × 52 mm
26
+ A10: [74, 105], // 26 × 37 mm
27
+ }
28
+
29
+ const styles = StyleSheet.create({
30
+ page: {
31
+ backgroundColor: "white",
32
+ padding: 72,
33
+ paddingBottom: 72 + 14,
34
+ fontFamily: "Times New Roman",
35
+ fontSize: 12,
36
+ lineHeight: 1.5,
37
+ position: "relative",
38
+
39
+ },
40
+ pageNumber: {
41
+ position: "absolute",
42
+ fontSize: 10,
43
+ top: 792 - 14,
44
+ left: 0,
45
+ right: 0,
46
+ textAlign: "center",
47
+ color: "grey",
48
+ },
49
+ })
50
+
51
+ interface LayoutPDFProps {
52
+ children: React.ReactNode
53
+ size?: string // 'A4', 'A5', 'LETTER', etc.
54
+ orientation?: "portrait" | "landscape"
55
+ backgroundColor?: string
56
+ showPageNumbers?: boolean
57
+ padding?: number | string
58
+ paddingTop?: number
59
+ paddingRight?: number
60
+ paddingBottom?: number
61
+ paddingLeft?: number
62
+ style?: any
63
+ width?: number // Custom width in points
64
+ height?: number // Custom height in points
65
+ fontFamily?: string
66
+ fontSize?: number
67
+ lineHeight?: number
68
+ }
69
+
70
+ // Update the LayoutPDF component to properly handle all props
71
+ const LayoutPDF: React.FC<LayoutPDFProps> = ({
72
+ children,
73
+ size = "A4",
74
+ orientation = "portrait",
75
+ backgroundColor = "white",
76
+ showPageNumbers = true,
77
+ padding = 72,
78
+ paddingTop,
79
+ paddingRight,
80
+ paddingBottom,
81
+ paddingLeft,
82
+ style = {},
83
+ width,
84
+ height,
85
+ fontFamily = "Helvetica",
86
+ fontSize = 12,
87
+ lineHeight = 1.5,
88
+ }) => {
89
+ // Create page style with all the props
90
+ const pageStyle = {
91
+ ...styles.page,
92
+ backgroundColor,
93
+ fontFamily,
94
+ fontSize,
95
+ lineHeight,
96
+ ...style,
97
+ }
98
+
99
+ // Handle padding
100
+ if (
101
+ paddingTop !== undefined ||
102
+ paddingRight !== undefined ||
103
+ paddingBottom !== undefined ||
104
+ paddingLeft !== undefined
105
+ ) {
106
+ // Individual padding values
107
+ if (paddingTop !== undefined) pageStyle.paddingTop = paddingTop
108
+ if (paddingRight !== undefined) pageStyle.paddingRight = paddingRight
109
+ if (paddingBottom !== undefined) pageStyle.paddingBottom = paddingBottom
110
+ if (paddingLeft !== undefined) pageStyle.paddingLeft = paddingLeft
111
+ } else {
112
+ // Uniform padding
113
+ pageStyle.padding = padding
114
+ if (showPageNumbers) {
115
+ pageStyle.paddingBottom = Number(padding) + 14
116
+ }
117
+ }
118
+
119
+ // Determine the props to pass to the Page component
120
+ let pageProps: any = {}
121
+
122
+ // Check if we need to use custom paper size dimensions
123
+ const customSize = PAPER_SIZES[size.toUpperCase() as keyof typeof PAPER_SIZES]
124
+
125
+ if (customSize) {
126
+ // Use custom dimensions for the paper size
127
+ const [pageWidth, pageHeight] = customSize
128
+
129
+ if (orientation === "landscape") {
130
+ pageProps = {
131
+ style: pageStyle,
132
+ size: [pageHeight, pageWidth],
133
+ }
134
+ } else {
135
+ pageProps = {
136
+ style: pageStyle,
137
+ size: [pageWidth, pageHeight],
138
+ }
139
+ }
140
+
141
+ console.log(`Using custom size for ${size}: ${JSON.stringify(pageProps.size)}`)
142
+ } else if (width && height) {
143
+ // If explicit width and height are provided
144
+ pageProps = {
145
+ style: pageStyle,
146
+ size: [width, height],
147
+ }
148
+ } else {
149
+ // Use standard size and orientation
150
+ pageProps = {
151
+ size,
152
+ orientation,
153
+ style: pageStyle,
154
+ }
155
+ }
156
+
157
+ // Adjust page number position based on page size
158
+ let pageNumberStyle = { ...styles.pageNumber }
159
+
160
+ if (customSize) {
161
+ const [pageWidth, pageHeight] = customSize
162
+ const actualHeight = orientation === "landscape" ? pageWidth : pageHeight
163
+ pageNumberStyle = {
164
+ ...pageNumberStyle,
165
+ top: actualHeight - 80,
166
+ }
167
+ }
168
+
169
+ return (
170
+ <Document>
171
+ <Page {...pageProps}>
172
+ {children}
173
+ {(
174
+ <Text
175
+ style={pageNumberStyle}
176
+ render={({ pageNumber, totalPages }) => `${pageNumber} / ${totalPages}`}
177
+ fixed
178
+ />
179
+ )}
180
+ </Page>
181
+ </Document>
182
+ )
183
+ }
184
+
185
+ export default LayoutPDF
186
+
@@ -0,0 +1,10 @@
1
+
2
+ interface ListaProps {
3
+
4
+ }
5
+
6
+ const Lista: React.FC<ListaProps> = () => {
7
+ return ( <></> );
8
+ }
9
+
10
+ export default Lista;
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import dynamic from 'next/dynamic';
3
+ import { BlobProvider } from "@react-pdf/renderer";
4
+ // import { BtnNormalBasic} from "@btn";
5
+
6
+ interface MakePDFProps {
7
+ namePDF?: string;
8
+ document: React.ReactElement;
9
+ children?: React.ReactNode;
10
+ }
11
+
12
+ const MakePDF: React.FC<MakePDFProps> = ({ namePDF = "documento.pdf", document, children = "Descargar PDF" }) => {
13
+ // Verifica si estamos en un entorno de navegador
14
+ if (typeof window === 'undefined') {
15
+ return null;
16
+ }
17
+
18
+ return (
19
+ <BlobProvider document={document}>
20
+ {({ blob, url, loading, error }) => {
21
+ // Si el PDF aún se está generando, muestra un texto de carga
22
+ if (loading) {
23
+ return "Cargando documento...";
24
+ }
25
+
26
+ // Si hay un error, muéstralo
27
+ if (error) {
28
+ return `Error: ${error.message}`;
29
+ }
30
+
31
+ // Crea una URL para el blob
32
+ let pdfURL = "";
33
+ if (blob !== null) {
34
+ pdfURL = URL.createObjectURL(blob);
35
+ }
36
+
37
+ // Cuando el PDF esté listo, muestra un enlace para descargarlo
38
+ return (
39
+ <div className="containerDownload">
40
+ <a href={pdfURL} download={namePDF}>
41
+ {children}
42
+ </a>
43
+ </div>
44
+ );
45
+ }}
46
+ </BlobProvider>
47
+ );
48
+ };
49
+
50
+ export default dynamic(() => Promise.resolve(MakePDF), { ssr: false });
@@ -0,0 +1,50 @@
1
+ import type React from "react"
2
+ import { Text, View, StyleSheet } from "@react-pdf/renderer"
3
+
4
+ interface PageElementProps {
5
+ children: React.ReactNode
6
+ style?: any
7
+ fixed?: boolean
8
+ }
9
+
10
+ const styles = StyleSheet.create({
11
+ header: {
12
+ position: "absolute",
13
+ top: 20,
14
+ left: 0,
15
+ right: 0,
16
+ textAlign: "center",
17
+ fontSize: 10,
18
+ color: "#666",
19
+ paddingHorizontal: 40,
20
+ },
21
+ footer: {
22
+ position: "absolute",
23
+ bottom: 20,
24
+ left: 0,
25
+ right: 0,
26
+ textAlign: "center",
27
+ fontSize: 10,
28
+ color: "#666",
29
+ paddingHorizontal: 40,
30
+ },
31
+ })
32
+
33
+ const Header: React.FC<PageElementProps> = ({ children, style, fixed = false }) => {
34
+ return (
35
+ <View style={[styles.header, style]} fixed={fixed}>
36
+ {typeof children === "string" ? <Text>{children}</Text> : children}
37
+ </View>
38
+ )
39
+ }
40
+
41
+ const Footer: React.FC<PageElementProps> = ({ children, style, fixed = false }) => {
42
+ return (
43
+ <View style={[styles.footer, style]} fixed={fixed}>
44
+ {typeof children === "string" ? <Text>{children}</Text> : children}
45
+ </View>
46
+ )
47
+ }
48
+
49
+ export { Header, Footer }
50
+
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { View, StyleSheet } from '@react-pdf/renderer';
3
+
4
+ interface PositionProps {
5
+ children: React.ReactNode;
6
+ style?: any;
7
+ }
8
+
9
+ const styles = StyleSheet.create({
10
+ left: {
11
+ textAlign: 'left',
12
+ },
13
+ right: {
14
+ textAlign: 'right',
15
+ },
16
+ center: {
17
+ textAlign: 'center',
18
+ }
19
+ });
20
+
21
+ const Left: React.FC<PositionProps> = ({ children, style }) => {
22
+ return <View style={[styles.left, style]}>{children}</View>;
23
+ };
24
+
25
+ const Right: React.FC<PositionProps> = ({ children, style }) => {
26
+ return <View style={[styles.right, style]}>{children}</View>;
27
+ };
28
+
29
+ const Center: React.FC<PositionProps> = ({ children, style }) => {
30
+ return <View style={[styles.center, style]}>{children}</View>;
31
+ };
32
+
33
+ export { Left, Right, Center };