im using react-pdf library i managed to save file localy but now i would also need to save it on server since i am required to do a history display of all the files that were generated by a certain user.
document={
<DailyAssetPDF
information={{ title, subtitle, locationName, today, selectedAssetName }}
tableData={tableData}
image1={{
chart1, chart2, chart4 // donut chart
}}
image2={
this.chartRef3.current.chartInstance.toBase64Image() || // chart bar
""
}
LN={LN}
language={language}
/>
}
fileName={`${title}.pdf`}
>
{({ loading }) =>
loading ? (
LN[language].loadingDocument
) : (
<Button>{LN[language].report_export_btn}</Button>
)
}
</PDFDownloadLink> ```
the best solution for me was:
send the data that we want on the pdf file from react to backend [json FORMAT]
create the same pdf in the backend and save it there [using multer ..] OR on DB
for more inspiration visit : https://github.com/exportsdk/sample-react-pdf-api