Commit f0a03075 authored by Open Source Developer's avatar Open Source Developer

trans

parent 1f38530f
...@@ -183,45 +183,34 @@ import * as html2canvas from "html2canvas" ...@@ -183,45 +183,34 @@ import * as html2canvas from "html2canvas"
} }
createPdf() createPdf1()
{ {
console.log("lalalalalala");
html2canvas(document.getElementById("target")).then(function(canvas) html2canvas(document.getElementById("target")).then(function(canvas)
{ {
var img = canvas.toDataURL(); var img = canvas.toDataURL();
var doc = new jsPDF('p', 'mm'); var doc = new jsPDF();
doc.onload = function(){
console.log(img, doc, "lalalalalala"); console.log(img, doc, "lalalalalala");
doc.addImage(img, 'PNG', 10, 10); doc.addImage(img, 'PNG',0, 0, 210, 297);
doc.save('applications.pdf'); doc.save('applications.pdf');
}
}); });
} }
createPdf()
createPdf1()
{ {
var srcpath; var doc = new jsPDF();
var imgageData = new Image(); doc.text(20, 20, 'Hello world!');
imgageData.id = "pic"; doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
var doc = new jsPDF({ doc.addPage();
unit:'px', doc.text(20, 20, 'Do you like that?');
format:'a4'
}); // Save the PDF
console.log("lalalalalala"); doc.save('Test.pdf');
html2canvas(document.getElementById("target")), {
onrendered: function (canvas) {
srcpath = canvas.toDataURL("image/png");
imgageData.src=srcpath;
doc.addImage(imgageData , 'PNG', 20, 20,400,150);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment