react-pdf-levelup 3.1.59 → 3.1.63

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../frontend/src/functions/decodeBase64Pdf.ts","../../frontend/src/functions/generatePDF.ts","../../frontend/src/components/core/LayoutPDF.tsx","../../frontend/src/components/core/Img.tsx","../../frontend/src/components/core/Position.tsx","../../frontend/src/components/core/Etiquetas.tsx","../../frontend/src/components/core/Tablet.tsx","../../frontend/src/components/core/Grid.tsx","../../frontend/src/components/core/QRGenerator.ts","../../frontend/src/components/core/QR.tsx","../../frontend/src/components/core/QRGeneratorV2.ts","../../frontend/src/components/core/QRV2.tsx","../../frontend/src/components/core/Lista.tsx","../../frontend/src/components/core/ImgBg.tsx"],"names":["decodeBase64Pdf","base64","fileName","byteCharacters","byteNumbers","i","byteArray","blob","blobUrl","link","decodeBase64Pdf_default","generatePDF","Template","data","MyDocument","createElement","stream","renderToStream","resolve","reject","chunks","chunk","error","generatePDF_default","styles","StyleSheet","LayoutPDF","children","size","orientation","backgroundColor","padding","margen","style","pagination","footer","lines","rule","footerHeight","getMargins","pageSize","normalizedSize","safeSize","safeOrientation","safeBackgroundColor","safeLines","safeMargen","e","transformOrientation","getFooterPosition","pageDimensions","mmToPoints","dimensions","heightInPoints","widthInPoints","pdfOrientation","margins","footerTop","renderGrid","cmToPoints","pageWidth","pageHeight","horizontalLines","verticalLines","jsx","View","jsxs","pageStyle","footerStyle","Document","Page","Text","pageNumber","totalPages","LayoutPDF_default","Img","src","Image","Img_default","Left","Right","Center","P","H1","H2","H3","H4","H5","H6","Strong","Em","U","Small","Blockquote","Mark","A","href","Link","BR","HR","Span","Header","fixed","Div","TableContext","createContext","Table","cellHeight","Thead","textAlign","useContext","Tbody","rows","React","count","Fragment","row","idx","Tr","isLastRow","isOdd","elements","child","isLast","width","Th","height","colSpan","propTextAlign","contextTextAlign","finalTextAlign","baseWidth","borders","Td","Container","Row","Col1","Col2","Col3","Col4","Col5","Col6","Col7","Col8","Col9","Col10","Col11","Col12","generateQRAsBase64","value","colorDark","colorLight","margin","errorCorrectionLevel","options","QRCode","addLogoToQR","qrDataUrl","logoUrl","logoWidth","logoHeight","isBrowser","canvas","ctx","ImageConstructor","createCanvas","qrImage","logoImage","x","y","finalQrDataUrl","err","errorLevelMap","QR","logo","setQrDataUrl","useState","useEffect","baseQrDataUrl","qrWithLogo","fallbackUrl","QR_default","generateQRV2AsBase64","QRCodeStylingConstructor","extraOptions","mod","jsdomName","canvasName","qrCommonName","jsdomMod","canvasMod","qrCommonMod","JSDOM","nodeCanvas","QRCodeStyling","hasImage","qrOptions","rawData","reader","QRV2","image","dotsOptions","backgroundOptions","imageOptions","cornersSquareOptions","cornersDotOptions","isMounted","finalDotsOptions","finalBackgroundOptions","finalImageOptions","dataUrl","QRV2_default","getBulletPoint","type","getOrderedMarker","index","start","actualIndex","toRoman","num","romanNumerals","UL","childrenWithBullets","OL","childrenWithNumbers","LI","bulletType","isOrdered","marker","ImgBg","opacity","objectFit","objectPosition","ImgBg_default"],"mappings":"sUAAMA,EAAAA,CAAkB,CAACC,EAAgBC,CAAAA,GAAqB,CAC5D,IAAMC,CAAAA,CAAiB,IAAA,CAAKF,CAAM,CAAA,CAC5BG,CAAAA,CAAc,IAAI,MAAMD,CAAAA,CAAe,MAAM,EACnD,IAAA,IAASE,CAAAA,CAAI,EAAGA,CAAAA,CAAIF,CAAAA,CAAe,MAAA,CAAQE,CAAAA,EAAAA,CACzCD,CAAAA,CAAYC,CAAC,EAAIF,CAAAA,CAAe,UAAA,CAAWE,CAAC,CAAA,CAE9C,IAAMC,EAAY,IAAI,UAAA,CAAWF,CAAW,CAAA,CACtCG,CAAAA,CAAO,IAAI,KAAK,CAACD,CAAS,EAAG,CAAE,IAAA,CAAM,iBAAkB,CAAC,CAAA,CACxDE,CAAAA,CAAU,GAAA,CAAI,eAAA,CAAgBD,CAAI,EAGxC,GAAI,QAA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,EACX,CAAA,CACAtC,GAAAA,CAACC,IAAAA,CAAA,CAAK,MAAOzC,EAAAA,CAAO,OAAA,CAAU,SAAAG,CAAAA,CAAS,CAAA,CAAA,CAC3C,EAID8M,EAAAA,CAAQJ","file":"index.js","sourcesContent":["const decodeBase64Pdf = (base64: string, fileName: string) => {\r\n const byteCharacters = atob(base64);\r\n const byteNumbers = new Array(byteCharacters.length);\r\n for (let i = 0; i < byteCharacters.length; i++) {\r\n byteNumbers[i] = byteCharacters.charCodeAt(i);\r\n }\r\n const byteArray = new Uint8Array(byteNumbers);\r\n const blob = new Blob([byteArray], { type: 'application/pdf' });\r\n const blobUrl = URL.createObjectURL(blob);\r\n\r\n\r\n if (document === undefined) {\r\n console.error(\"document is undefined, only works in browser context\");\r\n return;\r\n }\r\n\r\n // Crear un enlace para descargar el archivo\r\n const link = document.createElement('a');\r\n link.href = blobUrl;\r\n link.download = fileName;\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n\r\n // Abrir el PDF en una nueva pestaña\r\n window.open(blobUrl, '_blank');\r\n\r\n // Revocar el objeto URL después de un tiempo\r\n setTimeout(() => {\r\n URL.revokeObjectURL(blobUrl);\r\n }, 100);\r\n};\r\n\r\nexport default decodeBase64Pdf;","import { renderToStream } from \"@react-pdf/renderer\";\r\nimport { createElement } from \"react\";\r\n\r\ninterface PDFData {\r\n template: React.ElementType;\r\n data?: any;\r\n}\r\n\r\nconst generatePDF = async ({ template: Template, data }: PDFData): Promise<string> => {\r\n try {\r\n if (!Template) {\r\n throw new Error(\"Template not provided\");\r\n }\r\n\r\n // Crear el componente con los datos\r\n const MyDocument = createElement(Template, { data });\r\n\r\n // Renderizar a stream\r\n const stream = await renderToStream(MyDocument);\r\n\r\n const base64String: string = await new Promise((resolve, reject) => {\r\n const chunks: Buffer[] = [];\r\n stream.on(\"data\", (chunk) => chunks.push(chunk));\r\n stream.on(\"end\", () => resolve(Buffer.concat(chunks).toString(\"base64\")));\r\n stream.on(\"error\", (error) => reject(error));\r\n });\r\n\r\n return base64String;\r\n } catch (error) {\r\n throw new Error(\"Error generating PDF: \" + (error instanceof Error ? error.message : \"Unknown error\"));\r\n }\r\n};\r\n\r\nexport default generatePDF;\r\n","import React from \"react\"\r\nimport { Page, Document, StyleSheet, Text, View } from \"@react-pdf/renderer\"\r\n\r\nconst styles = StyleSheet.create({\r\n page: {\r\n backgroundColor: \"white\",\r\n padding: 30,\r\n fontFamily: \"Helvetica\",\r\n fontSize: 14,\r\n },\r\n footer: {\r\n position: \"absolute\",\r\n left: 0,\r\n right: 0,\r\n textAlign: \"center\",\r\n }\r\n})\r\n\r\ninterface LayoutPDFProps {\r\n children: React.ReactNode\r\n size?: string\r\n orientation?: \"vertical\" | \"horizontal\" | \"h\" | \"v\" | \"portrait\" | \"landscape\"\r\n backgroundColor?: string\r\n padding?: number\r\n margen?: \"apa\" | \"normal\" | \"estrecho\" | \"ancho\"\r\n style?: any\r\n pagination?: boolean\r\n footer?: React.ReactNode\r\n lines?: number\r\n rule?: boolean\r\n}\r\n\r\nconst LayoutPDF: React.FC<LayoutPDFProps> = ({\r\n children,\r\n size = \"A4\",\r\n orientation = \"vertical\",\r\n backgroundColor = \"white\",\r\n padding = 30,\r\n margen = \"normal\",\r\n style = {},\r\n pagination = true,\r\n footer,\r\n lines = footer ? 2 : 1,\r\n rule = false,\r\n}) => {\r\n // Calculate footer height based on number of lines\r\n // Each line is approximately 20 points (considering font size and line height)\r\n const LINE_HEIGHT = 20\r\n const FOOTER_PADDING = 10\r\n const footerHeight = (lines * LINE_HEIGHT) + FOOTER_PADDING\r\n\r\n // Función para obtener márgenes según las normas APA y otros estándares\r\n const getMargins = (margen: string, pageSize: string) => {\r\n const normalizedSize = pageSize.toUpperCase()\r\n\r\n switch (margen) {\r\n case \"apa\":\r\n // Normas APA: 1 pulgada en todos los lados (72 puntos)\r\n if (normalizedSize === \"LETTER\" || normalizedSize === \"LEGAL\") {\r\n return {\r\n paddingTop: 72,\r\n paddingRight: 72,\r\n paddingBottom: 72,\r\n paddingLeft: 72\r\n }\r\n }\r\n // Para otros tamaños, usar equivalente proporcional\r\n return {\r\n paddingTop: 72,\r\n paddingRight: 72,\r\n paddingBottom: 72,\r\n paddingLeft: 72\r\n }\r\n\r\n case \"estrecho\":\r\n return {\r\n paddingTop: 36,\r\n paddingRight: 36,\r\n paddingBottom: 36,\r\n paddingLeft: 36\r\n }\r\n\r\n case \"ancho\":\r\n return {\r\n paddingTop: 108,\r\n paddingRight: 108,\r\n paddingBottom: 108,\r\n paddingLeft: 108\r\n }\r\n\r\n case \"normal\":\r\n default:\r\n return {\r\n paddingTop: padding,\r\n paddingRight: padding,\r\n paddingBottom: padding,\r\n paddingLeft: padding\r\n }\r\n }\r\n }\r\n\r\n // Validar y sanitizar props\r\n let safeSize = size\r\n let safeOrientation = orientation\r\n let safeBackgroundColor = backgroundColor\r\n let safeLines = Math.max(1, Math.min(lines, 10)) // Limit between 1 and 10 lines\r\n let safeMargen = margen\r\n\r\n try {\r\n // Validar size\r\n const validSizes = [\"A0\", \"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\", \"A7\", \"A8\", \"A9\", \"LETTER\", \"LEGAL\", \"TABLOID\"]\r\n if (typeof size === \"string\" && !validSizes.includes(size.toUpperCase())) {\r\n console.warn(`Invalid page size: ${size}. Using A4 as default.`)\r\n safeSize = \"A4\"\r\n }\r\n\r\n // Validar orientation\r\n if (orientation !== \"vertical\" && orientation !== \"horizontal\") {\r\n console.warn(`Invalid orientation: ${orientation}. Using vertical as default.`)\r\n safeOrientation = \"vertical\"\r\n }\r\n\r\n // Validar backgroundColor\r\n if (typeof backgroundColor !== \"string\") {\r\n console.warn(`Invalid background color: ${backgroundColor}. Using white as default.`)\r\n safeBackgroundColor = \"white\"\r\n }\r\n\r\n // Validar margen\r\n const validMargins = [\"apa\", \"normal\", \"estrecho\", \"ancho\"]\r\n if (!validMargins.includes(margen)) {\r\n console.warn(`Invalid margin type: ${margen}. Using normal as default.`)\r\n safeMargen = \"normal\"\r\n }\r\n\r\n // Validar lines\r\n if (typeof lines !== \"number\" || lines < 1) {\r\n console.warn(`Invalid lines value: ${lines}. Using 1 as default.`)\r\n safeLines = 1\r\n }\r\n } catch (e) {\r\n console.warn(\"Error processing props in LayoutPDF:\", e)\r\n }\r\n\r\n // Transform orientation from \"vertical\"/\"horizontal\" to \"portrait\"/\"landscape\"\r\n const transformOrientation = (orientation: \"vertical\" | \"horizontal\" | \"h\" | \"v\" | \"portrait\" | \"landscape\"): \"portrait\" | \"landscape\" => {\r\n switch (orientation) {\r\n case \"vertical\":\r\n case \"portrait\":\r\n case \"v\":\r\n return \"portrait\"\r\n case \"horizontal\":\r\n case \"landscape\":\r\n case \"h\":\r\n return \"landscape\"\r\n default:\r\n console.warn(`Unrecognized orientation: ${orientation}. Using portrait as default.`)\r\n return \"portrait\"\r\n }\r\n }\r\n\r\n // Function to calculate footer position based on size and orientation\r\n const getFooterPosition = (pageSize: string, orientation: \"portrait\" | \"landscape\", footerHeight: number) => {\r\n // Dimensions in millimeters according to ISO 216 standard\r\n const pageDimensions: Record<string, { width: number; height: number }> = {\r\n A0: { width: 841, height: 1189 },\r\n A1: { width: 594, height: 841 },\r\n A2: { width: 420, height: 594 },\r\n A3: { width: 297, height: 420 },\r\n A4: { width: 210, height: 297 },\r\n A5: { width: 148, height: 210 },\r\n A6: { width: 105, height: 148 },\r\n A7: { width: 74, height: 105 },\r\n A8: { width: 52, height: 74 },\r\n A9: { width: 37, height: 52 },\r\n LETTER: { width: 216, height: 279 },\r\n LEGAL: { width: 216, height: 356 },\r\n TABLOID: { width: 279, height: 432 },\r\n }\r\n\r\n // Convert mm to points (1mm = 2.834645669 points)\r\n const mmToPoints = 2.834645669\r\n\r\n const dimensions = pageDimensions[pageSize.toUpperCase()]\r\n if (!dimensions) {\r\n // A4 default in points\r\n return orientation === \"landscape\" ? 595 - footerHeight - 10 : 842 - footerHeight - 10\r\n }\r\n\r\n const heightInPoints = dimensions.height * mmToPoints\r\n const widthInPoints = dimensions.width * mmToPoints\r\n\r\n // Subtract footer height and additional margin\r\n return orientation === \"landscape\"\r\n ? widthInPoints - footerHeight - 10\r\n : heightInPoints - footerHeight - 10\r\n }\r\n\r\n const pdfOrientation = transformOrientation(safeOrientation)\r\n\r\n // Obtener márgenes según el tipo seleccionado\r\n const margins = getMargins(safeMargen, safeSize)\r\n\r\n // Calculate footer position based on calculated footer height\r\n const footerTop = getFooterPosition(safeSize, pdfOrientation, footerHeight)\r\n\r\n // Function to render grid (ruler)\r\n const renderGrid = () => {\r\n if (!rule) return null\r\n\r\n // 1 cm = 28.3465 points\r\n const cmToPoints = 28.3465\r\n \r\n // Get page dimensions in points\r\n const pageDimensions: Record<string, { width: number; height: number }> = {\r\n A0: { width: 841 * 2.834645669, height: 1189 * 2.834645669 },\r\n A1: { width: 594 * 2.834645669, height: 841 * 2.834645669 },\r\n A2: { width: 420 * 2.834645669, height: 594 * 2.834645669 },\r\n A3: { width: 297 * 2.834645669, height: 420 * 2.834645669 },\r\n A4: { width: 210 * 2.834645669, height: 297 * 2.834645669 },\r\n A5: { width: 148 * 2.834645669, height: 210 * 2.834645669 },\r\n A6: { width: 105 * 2.834645669, height: 148 * 2.834645669 },\r\n A7: { width: 74 * 2.834645669, height: 105 * 2.834645669 },\r\n A8: { width: 52 * 2.834645669, height: 74 * 2.834645669 },\r\n A9: { width: 37 * 2.834645669, height: 52 * 2.834645669 },\r\n LETTER: { width: 216 * 2.834645669, height: 279 * 2.834645669 },\r\n LEGAL: { width: 216 * 2.834645669, height: 356 * 2.834645669 },\r\n TABLOID: { width: 279 * 2.834645669, height: 432 * 2.834645669 },\r\n }\r\n\r\n const dimensions = pageDimensions[safeSize.toUpperCase()] || pageDimensions.A4\r\n const pageWidth = pdfOrientation === \"landscape\" ? dimensions.height : dimensions.width\r\n const pageHeight = pdfOrientation === \"landscape\" ? dimensions.width : dimensions.height\r\n\r\n const horizontalLines = []\r\n const verticalLines = []\r\n\r\n // Generate horizontal lines (every cm)\r\n for (let i = 0; i <= Math.ceil(pageHeight / cmToPoints); i++) {\r\n horizontalLines.push(\r\n <View\r\n key={`h-${i}`}\r\n style={{\r\n position: \"absolute\",\r\n top: i * cmToPoints,\r\n left: 0,\r\n right: 0,\r\n height: i % 5 === 0 ? 1 : 0.5,\r\n backgroundColor: i % 5 === 0 ? \"rgba(255, 0, 0, 0.8)\" : \"rgba(100, 100, 100, 0.5)\",\r\n }}\r\n />\r\n )\r\n }\r\n\r\n // Generate vertical lines (every cm)\r\n for (let i = 0; i <= Math.ceil(pageWidth / cmToPoints); i++) {\r\n verticalLines.push(\r\n <View\r\n key={`v-${i}`}\r\n style={{\r\n position: \"absolute\",\r\n left: i * cmToPoints,\r\n top: 0,\r\n bottom: 0,\r\n width: i % 5 === 0 ? 1 : 0.5,\r\n backgroundColor: i % 5 === 0 ? \"rgba(255, 0, 0, 0.8)\" : \"rgba(100, 100, 100, 0.5)\",\r\n }}\r\n />\r\n )\r\n }\r\n\r\n return (\r\n <View style={{ position: \"absolute\", top: 0, left: 0, right: 0, bottom: 0 }} fixed>\r\n {horizontalLines}\r\n {verticalLines}\r\n </View>\r\n )\r\n }\r\n\r\n const pageStyle = {\r\n ...styles.page,\r\n backgroundColor: safeBackgroundColor,\r\n ...margins,\r\n paddingBottom: margins.paddingBottom + footerHeight,\r\n ...style,\r\n }\r\n\r\n const footerStyle = {\r\n ...styles.footer,\r\n top: footerTop,\r\n height: footerHeight,\r\n display: \"flex\" as const,\r\n flexDirection: \"column\" as const,\r\n justifyContent: \"center\" as const,\r\n alignItems: \"center\" as const,\r\n fontSize: 10,\r\n color: \"grey\"\r\n }\r\n\r\n return (\r\n <Document>\r\n <Page size={safeSize as any} orientation={pdfOrientation} style={pageStyle} wrap>\r\n {renderGrid()}\r\n <View style={{ paddingBottom: footerHeight }}>\r\n {children}\r\n </View>\r\n {pagination ? (\r\n <View style={footerStyle} fixed>\r\n {footer}\r\n <Text style={{ fontSize: footerStyle.fontSize }} render={({ pageNumber, totalPages }) => (\r\n `${pageNumber} / ${totalPages}`\r\n )} />\r\n </View>\r\n ) : null}\r\n </Page>\r\n </Document>\r\n )\r\n}\r\n\r\nexport default LayoutPDF","import React from \"react\"\r\nimport { Image, StyleSheet } from \"@react-pdf/renderer\"\r\n\r\ninterface ImgProps {\r\n src?: string\r\n style?: any\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n image: {\r\n width: \"100%\",\r\n height: \"auto\",\r\n marginBottom: 14,\r\n },\r\n})\r\n\r\nconst Img: React.FC<ImgProps> = ({ src, style }) => {\r\n return <Image src={src} style={[styles.image, style]} />\r\n}\r\n\r\nexport default Img\r\n\r\n","import React from \"react\"\r\nimport { View, StyleSheet } from \"@react-pdf/renderer\"\r\n\r\ninterface PositionProps {\r\n children: React.ReactNode\r\n style?: any\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n left: {\r\n textAlign: \"left\",\r\n },\r\n right: {\r\n textAlign: \"right\",\r\n },\r\n center: {\r\n textAlign: \"center\",\r\n },\r\n})\r\n\r\nconst Left: React.FC<PositionProps> = ({ children, style }) => {\r\n return <View style={[styles.left, style]}>{children}</View>\r\n}\r\n\r\nconst Right: React.FC<PositionProps> = ({ children, style }) => {\r\n return <View style={[styles.right, style]}>{children}</View>\r\n}\r\n\r\nconst Center: React.FC<PositionProps> = ({ children, style }) => {\r\n return <View style={[styles.center, style]}>{children}</View>\r\n}\r\n\r\nexport { Left, Right, Center }\r\n\r\n","import React from \"react\"\r\nimport { Text, StyleSheet, Link, View } from \"@react-pdf/renderer\"\r\n\r\ninterface TextProps {\r\n children: React.ReactNode\r\n style?: any\r\n href?: string\r\n}\r\n\r\ninterface DivProps {\r\n children: React.ReactNode\r\n style?: any\r\n}\r\n\r\ninterface HeaderProps {\r\n children: React.ReactNode\r\n style?: any\r\n fixed?: boolean\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n p: {\r\n fontSize: 12,\r\n marginBottom: 5,\r\n lineHeight: 1.2,\r\n },\r\n h1: {\r\n fontSize: 24,\r\n fontWeight: \"bold\",\r\n marginBottom: 12,\r\n },\r\n h2: {\r\n fontSize: 20,\r\n fontWeight: \"bold\",\r\n marginBottom: 10,\r\n },\r\n h3: {\r\n fontSize: 18,\r\n fontWeight: \"bold\",\r\n marginBottom: 8,\r\n },\r\n h4: {\r\n fontSize: 16,\r\n fontWeight: \"bold\",\r\n marginBottom: 6,\r\n },\r\n h5: {\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n marginBottom: 4,\r\n },\r\n h6: {\r\n fontSize: 12,\r\n fontWeight: \"bold\",\r\n marginBottom: 0,\r\n },\r\n strong: {\r\n fontWeight: \"bold\",\r\n },\r\n em: {\r\n fontStyle: \"italic\",\r\n },\r\n u: {\r\n textDecoration: \"underline\",\r\n },\r\n small: {\r\n fontSize: 10,\r\n },\r\n blockquote: {\r\n marginLeft: 20,\r\n marginRight: 20,\r\n fontStyle: \"italic\",\r\n borderLeft: \"4px solid #ccc\",\r\n paddingLeft: 10,\r\n },\r\n mark: {\r\n backgroundColor: \"yellow\",\r\n },\r\n A: {\r\n color: \"#3d65fd\",\r\n textDecoration: \"none\",\r\n },\r\n br: {\r\n width: \"100%\",\r\n height: 1,\r\n marginTop: 7,\r\n marginBottom: 7,\r\n },\r\n header: {\r\n position: \"absolute\",\r\n top: 20,\r\n left: 0,\r\n right: 0,\r\n textAlign: \"center\",\r\n fontSize: 10,\r\n color: \"#666\",\r\n paddingHorizontal: 40,\r\n },\r\n hr: {\r\n width: \"100%\",\r\n borderTop: \"1px solid #000\",\r\n marginTop: 8,\r\n marginBottom: 8,\r\n },\r\n})\r\n\r\nconst P: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.p, style]}>{children}</Text>\r\n}\r\n\r\nconst H1: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.h1, style]}>{children}</Text>\r\n}\r\n\r\nconst H2: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.h2, style]}>{children}</Text>\r\n}\r\n\r\nconst H3: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.h3, style]}>{children}</Text>\r\n}\r\n\r\nconst H4: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.h4, style]}>{children}</Text>\r\n}\r\n\r\nconst H5: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.h5, style]}>{children}</Text>\r\n}\r\n\r\nconst H6: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.h6, style]}>{children}</Text>\r\n}\r\n\r\nconst Strong: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.strong, style]}>{children}</Text>\r\n}\r\n\r\nconst Em: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.em, style]}>{children}</Text>\r\n}\r\n\r\nconst U: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.u, style]}>{children}</Text>\r\n}\r\n\r\nconst Small: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.small, style]}>{children}</Text>\r\n}\r\n\r\nconst Blockquote: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.blockquote, style]}>{children}</Text>\r\n}\r\n\r\nconst Mark: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[styles.mark, style]}>{children}</Text>\r\n}\r\n\r\nconst A: React.FC<TextProps> = ({ children, style, href }) => {\r\n return (\r\n <Link src={href} style={[styles.A, style]}>\r\n {children}\r\n </Link>\r\n )\r\n}\r\n\r\nconst BR: React.FC<{ style?: any }> = ({ style }) => {\r\n return <Text style={[styles.br, style]}>{\"\\n\"}</Text>\r\n}\r\n\r\nconst HR: React.FC<{ style?: any }> = ({ style }) => {\r\n return <View style={[styles.hr, style]} />\r\n}\r\n\r\nconst Span: React.FC<TextProps> = ({ children, style }) => {\r\n return <Text style={[style]}>{children}</Text>\r\n}\r\n\r\nconst Header: React.FC<HeaderProps> = ({ children, style, fixed = false }) => {\r\n return (\r\n <View style={[styles.header, style]} fixed={fixed}>\r\n {typeof children === \"string\" ? <Text>{children}</Text> : children}\r\n </View>\r\n )\r\n}\r\n\r\nconst Div: React.FC<DivProps> = ({ children, style }) => {\r\n return <View style={style}>{children}</View>\r\n}\r\n\r\nexport { P, A, H1, H2, H3, H4, H5, H6, Strong, Em, U, Small, Blockquote, Mark, Span, BR, HR, Header, Div }","import React, { createContext, useContext } from \"react\";\r\nimport { View, Text, StyleSheet } from \"@react-pdf/renderer\";\r\n\r\ninterface TableProps {\r\n children: React.ReactNode;\r\n style?: any;\r\n cellHeight?: number;\r\n}\r\n\r\ninterface TheadProps {\r\n children: React.ReactNode;\r\n style?: any;\r\n textAlign?: \"left\" | \"center\" | \"right\" | any;\r\n}\r\n\r\ninterface CellProps {\r\n children?: React.ReactNode;\r\n style?: any;\r\n width?: string | number;\r\n height?: string | number;\r\n colSpan?: number;\r\n isLast?: boolean;\r\n isLastRow?: boolean;\r\n isOdd?: boolean;\r\n textAlign?: \"left\" | \"center\" | \"right\" | any;\r\n}\r\n\r\n// Context para pasar cellHeight y textAlign a los componentes hijos\r\nconst TableContext = createContext<{\r\n cellHeight: number;\r\n textAlign?: \"left\" | \"center\" | \"right\" | any;\r\n}>({\r\n cellHeight: 22,\r\n textAlign: \"left\",\r\n});\r\n\r\nconst styles = StyleSheet.create({\r\n table: {\r\n width: \"100%\",\r\n borderWidth: 1,\r\n borderColor: \"#000\",\r\n marginBottom: 20,\r\n },\r\n thead: {\r\n backgroundColor: \"#ccc\",\r\n },\r\n tr: {\r\n flexDirection: \"row\",\r\n },\r\n textBold: {\r\n fontSize: 10,\r\n fontFamily: \"Helvetica\",\r\n fontWeight: \"bold\",\r\n paddingLeft: 8,\r\n paddingRight: 8,\r\n justifyContent: \"center\",\r\n\r\n },\r\n text: {\r\n fontSize: 10,\r\n fontFamily: \"Helvetica\",\r\n paddingLeft: 8,\r\n paddingRight: 8,\r\n justifyContent: \"center\",\r\n\r\n },\r\n zebraOdd: {\r\n backgroundColor: \"#eeeeee\",\r\n },\r\n});\r\n\r\nconst Table: React.FC<TableProps> = ({ children, style, cellHeight = 22 }) => (\r\n <TableContext.Provider value={{ cellHeight, textAlign: \"left\" }}>\r\n <View style={[styles.table, style]}>{children}</View>\r\n </TableContext.Provider>\r\n);\r\n\r\nconst Thead: React.FC<TheadProps> = ({\r\n children,\r\n style,\r\n textAlign = \"left\",\r\n}) => {\r\n const { cellHeight } = useContext(TableContext);\r\n\r\n return (\r\n <TableContext.Provider value={{ cellHeight, textAlign }}>\r\n <View style={[styles.thead, style]}>{children}</View>\r\n </TableContext.Provider>\r\n );\r\n};\r\n\r\nconst Tbody: React.FC<TableProps> = ({ children, style }) => {\r\n const rows = React.Children.toArray(children) as React.ReactElement<any>[];\r\n const count = rows.length;\r\n return (\r\n <>\r\n {rows.map((row, idx) =>\r\n React.cloneElement(row, {\r\n isLastRow: idx === count - 1,\r\n isOdd: idx % 2 === 1,\r\n })\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nconst Tr: React.FC<TableProps & { isLastRow?: boolean; isOdd?: boolean }> = ({\r\n children,\r\n style,\r\n isLastRow = false,\r\n isOdd = false,\r\n}) => {\r\n const elements = React.Children.toArray(\r\n children\r\n ) as React.ReactElement<CellProps>[];\r\n const count = elements.length;\r\n return (\r\n <View style={[styles.tr, style]}>\r\n {elements.map((child, idx) => {\r\n const isLast = idx === count - 1;\r\n const width = `${(100 / count).toFixed(2)}%`;\r\n return React.cloneElement(child, { width, isLast, isLastRow, isOdd });\r\n })}\r\n </View>\r\n );\r\n};\r\n\r\nconst Th: React.FC<CellProps> = ({\r\n children,\r\n style,\r\n width,\r\n height,\r\n colSpan,\r\n isLast = false,\r\n isLastRow = false,\r\n textAlign: propTextAlign,\r\n}) => {\r\n const { cellHeight, textAlign: contextTextAlign } = useContext(TableContext);\r\n\r\n // Usar textAlign del prop si está definido, sino el del contexto\r\n const finalTextAlign = propTextAlign || contextTextAlign || \"left\";\r\n\r\n const baseWidth =\r\n typeof width === \"string\" && colSpan\r\n ? `${(parseFloat(width) * colSpan).toFixed(2)}%`\r\n : width;\r\n\r\n const cellHeightValue = height !== undefined ? height : cellHeight;\r\n\r\n const borders = {\r\n borderRightWidth: isLast ? 0 : 1,\r\n borderBottomWidth: isLastRow ? 0 : 1,\r\n borderColor: \"#000\",\r\n minHeight: cellHeightValue,\r\n };\r\n\r\n return (\r\n <View\r\n style={[\r\n styles.textBold,\r\n {\r\n width: baseWidth,\r\n },\r\n borders,\r\n style,\r\n ]}\r\n >\r\n <Text style={{ textAlign: finalTextAlign }}>{children}</Text>\r\n </View>\r\n );\r\n};\r\n\r\nconst Td: React.FC<CellProps> = ({\r\n children,\r\n style,\r\n width,\r\n height,\r\n colSpan,\r\n isLast = false,\r\n isLastRow = false,\r\n isOdd = false,\r\n textAlign: propTextAlign,\r\n}) => {\r\n const { cellHeight, textAlign: contextTextAlign } = useContext(TableContext);\r\n\r\n // Usar textAlign del prop si está definido, sino el del contexto, sino 'left'\r\n const finalTextAlign = propTextAlign || contextTextAlign || \"left\";\r\n\r\n const baseWidth =\r\n typeof width === \"string\" && colSpan\r\n ? `${(parseFloat(width) * colSpan).toFixed(2)}%`\r\n : width;\r\n\r\n const cellHeightValue = height !== undefined ? height : cellHeight;\r\n\r\n const borders = {\r\n borderRightWidth: isLast ? 0 : 1,\r\n borderBottomWidth: isLastRow ? 0 : 1,\r\n borderColor: \"#000\",\r\n minHeight: cellHeightValue,\r\n };\r\n\r\n return (\r\n <View\r\n style={[\r\n styles.text,\r\n isOdd && styles.zebraOdd,\r\n {\r\n width: baseWidth,\r\n },\r\n borders,\r\n style,\r\n ]}\r\n >\r\n <Text style={{ textAlign: finalTextAlign }}>{children}</Text>\r\n </View>\r\n );\r\n};\r\n\r\nexport { Table, Thead, Tbody, Tr, Th, Td };\r\n","import React from \"react\"\r\nimport { View, StyleSheet } from \"@react-pdf/renderer\"\r\n\r\ninterface ContainerProps {\r\n children: React.ReactNode\r\n style?: any\r\n}\r\n\r\ninterface RowProps {\r\n children: React.ReactNode\r\n style?: any\r\n}\r\n\r\ninterface ColProps {\r\n children: React.ReactNode\r\n style?: any\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n container: {\r\n width: \"100%\",\r\n paddingHorizontal: 20,\r\n },\r\n row: {\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n marginHorizontal: -5,\r\n },\r\n col: {\r\n paddingHorizontal: 5,\r\n },\r\n col1: { width: \"8.33%\" },\r\n col2: { width: \"16.66%\" },\r\n col3: { width: \"25%\" },\r\n col4: { width: \"33.33%\" },\r\n col5: { width: \"41.66%\" },\r\n col6: { width: \"50%\" },\r\n col7: { width: \"58.33%\" },\r\n col8: { width: \"66.66%\" },\r\n col9: { width: \"75%\" },\r\n col10: { width: \"83.33%\" },\r\n col11: { width: \"91.66%\" },\r\n col12: { width: \"100%\" },\r\n})\r\n\r\nexport const Container: React.FC<ContainerProps> = ({ children, style }) => {\r\n return <View style={[styles.container, style]}>{children}</View>\r\n}\r\n\r\nexport const Row: React.FC<RowProps> = ({ children, style }) => {\r\n return <View style={[styles.row, style]}>{children}</View>\r\n}\r\n\r\nexport const Col1: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col1, style]}>{children}</View>\r\n}\r\n\r\nexport const Col2: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col2, style]}>{children}</View>\r\n}\r\n\r\nexport const Col3: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col3, style]}>{children}</View>\r\n}\r\n\r\nexport const Col4: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col4, style]}>{children}</View>\r\n}\r\n\r\nexport const Col5: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col5, style]}>{children}</View>\r\n}\r\n\r\nexport const Col6: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col6, style]}>{children}</View>\r\n}\r\n\r\nexport const Col7: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col7, style]}>{children}</View>\r\n}\r\n\r\nexport const Col8: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col8, style]}>{children}</View>\r\n}\r\n\r\nexport const Col9: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col9, style]}>{children}</View>\r\n}\r\n\r\nexport const Col10: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col10, style]}>{children}</View>\r\n}\r\n\r\nexport const Col11: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col11, style]}>{children}</View>\r\n}\r\n\r\nexport const Col12: React.FC<ColProps> = ({ children, style }) => {\r\n return <View style={[styles.col, styles.col12, style]}>{children}</View>\r\n}\r\n\r\n","import QRCode from \"qrcode\"\r\n\r\ninterface QROptions {\r\n value: string\r\n size?: number\r\n colorDark?: string\r\n colorLight?: string\r\n margin?: number\r\n logoImage?: string\r\n logoWidth?: number\r\n logoHeight?: number\r\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\"\r\n}\r\n\r\nexport const generateQRAsBase64 = async ({\r\n value,\r\n size = 150,\r\n colorDark = \"#000000\",\r\n colorLight = \"#ffffff\",\r\n margin = 0,\r\n errorCorrectionLevel = \"M\",\r\n}: QROptions): Promise<string> => {\r\n try {\r\n // Configuración para QRCode\r\n const options = {\r\n errorCorrectionLevel: errorCorrectionLevel,\r\n type: \"image/png\" as const,\r\n quality: 0.92,\r\n margin: margin,\r\n color: {\r\n dark: colorDark,\r\n light: colorLight,\r\n },\r\n width: size,\r\n }\r\n\r\n // Generar el código QR como base64\r\n const qrDataUrl = QRCode.toDataURL(value, options)\r\n return qrDataUrl\r\n } catch (error) {\r\n console.error(\"Error generando QR:\", error)\r\n return \"\"\r\n }\r\n}\r\n\r\n// Función para añadir un logo al QR generado\r\nexport const addLogoToQR = async (\r\n qrDataUrl: string,\r\n logoUrl: string,\r\n logoWidth: number,\r\n logoHeight: number,\r\n): Promise<string> => {\r\n return new Promise(async (resolve) => {\r\n if (!qrDataUrl || !logoUrl) {\r\n resolve(qrDataUrl)\r\n return\r\n }\r\n\r\n try {\r\n const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\r\n let canvas: any;\r\n let ctx: any;\r\n let ImageConstructor: any;\r\n\r\n if (isBrowser) {\r\n canvas = document.createElement(\"canvas\")\r\n ctx = canvas.getContext(\"2d\")\r\n ImageConstructor = window.Image;\r\n } else {\r\n // Node environment\r\n try {\r\n // Use dynamic imports to avoid bundling canvas in browser build if possible\r\n // although typically 'canvas' is excluded from browser bundles or shimmed.\r\n const { createCanvas, Image } = await import('canvas');\r\n canvas = createCanvas(100, 100); // Initial size, will be resized\r\n ctx = canvas.getContext(\"2d\");\r\n ImageConstructor = Image;\r\n } catch (e) {\r\n console.error(\"Canvas not available in Node environment for addLogoToQR\", e);\r\n resolve(qrDataUrl);\r\n return;\r\n }\r\n }\r\n\r\n if (!ctx) {\r\n resolve(qrDataUrl)\r\n return\r\n }\r\n\r\n // Cargar la imagen del QR\r\n const qrImage = new ImageConstructor()\r\n // crossOrigin is only needed in browser usually, but node-canvas might support/ignore it\r\n if (isBrowser) qrImage.crossOrigin = \"anonymous\"\r\n \r\n qrImage.onload = () => {\r\n // Establecer el tamaño del canvas\r\n canvas.width = qrImage.width\r\n canvas.height = qrImage.height\r\n\r\n // Dibujar el QR en el canvas\r\n ctx.drawImage(qrImage, 0, 0, canvas.width, canvas.height)\r\n\r\n // Cargar el logo\r\n const logoImage = new ImageConstructor()\r\n if (isBrowser) logoImage.crossOrigin = \"anonymous\"\r\n \r\n logoImage.onload = () => {\r\n // Calcular la posición central para el logo\r\n const x = (canvas.width - logoWidth) / 2\r\n const y = (canvas.height - logoHeight) / 2\r\n\r\n // Dibujar un fondo blanco para el logo (opcional)\r\n ctx.fillStyle = \"#FFFFFF\"\r\n ctx.fillRect(x - 5, y - 5, logoWidth + 10, logoHeight + 10)\r\n\r\n // Dibujar el logo\r\n ctx.drawImage(logoImage, x, y, logoWidth, logoHeight)\r\n\r\n // Convertir el canvas a base64\r\n const finalQrDataUrl = canvas.toDataURL(\"image/png\")\r\n resolve(finalQrDataUrl)\r\n }\r\n\r\n logoImage.onerror = (err: any) => {\r\n console.error(\"Error cargando el logo:\", err)\r\n resolve(qrDataUrl) // Devolver el QR sin logo en caso de error\r\n }\r\n\r\n logoImage.src = logoUrl\r\n }\r\n\r\n qrImage.onerror = (err: any) => {\r\n console.error(\"Error cargando el QR:\", err)\r\n resolve(\"\")\r\n }\r\n\r\n qrImage.src = qrDataUrl\r\n } catch (error) {\r\n console.error(\"Error procesando el QR con logo:\", error)\r\n resolve(qrDataUrl) // Devolver el QR sin logo en caso de error\r\n }\r\n })\r\n}\r\n","\"use client\"\r\n\r\nimport React from \"react\"\r\nimport { Image, StyleSheet, View } from \"@react-pdf/renderer\"\r\nimport { useEffect, useState } from \"react\"\r\nimport { generateQRAsBase64, addLogoToQR } from \"./QRGenerator\"\r\n\r\n// Define the props for the QR component\r\ninterface QRProps {\r\n value: string\r\n size?: number\r\n style?: any\r\n colorDark?: string\r\n colorLight?: string\r\n margin?: number\r\n logo?: string\r\n logoWidth?: number\r\n logoHeight?: number\r\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\"\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n qrContainer: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n margin: 10,\r\n },\r\n})\r\n\r\n// Mapa para convertir niveles de corrección numéricos a letras\r\nconst errorLevelMap: Record<number, \"L\" | \"M\" | \"Q\" | \"H\"> = {\r\n 0: \"L\",\r\n 1: \"M\",\r\n 2: \"Q\",\r\n 3: \"H\",\r\n}\r\n\r\n// Este componente funciona con React PDF\r\nconst QR: React.FC<QRProps> = ({\r\n value,\r\n size = 150,\r\n style,\r\n colorDark = \"#000000\",\r\n colorLight = \"#ffffff\",\r\n margin = 0,\r\n logo = \"\",\r\n logoWidth = 30,\r\n logoHeight = 30,\r\n errorCorrectionLevel = logo ? \"H\" : \"M\",\r\n}) => {\r\n const [qrDataUrl, setQrDataUrl] = useState<string>(\"\")\r\n\r\n // Generar el código QR cuando el componente se monta o cuando cambian las props\r\n useEffect(() => {\r\n const generateQR = async () => {\r\n try {\r\n // Primero generamos el QR básico\r\n const baseQrDataUrl = await generateQRAsBase64({\r\n value,\r\n size,\r\n colorDark,\r\n colorLight,\r\n margin,\r\n errorCorrectionLevel:\r\n typeof errorCorrectionLevel === \"number\"\r\n ? errorLevelMap[errorCorrectionLevel] || \"M\"\r\n : errorCorrectionLevel,\r\n })\r\n\r\n // Si hay un logo, lo añadimos al QR\r\n if (logo && logoWidth && logoHeight) {\r\n const qrWithLogo = await addLogoToQR(baseQrDataUrl, logo, logoWidth, logoHeight)\r\n setQrDataUrl(qrWithLogo)\r\n } else {\r\n setQrDataUrl(baseQrDataUrl)\r\n }\r\n } catch (error) {\r\n console.error(\"Error generando QR:\", error)\r\n // En caso de error, generamos un QR básico usando una API externa\r\n const fallbackUrl = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(\r\n value,\r\n )}&size=${size}x${size}&color=${encodeURIComponent(colorDark.replace(\"#\", \"\"))}&bgcolor=${encodeURIComponent(\r\n colorLight.replace(\"#\", \"\"),\r\n )}`\r\n setQrDataUrl(fallbackUrl)\r\n }\r\n }\r\n\r\n generateQR()\r\n }, [value, size, colorDark, colorLight, margin, logo, logoWidth, logoHeight, errorCorrectionLevel])\r\n\r\n // Mostrar un QR de respaldo mientras se genera el QR personalizado\r\n const fallbackUrl = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(\r\n value,\r\n )}&size=${size}x${size}`\r\n\r\n return (\r\n <View style={[styles.qrContainer, style]}>\r\n <Image src={qrDataUrl || fallbackUrl} style={{ width: size, height: size }} />\r\n </View>\r\n )\r\n}\r\n\r\nexport default QR\r\n\r\n","import { generateQRAsBase64 } from \"./QRGenerator\"\r\n\r\nexport interface QRV2Options {\r\n value: string\r\n width?: number\r\n height?: number\r\n image?: string\r\n dotsOptions?: {\r\n color?: string\r\n type?: \"rounded\" | \"dots\" | \"classy\" | \"classy-rounded\" | \"square\" | \"extra-rounded\"\r\n }\r\n backgroundOptions?: {\r\n color?: string\r\n }\r\n imageOptions?: {\r\n crossOrigin?: string\r\n margin?: number\r\n imageSize?: number // 0-1 (e.g., 0.4)\r\n }\r\n cornersSquareOptions?: {\r\n type?: \"dot\" | \"square\" | \"extra-rounded\"\r\n color?: string\r\n }\r\n cornersDotOptions?: {\r\n type?: \"dot\" | \"square\"\r\n color?: string\r\n }\r\n // Fallback options\r\n fallbackColorDark?: string\r\n fallbackColorLight?: string\r\n fallbackMargin?: number\r\n fallbackErrorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\"\r\n}\r\n\r\nexport const generateQRV2AsBase64 = async (options: QRV2Options): Promise<string> => {\r\n try {\r\n const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\r\n \r\n let QRCodeStylingConstructor: any;\r\n let extraOptions = {};\r\n\r\n if (isBrowser) {\r\n // Dynamic import for browser\r\n try {\r\n const mod = await import('qr-code-styling');\r\n QRCodeStylingConstructor = mod.default || mod;\r\n } catch (e) {\r\n console.error(\"Failed to load qr-code-styling in browser\", e);\r\n throw e;\r\n }\r\n } else {\r\n // Node environment\r\n // We use variable names to prevent bundlers (like Vite) from analyzing/bundling these dependencies\r\n // when building for the browser.\r\n const jsdomName = \"jsdom\";\r\n const canvasName = \"canvas\";\r\n const qrCommonName = \"qr-code-styling/lib/qr-code-styling.common.js\";\r\n \r\n try {\r\n const [jsdomMod, canvasMod, qrCommonMod] = await Promise.all([\r\n import(/* @vite-ignore */ jsdomName),\r\n import(/* @vite-ignore */ canvasName),\r\n import(/* @vite-ignore */ qrCommonName)\r\n ]);\r\n\r\n const { JSDOM } = jsdomMod;\r\n // canvas might be default export or named export depending on version/bundling\r\n const nodeCanvas = canvasMod.default || canvasMod;\r\n const { QRCodeStyling } = qrCommonMod;\r\n\r\n QRCodeStylingConstructor = QRCodeStyling;\r\n extraOptions = {\r\n jsdom: JSDOM,\r\n nodeCanvas: nodeCanvas\r\n };\r\n } catch (e) {\r\n console.error(\"Failed to load Node dependencies for QR generation\", e);\r\n throw e;\r\n }\r\n }\r\n\r\n const width = typeof options.width === \"number\" && isFinite(options.width) ? Math.round(options.width) : 300;\r\n const height = typeof options.height === \"number\" && isFinite(options.height) ? Math.round(options.height) : 300;\r\n const hasImage = !!options.image;\r\n\r\n const qrOptions = {\r\n width,\r\n height,\r\n data: options.value,\r\n image: options.image,\r\n dotsOptions: options.dotsOptions,\r\n backgroundOptions: {\r\n // Default to white background if not specified to prevent transparency issues\r\n // The \"blue stripe\" or weird artifacts can happen if the background is transparent or handled incorrectly\r\n color: options.backgroundOptions?.color || \"#ffffff\",\r\n ...options.backgroundOptions\r\n },\r\n imageOptions: {\r\n crossOrigin: \"anonymous\",\r\n margin: typeof options.imageOptions?.margin === \"number\" && isFinite(options.imageOptions.margin) ? options.imageOptions.margin : 0,\r\n saveAsBlob: true,\r\n imageSize: typeof options.imageOptions?.imageSize === \"number\" && isFinite(options.imageOptions.imageSize)\r\n ? Math.max(0, Math.min(1, options.imageOptions.imageSize))\r\n : 0.4,\r\n },\r\n cornersSquareOptions: options.cornersSquareOptions,\r\n cornersDotOptions: options.cornersDotOptions,\r\n }\r\n\r\n // @ts-ignore\r\n const qrCodeImage = new QRCodeStylingConstructor({\r\n type: \"png\", // Force PNG type\r\n ...extraOptions,\r\n ...qrOptions,\r\n })\r\n\r\n const rawData = await qrCodeImage.getRawData(\"png\")\r\n \r\n if (!rawData) throw new Error(\"Failed to generate raw data from qr-code-styling\")\r\n\r\n // Handle Blob (Browser) vs Buffer (Node)\r\n if (isBrowser) {\r\n if (rawData instanceof Blob) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.onloadend = () => {\r\n if (typeof reader.result === 'string') {\r\n resolve(reader.result);\r\n } else {\r\n reject(new Error(\"Failed to convert blob to base64\"));\r\n }\r\n };\r\n reader.onerror = reject;\r\n reader.readAsDataURL(rawData);\r\n });\r\n } else {\r\n // Sometimes in browser it might return something else if configured differently?\r\n // But usually Blob.\r\n console.warn(\"Unexpected rawData type in browser:\", rawData);\r\n }\r\n } \r\n \r\n // Node environment usually returns Buffer\r\n if (typeof Buffer !== 'undefined' && Buffer.isBuffer(rawData)) {\r\n return `data:image/png;base64,${rawData.toString(\"base64\")}`;\r\n }\r\n \r\n // Fallback if type is unexpected\r\n // Try to handle if it's a blob-like object in Node (unlikely but possible with polyfills)\r\n throw new Error(`Unexpected raw data type: ${typeof rawData}`);\r\n\r\n } catch (error) {\r\n console.error(\"Error generating QR V2, falling back to V1:\", error)\r\n \r\n // Fallback to existing implementation\r\n return generateQRAsBase64({\r\n value: options.value,\r\n size: options.width,\r\n colorDark: options.fallbackColorDark || options.dotsOptions?.color,\r\n colorLight: options.fallbackColorLight || options.backgroundOptions?.color,\r\n margin: options.fallbackMargin || 0,\r\n errorCorrectionLevel: options.fallbackErrorCorrectionLevel || \"M\",\r\n })\r\n }\r\n}\r\n","\"use client\"\r\n\r\nimport React, { useEffect, useState } from \"react\"\r\nimport { Image, StyleSheet, View } from \"@react-pdf/renderer\"\r\nimport { generateQRV2AsBase64, type QRV2Options } from \"./QRGeneratorV2\"\r\n\r\n// Define props\r\nexport interface QRV2Props {\r\n value: string\r\n size?: number\r\n style?: any\r\n image?: string\r\n dotsOptions?: QRV2Options[\"dotsOptions\"]\r\n backgroundOptions?: QRV2Options[\"backgroundOptions\"]\r\n imageOptions?: QRV2Options[\"imageOptions\"]\r\n cornersSquareOptions?: QRV2Options[\"cornersSquareOptions\"]\r\n cornersDotOptions?: QRV2Options[\"cornersDotOptions\"]\r\n // Fallback/Compatibility props\r\n colorDark?: string\r\n colorLight?: string\r\n margin?: number\r\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\"\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n qrContainer: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n },\r\n})\r\n\r\nconst QRV2: React.FC<QRV2Props> = ({\r\n value,\r\n size = 300,\r\n style,\r\n image,\r\n dotsOptions,\r\n backgroundOptions,\r\n imageOptions,\r\n cornersSquareOptions,\r\n cornersDotOptions,\r\n colorDark,\r\n colorLight,\r\n margin,\r\n errorCorrectionLevel,\r\n}) => {\r\n const [qrDataUrl, setQrDataUrl] = useState<string>(\"\")\r\n\r\n useEffect(() => {\r\n let isMounted = true;\r\n const generate = async () => {\r\n // Construct options with intelligent defaults/mapping\r\n const finalDotsOptions = dotsOptions || (colorDark ? { color: colorDark } : undefined)\r\n const finalBackgroundOptions = backgroundOptions || (colorLight ? { color: colorLight } : undefined)\r\n \r\n const finalImageOptions = {\r\n ...imageOptions,\r\n margin: imageOptions?.margin !== undefined ? imageOptions.margin : margin\r\n }\r\n\r\n try {\r\n const dataUrl = await generateQRV2AsBase64({\r\n value,\r\n width: size,\r\n height: size,\r\n image,\r\n dotsOptions: finalDotsOptions,\r\n backgroundOptions: finalBackgroundOptions,\r\n imageOptions: finalImageOptions,\r\n cornersSquareOptions,\r\n cornersDotOptions,\r\n fallbackColorDark: colorDark,\r\n fallbackColorLight: colorLight,\r\n fallbackMargin: margin,\r\n fallbackErrorCorrectionLevel: errorCorrectionLevel,\r\n })\r\n \r\n if (isMounted) {\r\n setQrDataUrl(dataUrl)\r\n }\r\n } catch (err) {\r\n console.error(\"QRV2 Generation Error:\", err);\r\n }\r\n }\r\n \r\n // In Node/Server-side rendering context for React-PDF, useEffect might behave differently \r\n // depending on how the document is rendered (e.g., renderToStream, renderToString).\r\n // React-PDF 2.0+ supports useEffect for async operations like loading images.\r\n generate()\r\n \r\n return () => { isMounted = false; }\r\n }, [\r\n value,\r\n size,\r\n image,\r\n // JSON.stringify can be expensive, use simpler dependency tracking if possible or keep as is for deep comparison\r\n JSON.stringify(dotsOptions),\r\n JSON.stringify(backgroundOptions),\r\n JSON.stringify(imageOptions),\r\n JSON.stringify(cornersSquareOptions),\r\n JSON.stringify(cornersDotOptions),\r\n colorDark,\r\n colorLight,\r\n margin,\r\n errorCorrectionLevel,\r\n ])\r\n\r\n // If we don't have a URL yet, we return null.\r\n // This might be the issue in Node if the render happens before the effect completes.\r\n // React-PDF usually waits for images to load, but async state updates might be tricky.\r\n // However, React-PDF renderer waits for all promises in the document to resolve? \r\n // No, it waits for *Image src promises* if src is a promise or URL.\r\n // But here we are setting state asynchronously. \r\n \r\n // CRITICAL FIX: In Node generation, we need to ensure the async operation completes.\r\n // Since we can't easily pause the render until state updates in a standard React functional component\r\n // without Suspense (which React-PDF might not fully support for this case), \r\n // we might need to verify if generateQRV2AsBase64 can be run synchronously or if we are using the component correctly.\r\n \r\n // Actually, for React-PDF in Node, if we use `renderToStream` or `renderToFile`, it renders once.\r\n // `useEffect` does NOT run in the standard `renderToString` / static rendering flow of React usually,\r\n // BUT `@react-pdf/renderer` is special. It does execute hooks in its layout engine?\r\n // \r\n // Wait, standard React SSR does NOT run useEffect. \r\n // If `react-pdf-levelup` uses `@react-pdf/renderer`'s `renderToStream` or `renderToFile` in Node,\r\n // it behaves like SSR. useEffect won't run.\r\n // \r\n // The original QR component (QR.tsx) uses useEffect:\r\n // `useEffect(() => { const generateQR = async () => { ... } ... }, [...])`\r\n // So if the original QR works, then `react-pdf` MUST be supporting useEffect or re-rendering somehow?\r\n //\r\n // Let's check `src/components/core/QR.tsx` again.\r\n // It uses `useEffect` and `useState`.\r\n //\r\n // If the user says \"QR normal (el que ya tenia)\" works, and it uses `useEffect`, \r\n // then maybe the environment where `render` is called is actually supporting it (e.g. client side rendering or some specific react-pdf setup).\r\n //\r\n // HOWEVER, if the user is running `tsx ./src/useExample/index.ts` (implied by \"tengo un template ... en index.ts\"),\r\n // this is a Node process.\r\n // In a pure Node process, `useEffect` usually doesn't run during a single-pass render.\r\n // \r\n // But wait, `QR.tsx` implementation:\r\n // `const [qrDataUrl, setQrDataUrl] = useState<string>(\"\")`\r\n // `useEffect(...)`\r\n // `return <Image src={qrDataUrl || fallbackUrl} ... />`\r\n //\r\n // `fallbackUrl` is set SYNCHRONOUSLY in `QR.tsx`:\r\n // `const fallbackUrl = https://api.qrserver.com/...`\r\n // So `QR.tsx` ALWAYS has a valid `src` (the fallback) on the first render!\r\n // That is why `QR.tsx` works! It renders the fallback URL immediately.\r\n // The `useEffect` might run later or never, but the PDF gets the fallback URL.\r\n //\r\n // My `QRV2` implementation returns `null` or empty string initially:\r\n // `{qrDataUrl ? <Image src={qrDataUrl} ... /> : null}`\r\n // So on first render (SSR/Node), it renders NOTHING.\r\n //\r\n // We need to either:\r\n // 1. Generate the QR synchronously (impossible with qr-code-styling in Node as it's async-ish or we made it async).\r\n // 2. Provide a synchronous fallback.\r\n // 3. Or use a mechanism to suspend rendering (Suspense) - but React-PDF support is limited.\r\n //\r\n // The best bet is to check if we can make `generateQRV2AsBase64` synchronous or if we should provide a fallback.\r\n // But the user wants the custom style.\r\n //\r\n // If `generateQRV2AsBase64` is async, we are stuck in Node unless we use a \"Resource\" pattern that React-PDF can wait on.\r\n // React-PDF `Image` component can accept a Promise as `src`.\r\n //\r\n // Let's try passing the Promise directly to `Image src`!\r\n // `src` prop of `Image` in `@react-pdf/renderer` supports: string | SourceObject | Buffer | Blob | Promise<...>\r\n \r\n return (\r\n <View style={[styles.qrContainer, style]}>\r\n {/* We pass a function that returns the promise/result or use the state if available. \r\n Actually, we can pass the promise directly to src! */}\r\n <Image \r\n style={{ width: size, height: size }} \r\n src={generateQRV2AsBase64({\r\n value,\r\n width: size,\r\n height: size,\r\n image,\r\n dotsOptions: dotsOptions || (colorDark ? { color: colorDark } : undefined),\r\n backgroundOptions: backgroundOptions || (colorLight ? { color: colorLight } : undefined),\r\n imageOptions: {\r\n ...imageOptions,\r\n margin: imageOptions?.margin !== undefined ? imageOptions.margin : margin\r\n },\r\n cornersSquareOptions,\r\n cornersDotOptions,\r\n fallbackColorDark: colorDark,\r\n fallbackColorLight: colorLight,\r\n fallbackMargin: margin,\r\n fallbackErrorCorrectionLevel: errorCorrectionLevel,\r\n })} \r\n />\r\n </View>\r\n )\r\n}\r\n\r\nexport default QRV2\r\n","import React from \"react\"\r\nimport { View, Text, StyleSheet } from \"@react-pdf/renderer\"\r\n\r\ninterface ListProps {\r\n children: React.ReactNode\r\n style?: any\r\n start?: number // Para listas ordenadas, desde qué número empezar\r\n type?: \"disc\" | \"circle\" | \"square\" | \"decimal\" | \"lower-alpha\" | \"upper-alpha\" | \"lower-roman\" | \"upper-roman\"\r\n}\r\n\r\ninterface ListItemProps {\r\n children: React.ReactNode\r\n style?: any\r\n value?: number | string // Valor específico para este elemento de lista\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n ul: {\r\n marginBottom: 10,\r\n paddingLeft: 15,\r\n },\r\n ol: {\r\n marginBottom: 10,\r\n paddingLeft: 15,\r\n },\r\n li: {\r\n marginBottom: 5,\r\n flexDirection: \"row\",\r\n },\r\n bulletPoint: {\r\n width: 15,\r\n marginRight: 5,\r\n fontSize: 12,\r\n },\r\n itemContent: {\r\n flex: 1,\r\n },\r\n})\r\n\r\n// Función para generar marcadores de lista desordenada\r\nconst getBulletPoint = (type = \"disc\") => {\r\n switch (type) {\r\n case \"circle\":\r\n return \"○\"\r\n case \"square\":\r\n return \"■\"\r\n case \"disc\":\r\n default:\r\n return \"•\"\r\n }\r\n}\r\n\r\n// Función para generar marcadores de lista ordenada\r\nconst getOrderedMarker = (index: number, type = \"decimal\", start = 1) => {\r\n const actualIndex = start + index - 1\r\n\r\n switch (type) {\r\n case \"lower-alpha\":\r\n return String.fromCharCode(97 + (actualIndex % 26)) + \".\"\r\n case \"upper-alpha\":\r\n return String.fromCharCode(65 + (actualIndex % 26)) + \".\"\r\n case \"lower-roman\":\r\n return toRoman(actualIndex).toLowerCase() + \".\"\r\n case \"upper-roman\":\r\n return toRoman(actualIndex) + \".\"\r\n case \"decimal\":\r\n default:\r\n return actualIndex + \".\"\r\n }\r\n}\r\n\r\n// Función para convertir números a numerales romanos\r\nconst toRoman = (num: number): string => {\r\n if (num <= 0 || num > 3999) return String(num)\r\n\r\n const romanNumerals = [\r\n [\"\", \"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\", \"VIII\", \"IX\"],\r\n [\"\", \"X\", \"XX\", \"XXX\", \"XL\", \"L\", \"LX\", \"LXX\", \"LXXX\", \"XC\"],\r\n [\"\", \"C\", \"CC\", \"CCC\", \"CD\", \"D\", \"DC\", \"DCC\", \"DCCC\", \"CM\"],\r\n [\"\", \"M\", \"MM\", \"MMM\"],\r\n ]\r\n\r\n return (\r\n romanNumerals[3][Math.floor(num / 1000)] +\r\n romanNumerals[2][Math.floor((num % 1000) / 100)] +\r\n romanNumerals[1][Math.floor((num % 100) / 10)] +\r\n romanNumerals[0][num % 10]\r\n )\r\n}\r\n\r\n// Componente de lista desordenada (UL)\r\nexport const UL: React.FC<ListProps> = ({ children, style, type = \"disc\" }) => {\r\n // Clonar los hijos para añadir el tipo de marcador\r\n const childrenWithBullets = React.Children.map(children, (child, index) => {\r\n if (React.isValidElement(child)) {\r\n return React.cloneElement(child as React.ReactElement<any>, {\r\n bulletType: type,\r\n isOrdered: false,\r\n index: index + 1,\r\n })\r\n }\r\n return child\r\n })\r\n\r\n return <View style={[styles.ul, style]}>{childrenWithBullets}</View>\r\n}\r\n\r\n// Componente de lista ordenada (OL)\r\nexport const OL: React.FC<ListProps> = ({ children, style, type = \"decimal\", start = 1 }) => {\r\n // Clonar los hijos para añadir el tipo de marcador y el índice\r\n const childrenWithNumbers = React.Children.map(children, (child, index) => {\r\n if (React.isValidElement(child)) {\r\n return React.cloneElement(child as React.ReactElement<any>, {\r\n bulletType: type,\r\n isOrdered: true,\r\n index: index + 1,\r\n start,\r\n })\r\n }\r\n return child\r\n })\r\n\r\n return <View style={[styles.ol, style]}>{childrenWithNumbers}</View>\r\n}\r\n\r\n// Componente de elemento de lista (LI)\r\nexport const LI: React.FC<\r\n ListItemProps & {\r\n bulletType?: string\r\n isOrdered?: boolean\r\n index?: number\r\n start?: number\r\n }\r\n> = ({ children, style, bulletType = \"disc\", isOrdered = false, index = 1, start = 1, value }) => {\r\n // Determinar el marcador a mostrar\r\n let marker\r\n if (isOrdered) {\r\n // Si se proporciona un valor específico, usarlo en lugar del índice\r\n const actualIndex = value !== undefined ? Number(value) : index\r\n marker = getOrderedMarker(actualIndex, bulletType, start)\r\n } else {\r\n marker = getBulletPoint(bulletType)\r\n }\r\n\r\n return (\r\n <View style={[styles.li, style]}>\r\n <Text style={styles.bulletPoint}>{marker}</Text>\r\n <View style={styles.itemContent}>{typeof children === \"string\" ? <Text>{children}</Text> : children}</View>\r\n </View>\r\n )\r\n}\r\n\r\n","import React from \"react\"\r\nimport { Image, StyleSheet, View } from \"@react-pdf/renderer\"\r\n\r\ninterface ImgBgProps {\r\n src: string\r\n width?: number | string\r\n height?: number | string\r\n opacity?: number\r\n children?: React.ReactNode\r\n style?: any\r\n fixed?: boolean\r\n objectFit?: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\"\r\n objectPosition?: string // ej: \"center\", \"top\", \"left top\"\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n container: {\r\n position: \"relative\",\r\n width: \"100%\",\r\n height: \"100%\",\r\n },\r\n background: {\r\n position: \"absolute\",\r\n top: 0,\r\n left: 0,\r\n right: 0,\r\n bottom: 0,\r\n },\r\n content: {\r\n position: \"relative\",\r\n },\r\n})\r\n\r\nconst ImgBg: React.FC<ImgBgProps> = ({\r\n src,\r\n width = \"100%\",\r\n height = \"100%\",\r\n opacity = 0.2,\r\n children,\r\n style,\r\n fixed = false,\r\n objectFit = \"cover\",\r\n objectPosition = \"center\",\r\n}) => {\r\n return (\r\n <View style={[styles.container, style]}>\r\n <Image\r\n src={src}\r\n style={[\r\n styles.background,\r\n { width, height, opacity, objectFit, objectPosition },\r\n ]}\r\n fixed={fixed}\r\n />\r\n <View style={styles.content}>{children}</View>\r\n </View>\r\n )\r\n}\r\n\r\nexport default ImgBg\r\n"]}
package/package.json CHANGED
@@ -1,30 +1,29 @@
1
1
  {
2
2
  "name": "react-pdf-levelup",
3
- "version": "3.1.59",
3
+ "version": "3.1.63",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "module",
4
8
  "main": "dist/index.js",
5
9
  "types": "dist/index.d.ts",
6
- "type": "module",
10
+ "private": false,
7
11
  "files": [
8
12
  "dist"
9
13
  ],
10
14
  "scripts": {
11
- "dev": "vite",
12
- "build": "tsc -b && vite build",
13
- "lint": "eslint .",
14
- "preview": "vite preview",
15
- "clean-dist": "rimraf dist",
16
- "build-lib": "npm run clean-dist && tsup",
17
- "publicar": "node ./fn/publicar.js",
18
- "demo": "tsx ./src/useExample/index.ts"
15
+ "publicar": "node scripts/index.js",
16
+ "build": "tsup --config tsup.config.ts",
17
+ "test": "echo \"Error: no test specified\" && exit 1"
19
18
  },
20
19
  "peerDependencies": {
21
- "@react-pdf/renderer": "^4.3.0",
20
+ "@react-pdf/renderer": "^4.3.2",
22
21
  "react": ">=18 <=19",
23
22
  "react-dom": ">=18 <=19"
24
23
  },
25
24
  "dependencies": {
26
- "qrcode": "^1.5.4",
27
- "react-pdf-levelup": "^3.1.54"
28
- },
29
- "devDependencies": {}
25
+ "canvas": "^3.2.0",
26
+ "jsdom": "^27.4.0",
27
+ "qr-code-styling": "^1.9.2"
28
+ }
30
29
  }
package/README.md DELETED
@@ -1,244 +0,0 @@
1
- # react-pdf-levelup
2
-
3
- Generador de PDFs dinámicos con React. Esta herramienta te permite crear plantillas PDF con componentes JSX personalizados y previsualizarlas en tiempo real dentro de una aplicación web. Ideal para etiquetas, facturas, reportes, certificados, tablas y más.
4
-
5
- # 🌐 **Playground en vivo:**
6
- [https://react-pdf-levelup.netlify.app](https://react-pdf-levelup.netlify.app)
7
-
8
- ## 📦 Instalación
9
-
10
- ```bash
11
- npm install react-pdf-levelup
12
- ```
13
-
14
- ## 🚀 Características
15
-
16
- - 🧱 Construye PDFs con componentes de React usando `@react-pdf/renderer`
17
- - 🖼 Vista previa en tiempo real de los documentos generados
18
- - 🎨 Editor en vivo con Monaco Editor para personalizar código JSX
19
- - 📦 Plantillas predefinidas listas para usar
20
- - 📄 Soporte para códigos QR, tablas, imágenes, listas, layout dinámico, etc.
21
- - 🔄 Generación de PDFs desde templates de React
22
- - 📥 Descarga automática y vista previa de PDFs generados
23
-
24
- ## 📋 Funciones Principales
25
-
26
- ### `generatePDF`
27
-
28
- Genera un PDF en formato base64 a partir de un componente de React.
29
-
30
- ```typescript
31
- import { generatePDF } from 'react-pdf-levelup';
32
-
33
- const pdfBase64 = await generatePDF({
34
- template: MyPDFTemplate,
35
- data: {
36
- title: 'Mi Documento',
37
- items: ['Item 1', 'Item 2', 'Item 3']
38
- }
39
- });
40
- ```
41
-
42
- **Parámetros:**
43
- - `template`: Componente de React que define la estructura del PDF
44
- - `data`: Datos opcionales que se pasarán al template
45
-
46
- **Retorna:** Promise que resuelve a un string en base64 del PDF generado
47
-
48
- ### `decodeBase64Pdf`
49
-
50
- Decodifica un PDF en base64 y permite descargarlo o abrirlo en una nueva pestaña.
51
-
52
- ```typescript
53
- import { decodeBase64Pdf } from 'react-pdf-levelup';
54
-
55
- // Después de generar el PDF
56
- const pdfBase64 = await generatePDF({ template: MyTemplate });
57
-
58
- // Descargar y abrir el PDF
59
- decodeBase64Pdf(pdfBase64, 'mi-documento.pdf');
60
- ```
61
-
62
- **Parámetros:**
63
- - `base64`: String del PDF en formato base64
64
- - `fileName`: Nombre del archivo para la descarga
65
-
66
- **Funcionalidad:**
67
- - Descarga automática del archivo PDF
68
- - Abre el PDF en una nueva pestaña del navegador
69
- - Limpia automáticamente los recursos de memoria
70
-
71
- ## 💡 Ejemplo de Uso Completo
72
-
73
- ```typescript
74
- import React from 'react';
75
- import { Document, Page, Text, View, StyleSheet } from '@react-pdf/renderer';
76
- import { generatePDF, decodeBase64Pdf } from 'react-pdf-levelup';
77
-
78
- // Definir estilos para el PDF
79
- const styles = StyleSheet.create({
80
- page: {
81
- flexDirection: 'column',
82
- backgroundColor: '#E4E4E4',
83
- padding: 30,
84
- },
85
- section: {
86
- margin: 10,
87
- padding: 10,
88
- flexGrow: 1,
89
- },
90
- title: {
91
- fontSize: 24,
92
- marginBottom: 10,
93
- },
94
- });
95
-
96
- // Crear template del PDF
97
- const MyPDFTemplate = ({ data }) => (
98
- <Document>
99
- <Page size="A4" style={styles.page}>
100
- <View style={styles.section}>
101
- <Text style={styles.title}>{data?.title || 'Documento PDF'}</Text>
102
- {data?.items?.map((item, index) => (
103
- <Text key={index}>• {item}</Text>
104
- ))}
105
- </View>
106
- </Page>
107
- </Document>
108
- );
109
-
110
- // Función para generar y descargar PDF
111
- const handleGeneratePDF = async () => {
112
- try {
113
- const pdfBase64 = await generatePDF({
114
- template: MyPDFTemplate,
115
- data: {
116
- title: 'Mi Lista de Tareas',
117
- items: [
118
- 'Revisar documentación',
119
- 'Implementar nuevas funciones',
120
- 'Realizar pruebas',
121
- 'Desplegar a producción'
122
- ]
123
- }
124
- });
125
-
126
- // Descargar y abrir el PDF
127
- decodeBase64Pdf(pdfBase64, 'lista-tareas.pdf');
128
-
129
- } catch (error) {
130
- console.error('Error generando PDF:', error);
131
- }
132
- };
133
-
134
- // Componente React
135
- const App = () => {
136
- return (
137
- <div>
138
- <h1>Generador de PDF</h1>
139
- <button onClick={handleGeneratePDF}>
140
- Generar y Descargar PDF
141
- </button>
142
- </div>
143
- );
144
- };
145
-
146
- export default App;
147
- ```
148
-
149
- ## 🎨 Templates Avanzados
150
-
151
- ```typescript
152
- import { StyleSheet, Font } from '@react-pdf/renderer';
153
-
154
- // Ejemplo de template para factura
155
- const InvoiceTemplate = ({ data }) => (
156
- <Document>
157
- <Page size="A4" style={styles.page}>
158
- <View style={styles.header}>
159
- <Text style={styles.companyName}>{data.company}</Text>
160
- <Text>Factura #{data.invoiceNumber}</Text>
161
- </View>
162
-
163
- <View style={styles.customerInfo}>
164
- <Text>Cliente: {data.customer.name}</Text>
165
- <Text>Email: {data.customer.email}</Text>
166
- </View>
167
-
168
- <View style={styles.itemsTable}>
169
- {data.items.map((item, index) => (
170
- <View key={index} style={styles.tableRow}>
171
- <Text style={styles.itemName}>{item.name}</Text>
172
- <Text style={styles.itemQuantity}>{item.quantity}</Text>
173
- <Text style={styles.itemPrice}>${item.price}</Text>
174
- </View>
175
- ))}
176
- </View>
177
-
178
- <View style={styles.total}>
179
- <Text>Total: ${data.total}</Text>
180
- </View>
181
- </Page>
182
- </Document>
183
- );
184
- ```
185
-
186
- ## 🔧 Configuración Avanzada
187
-
188
- ### Manejo de Errores
189
-
190
- ```typescript
191
- const handlePDFGeneration = async () => {
192
- try {
193
- const pdfBase64 = await generatePDF({
194
- template: MyTemplate,
195
- data: myData
196
- });
197
-
198
- decodeBase64Pdf(pdfBase64, 'documento.pdf');
199
-
200
- } catch (error) {
201
- if (error.message.includes('Template not provided')) {
202
- console.error('Error: No se proporcionó un template válido');
203
- } else {
204
- console.error('Error inesperado:', error.message);
205
- }
206
- }
207
- };
208
- ```
209
-
210
- ### Solo Generar Base64 (sin descargar)
211
-
212
- ```typescript
213
- const generatePDFOnly = async () => {
214
- const pdfBase64 = await generatePDF({
215
- template: MyTemplate,
216
- data: myData
217
- });
218
-
219
- // Usar el base64 para otros propósitos (envío por API, almacenamiento, etc.)
220
- console.log('PDF generado:', pdfBase64);
221
- return pdfBase64;
222
- };
223
- ```
224
-
225
- ## 🛠 Dependencias
226
-
227
- Esta librería utiliza internamente:
228
- - `@react-pdf/renderer` - Para la generación de PDFs
229
- - `react` - Para los componentes JSX
230
-
231
- ## 📝 Notas Importantes
232
-
233
- - La función `decodeBase64Pdf` solo funciona en contexto de navegador (requiere `document`)
234
- - Los templates deben ser componentes válidos de `@react-pdf/renderer`
235
- - El PDF se genera de forma asíncrona, asegúrate de usar `await` o `.then()`
236
- - Los recursos de memoria se limpian automáticamente después de la descarga
237
-
238
- ## 🤝 Contribuir
239
-
240
- Las contribuciones son bienvenidas. Por favor, abre un issue o envía un pull request.
241
-
242
- ## 📄 Licencia
243
-
244
- MIT License
package/license DELETED
@@ -1,17 +0,0 @@
1
- MIT License
2
- Copyright (c) 2025 react-pdf-levelup
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
- The above copyright notice and this permission notice shall be included in all
10
- copies or substantial portions of the Software.
11
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17
- SOFTWARE.