I'm trying to create a blog post website where anyone can post anything. And also any user can download any post in one click. So is it possible to implement a button for download whole specific post content except side menus and comment in react.
Asked
Active
Viewed 97 times
-1
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 06 '22 at 23:50
1 Answers
0
I assume you want to give the user the ability to download a blog post (react component) as pdf.
Check out this tutorial by Robin Wieruch
What you basically do is create a ref for your component and then convert it to a canvas with html2canvas npm package, then to image data.
The image data is added to a pdf with pdfjs npm package and downloaded.
See the link for details.

Tin Stribor Sohn
- 204
- 1
- 4