Answer the question
In order to leave comments, you need to log in
How to generate pdf from or html string(or template)?
Here's what I've sketched out so far, and this is the code.
<div id="root">
<div class="container">
<div class="row">
<div class="col-sm-6">
<input type="text" v-model="text">
</div>
<div class="col-sm-6">
<object id="pdf_viewer" type="application/pdf" :data="output" width="100%" height="400"></object>
</div>
</div>
</div>
</div>
new Vue({
el: "#root",
data: {
text: "Hello Kitty"
},
computed: {
output() {
const pdf = new jsPDF();
pdf.text(this.text, 10, 10);
return pdf.output("datauristring");
}
}
});
<div class="container">
<div class="logo"><img src="/img/logo" alt="logo"></div>
<h1 class="heading">{{ this.text }}</h1>
<div class="row">
<div class="col-md-4">какой-то контент</div>
<div class="col-md-4">какой-то контент</div>
<div class="col-md-4">какой-то контент</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question