2

I am trying to convert HTML & CSS of a page to PDF using jsPDF:

var pdf = new jsPDF('l', 'pt', 'a4');
pdf.addHTML(document.getElementsByClassName("container"),0,0, function () {
  pdf.save('web.pdf');
});

However, jsPDF exclude CSS. Also, the PDF created is a file that is downloaded to local storage. I would like the PDF to be hold as a variable and so that it can be sent as attachment in email. Please suggest what is the alternatives that is available?

1

1 Answer 1

2

To send pdf as mail, you would need to do that from the server. So, the best way would be to create a pdf file at the server, too.

If you are using Node as your server-side language, you can use html-pdf to create pdf file and then use Nodemailer to send it as email.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.