I want to download pdf where the source is a url or a div.
I have a database of quizzes based on different categories. These quizzes have MCQ and images. I am able to render the quiz in an HTML however I want to give users a chance to download the quiz on each topic as pdf using "click here to download"
On clicking a pdf with the questions and images will be downloaded. I tried using
pdfMake
using the following code
$("#download_quiz").click(function(){
// create the window before the callback
// pass the "win" argument
var docDefinition={
content:[
"hello world"
]
}
pdfMake.createPdf(docDefinition).download();
});
however, my content is dynamic. How do I achieve it ? Is there another way to do this. I am using Django as my webdev.