Closed mayurbrainvire closed 5 months ago
const handleDownload = useReactToPrint({ content: () => componentRef?.current, removeAfterPrint: true, pageStyle: pageStyle, print: async (printIframe) => { const document = printIframe?.contentDocument; if (document) { const html = componentRef?.current; const exporter = new html2pdf(html, { filename: "candidates.pdf", image: { type: "jpeg", quality: 1 }, html2canvas: { scale: 1, useCORS: true }, jsPDF: { format: "A4" }, }); exporter.getPdf(true); } }, copyStyles: true, }); <ReactToPrint // content={reactToPrintContent} // for preview and download content={handleDownload} documentTitle="candidates" trigger={reactToPrintTrigger} pageStyle={pageStyle} onBeforeGetContent={handleOnBeforeGetContent} />
Hello. This seems like an issue with html2pdf. What makes you believe there is a problem with react-to-print?
html2pdf
react-to-print