| 9 |
lars |
1 |
var name = prompt('What is your name?');
|
|
|
2 |
var multiplier = parseInt(prompt('Enter a number:'));
|
|
|
3 |
|
|
|
4 |
var doc = new jsPDF();
|
|
|
5 |
doc.setFontSize(22);
|
|
|
6 |
doc.text(20, 20, 'Questions');
|
|
|
7 |
doc.setFontSize(16);
|
|
|
8 |
doc.text(20, 30, 'This belongs to: ' + name);
|
|
|
9 |
|
|
|
10 |
for(var i = 1; i <= 12; i ++) {
|
|
|
11 |
doc.text(20, 30 + (i * 10), i + ' x ' + multiplier + ' = ___');
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
doc.addPage();
|
|
|
15 |
doc.setFontSize(22);
|
|
|
16 |
doc.text(20, 20, 'Answers');
|
|
|
17 |
doc.setFontSize(16);
|
|
|
18 |
|
|
|
19 |
for(var i = 1; i <= 12; i ++) {
|
|
|
20 |
doc.text(20, 30 + (i * 10), i + ' x ' + multiplier + ' = ' + (i * multiplier));
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
// You wouldn't normally call this - this is just to make the
|
|
|
24 |
// demo not look broken as we've disabled auto update.
|
|
|
25 |
if (jsPDFEditor !== undefined) {
|
|
|
26 |
jsPDFEditor.update(true);
|
|
|
27 |
}
|