diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index c5ca408..05e3f2b 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -427,6 +427,7 @@ const View = (props: ReportPDFDocumentProps) => { return blob; }, refetchOnWindowFocus: false, + enabled: !!props.htmlString, }); if (query.isLoading) return ; diff --git a/packages/pdf/src/report.tsx b/packages/pdf/src/report.tsx index e53f713..8e85b1f 100644 --- a/packages/pdf/src/report.tsx +++ b/packages/pdf/src/report.tsx @@ -1,4 +1,4 @@ -import { Document, Font, Image, Page, View } from "@react-pdf/renderer"; +import { Document, Font, Image, Page, Text, View } from "@react-pdf/renderer"; import { Html } from "react-pdf-html"; import React from "react"; import type { Udap, Report, Service_instructeurs, Clause_v2, Pictures } from "@cr-vif/electric-client/frontend"; @@ -10,9 +10,8 @@ Font.registerHyphenationCallback((word) => { export const ReportPDFDocument = ({ udap, htmlString, images, pictures }: ReportPDFDocumentProps) => { return ( - + `} - {pictures ? ( - - {pictures - .filter((pic) => !!pic.url) - .map((pic) => ( - - ))} - - ) : null} + {pictures + ? pictures + .filter((pic) => !!pic.url) + .map((pic, index) => ( + 0} + style={{ + paddingTop: "48px", + paddingBottom: "32px", + maxHeight: "100vh", + }} + key={pic.id} + size="A4" + > + + + + + )) + : null} ); };