Search code examples
reactjsjspdfhtml2canvas

Live preview with React, Html2Canvas and JsPDF


I am creating a resume-generating web app using react, html2canvas and jspdf. I want to get a live preview of the pdf when someone submits a form. I spent several hours looking for a solution to it. But bad luck. This site has a great example of what I want [ Here ]. Does anyone have an idea, Link?


Solution

  • From your question I understand that you don't need jspdf for live preview as you just need to display image of the resume created using html2canvas. Check the implementation here

    jspdf is only required when you need to download it as pdf then you can convert the image generated by html2canvas to pdf using jspdf

    Update

    To hide the HTML elements and only show the canvas you can try something like this.