Skip to content

Commit 21aceb6

Browse files
committed
Get the example pages running
1 parent fc841d0 commit 21aceb6

File tree

10 files changed

+96
-135
lines changed

10 files changed

+96
-135
lines changed

examples/html2pdf/auto_break.html

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,34 +144,28 @@ <h1>Autobreak</h1>
144144
</ol>
145145
</div>
146146

147-
<script src='../../libs/require/require.js'></script>
148-
147+
<script src='../../../dist/jspdf.debug.js'></script>
148+
<script src='../../libs/html2pdf.js'></script>
149149
<script>
150-
require_baseUrl_override = '../..';
151-
require(['../../libs/require/config'], function(){
152-
require(['html2pdf'], function(){
153150
var pdf = new jsPDF('p', 'pt', 'letter');
154151
var canvas = pdf.canvas;
155152
canvas.height = 72 * 11;
156153
canvas.width=72 * 8.5;;
157154
// var width = 400;
158-
155+
159156
document.body.style.width = 400 + 'px';
160-
161-
html2pdf(document.body, pdf, function(pdf) {
157+
158+
html2pdf(document.body, pdf, function(pdf) {
162159
var iframe = document.createElement('iframe');
163160
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
164161
document.body.appendChild(iframe);
165162
iframe.src = pdf.output('datauristring');
166-
163+
167164
//var div = document.createElement('pre');
168165
//div.innerText=pdf.output();
169166
//document.body.appendChild(div);
170167
}
171168
);
172-
173-
}); // require
174-
}); // require
175169
</script>
176170
</body>
177171
</html>

examples/html2pdf/lists.html

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,19 @@ <h2>Not Implemented</h2>
4747
<script src='../../libs/html2pdf.js'></script>
4848

4949
<script>
50+
var pdf = new jsPDF('p', 'pt', 'letter');
51+
var canvas = pdf.canvas;
52+
canvas.height = 72 * 11;
53+
canvas.width=72 * 8.5;;
54+
// var width = 400;
5055

51-
var pdf = new jsPDF('p', 'pt', 'letter');
52-
var canvas = pdf.canvas;
53-
canvas.height = 72 * 11;
54-
canvas.width=72 * 8.5;;
55-
// var width = 400;
56-
57-
html2pdf(document.body, pdf, function(canvas) {
58-
var iframe = document.createElement('iframe');
59-
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
60-
document.body.appendChild(iframe);
61-
iframe.src = pdf.output('datauristring');
62-
63-
//var div = document.createElement('pre');
64-
//div.innerText=pdf.output();
65-
//document.body.appendChild(div);
66-
}
67-
);
68-
69-
</script>
56+
html2pdf(document.body, pdf, function(canvas) {
57+
var iframe = document.createElement('iframe');
58+
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
59+
document.body.appendChild(iframe);
60+
iframe.src = pdf.output('datauristring');
61+
}
62+
);
63+
</script>
7064
</body>
7165
</html>

examples/html2pdf/page_break.html

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,17 @@ <h1 style='page-break-before: always'>Text</h1>
3838
<script src='../../../dist/jspdf.debug.js'></script>
3939
<script src='../../libs/html2pdf.js'></script>
4040
<script>
41-
42-
43-
var pdf = new jsPDF('p', 'pt', 'letter');
44-
pdf.canvas.height = 72 * 11;
45-
pdf.canvas.width = 72 * 8.5;
46-
47-
//html2pdf(document.documentElement.innerHTML, pdf, function(pdf){
48-
html2pdf(document.body, pdf, function(pdf){
49-
var iframe = document.createElement('iframe');
50-
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
51-
document.body.appendChild(iframe);
52-
iframe.src = pdf.output('datauristring');
53-
});
54-
55-
</script>
41+
var pdf = new jsPDF('p', 'pt', 'letter');
42+
pdf.canvas.height = 72 * 11;
43+
pdf.canvas.width = 72 * 8.5;
44+
45+
//html2pdf(document.documentElement.innerHTML, pdf, function(pdf){
46+
html2pdf(document.body, pdf, function(pdf){
47+
var iframe = document.createElement('iframe');
48+
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
49+
document.body.appendChild(iframe);
50+
iframe.src = pdf.output('datauristring');
51+
});
52+
</script>
5653
</body>
5754
</html>

examples/html2pdf/pdf.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,26 @@ <h1>sing to me, erbarme dich</h1>
155155

156156
<script src='../../../dist/jspdf.debug.js'></script>
157157
<script src='../../libs/html2pdf.js'></script>
158-
<script>
159-
160-
var pdf = new jsPDF('p', 'pt', 'letter');
161-
var canvas = pdf.canvas;
162-
163-
canvas.width=8.5*72;
164-
165-
html2canvas(document.body, {
166-
canvas:canvas,
167-
onrendered: function(canvas) {
168-
var iframe = document.createElement('iframe');
169-
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
170-
document.body.appendChild(iframe);
171-
iframe.src = pdf.output('datauristring');
172-
173-
//var div = document.createElement('pre');
174-
//div.innerText=pdf.output();
175-
//document.body.appendChild(div);
176-
}
177-
});
158+
<script>
159+
160+
var pdf = new jsPDF('p', 'pt', 'letter');
161+
var canvas = pdf.canvas;
162+
163+
canvas.width = 8.5 * 72;
164+
165+
html2canvas(document.body, {
166+
canvas:canvas,
167+
onrendered: function(canvas) {
168+
var iframe = document.createElement('iframe');
169+
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
170+
document.body.appendChild(iframe);
171+
iframe.src = pdf.output('datauristring');
172+
173+
//var div = document.createElement('pre');
174+
//div.innerText=pdf.output();
175+
//document.body.appendChild(div);
176+
}
177+
});
178178
</script>
179179
</body>
180180
</html>

examples/html2pdf/pdf2.html

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,25 @@ <h2>More content</h2>
6363
<script src='../../libs/html2pdf.js'></script>
6464

6565
<script>
66+
var pdf = new jsPDF('p', 'pt', 'letter');
67+
var canvas = pdf.canvas;
68+
var width = 600;
69+
//canvas.width=8.5*72;
70+
document.body.style.width=width + "px";
6671

72+
html2canvas(document.body, {
73+
canvas:canvas,
74+
onrendered: function(canvas) {
75+
var iframe = document.createElement('iframe');
76+
iframe.setAttribute('style', 'position:absolute;top:0;right:0;height:100%; width:600px');
77+
document.body.appendChild(iframe);
78+
iframe.src = pdf.output('datauristring');
6779

68-
var pdf = new jsPDF('p', 'pt', 'letter');
69-
var canvas = pdf.canvas;
70-
71-
var width = 600;
72-
//canvas.width=8.5*72;
73-
document.body.style.width=width + "px";
74-
75-
html2canvas(document.body, {
76-
canvas:canvas,
77-
onrendered: function(canvas) {
78-
var iframe = document.createElement('iframe');
79-
iframe.setAttribute('style', 'position:absolute;top:0;right:0;height:100%; width:600px');
80-
document.body.appendChild(iframe);
81-
iframe.src = pdf.output('datauristring');
82-
83-
//var div = document.createElement('pre');
84-
//div.innerText=pdf.output();
85-
//document.body.appendChild(div);
86-
}
87-
});
80+
//var div = document.createElement('pre');
81+
//div.innerText=pdf.output();
82+
//document.body.appendChild(div);
83+
}
84+
});
8885
</script>
8986
</body>
9087
</html>

examples/html2pdf/showcase.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ <h2>Font Size</h2>
7070
<script src='../../libs/html2pdf.js'></script>
7171

7272
<script>
73-
require_baseUrl_override = '../..';
74-
75-
7673
var pdf = new jsPDF('p', 'pt', 'letter');
7774
var canvas = pdf.canvas;
7875
canvas.height = 72 * 11;

examples/html2pdf/showcase_supported_html.html

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,15 @@ <h2>External</h2>
204204
<script src='../../libs/html2pdf.js'></script>
205205

206206
<script>
207-
var pdf = new jsPDF('p', 'pt', 'letter');
208-
pdf.canvas.height = 72 * 11;
209-
pdf.canvas.width = 72 * 8.5;
210-
211-
//html2pdf(document.documentElement.innerHTML, pdf, function(pdf){
212-
html2pdf(document.body, pdf, function(pdf){
213-
var iframe = document.createElement('iframe');
214-
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
215-
document.body.appendChild(iframe);
216-
iframe.src = pdf.output('datauristring');
217-
});
218-
</script>
207+
var pdf = new jsPDF('p', 'pt', 'letter');
208+
pdf.canvas.height = 72 * 11;
209+
pdf.canvas.width = 72 * 8.5;
210+
html2pdf(document.body, pdf, function(pdf){
211+
var iframe = document.createElement('iframe');
212+
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
213+
document.body.appendChild(iframe);
214+
iframe.src = pdf.output('datauristring');
215+
});
216+
</script>
219217
</body>
220218
</html>

examples/html2pdf/simple.html

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,18 @@
1010
</body>
1111
</html>
1212

13-
<script src='../../libs/require/require.js'></script>
13+
<script src='../../../dist/jspdf.debug.js'></script>
14+
<script src='../../libs/html2pdf.js'></script>
1415
<script>
15-
require_baseUrl_override = '../..';
16-
17-
require(['../../libs/require/config'], function(){
18-
require(['html2pdf'], function(){
1916
var pdf = new jsPDF('p', 'pt', 'letter');
2017
var canvas = pdf.canvas;
2118
canvas.height = 72 * 11;
2219
canvas.width= 72 * 8.5;;
23-
20+
2421
// can also be document.body
2522
var html = '<html><body>Hello <strong> World</strong></body></html>';
2623

27-
html2pdf(html, pdf, function(pdf) {
28-
pdf.output('dataurlnewwindow');
24+
html2pdf(html, pdf, function(pdf) {
25+
pdf.output('dataurlnewwindow');
2926
});
30-
}); //require
31-
}); //require
32-
</script>
27+
</script>

examples/html2pdf/tables.html

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
}
8080

8181
.CSSTableGenerator tr:hover td {
82-
82+
8383
}
8484

8585
.CSSTableGenerator tr:nth-child(odd) {
@@ -214,32 +214,26 @@ <h1>Tables</h1>
214214
</table>
215215
</div>
216216

217-
<script src='../../libs/require/require.js'></script>
218-
217+
<script src='../../../dist/jspdf.debug.js'></script>
218+
<script src='../../libs/html2pdf.js'></script>
219219
<script>
220-
require_baseUrl_override = '../..';
221-
require(['../../libs/require/config'], function(){
222-
require(['html2pdf'], function(){
223-
220+
224221
var pdf = new jsPDF('p', 'pt', 'letter');
225222
var canvas = pdf.canvas;
226223
canvas.height = 72 * 11;
227224
canvas.width=72 * 8.5;;
228225
// var width = 400;
229-
html2pdf(document.body, pdf, function(pdf) {
226+
html2pdf(document.body, pdf, function(pdf) {
230227
var iframe = document.createElement('iframe');
231228
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
232229
document.body.appendChild(iframe);
233230
iframe.src = pdf.output('datauristring');
234-
231+
235232
//var div = document.createElement('pre');
236233
//div.innerText=pdf.output();
237234
//document.body.appendChild(div);
238235
}
239236
);
240-
241-
}); // require
242-
}); // require
243237
</script>
244238
</body>
245239
</html>

examples/html2pdf/total_mess.html

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,32 +243,27 @@ <h2>Div and Span Tests</h2>
243243
<p>
244244
</div>
245245

246-
<script src='../../libs/require/require.js'></script>
247-
246+
<script src='../../../dist/jspdf.debug.js'></script>
247+
<script src='../../libs/html2pdf.js'></script>
248248
<script>
249-
require_baseUrl_override = '../..';
250-
require(['../../libs/require/config'], function(){
251-
require(['html2pdf'], function(){
252-
249+
253250
var pdf = new jsPDF('p', 'pt', 'letter');
254251
var canvas = pdf.canvas;
255252
canvas.height = 72 * 11;
256253
canvas.width=72 * 8.5;;
257254
// var width = 400;
258-
259-
html2pdf(document.body, pdf,function(pdf) {
255+
256+
html2pdf(document.body, pdf,function(pdf) {
260257
var iframe = document.createElement('iframe');
261258
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
262259
document.body.appendChild(iframe);
263260
iframe.src = pdf.output('datauristring');
264-
261+
265262
//var div = document.createElement('pre');
266263
//div.innerText=pdf.output();
267264
//document.body.appendChild(div);
268265
}
269266
);
270-
});
271-
});
272267
</script>
273268
</body>
274269
</html>

0 commit comments

Comments
 (0)