Skip to content

Commit 48d880a

Browse files
committed
moved examples to example folder, updated paths, and added comments
1 parent 5b510fa commit 48d880a

20 files changed

Lines changed: 131 additions & 70 deletions
File renamed without changes.
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
<head>
1414
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
1515

16-
<title>Annotaion Test</title>
16+
<title>Annotation Test</title>
1717

18-
<script src='../libs/require/require.js'></script>
18+
<script src='../../libs/require/require.js'></script>
1919

2020
<script>
21-
require(['../libs/require/config'], function(){
22-
require(['jspdf.plugin.annotations', 'test/test_harness'], function(){
23-
21+
require_baseUrl_override = '../../';
22+
require(['../../libs/require/config'], function(){
23+
require(['jspdf.plugin.annotations', 'examples/js/test_harness'], function(){
24+
2425
var pdf = new jsPDF('p', 'pt', 'letter');
2526

2627
// Create pages with a table of contents.
@@ -76,8 +77,9 @@
7677
To test magFactor links [...] without bugs, use Adobe Reader or compatible application.';
7778

7879
pdf_test_harness_init(pdf, message);
79-
});
80-
});
80+
81+
}); // require
82+
}); // require
8183

8284
</script>
8385

test/test_annotation_2.html renamed to examples/annotation/test_annotation_2.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
1515

1616
<title>Annotation Test - Text</title>
17-
<script src='../libs/require/require.js'></script>
17+
<script src='../../libs/require/require.js'></script>
1818

1919
<script>
20-
require([
21-
'../libs/require/config'
22-
], function() {
23-
require([
24-
'test/test_harness', 'jspdf.plugin.annotations'
25-
], function() {
20+
require_baseUrl_override = '../../';
21+
require(['../../libs/require/config'], function(){
22+
require(['jspdf.plugin.annotations', 'examples/js/test_harness'], function(){
2623

2724
var pdf = new jsPDF('p', 'pt', 'letter');
2825
var y = 20;
@@ -78,7 +75,8 @@
7875

7976
var warning = 'Most web browsers do not display annotations. Download the PDF and open in Adobe Reader, etc).'
8077
pdf_test_harness_init(pdf, warning);
81-
}); // require
78+
79+
}); // require
8280
}); // require
8381
</script>
8482

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,12 @@
1414
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
1515

1616
<title>Context2D Test</title>
17-
18-
<!--
19-
<script type="text/javascript" src="../jspdf.js"></script>
20-
required by the plugin to test
21-
<script type="text/javascript" src="../jspdf.plugin.standard_fonts_metrics.js"></script>
22-
<script type="text/javascript" src="../jspdf.plugin.split_text_to_size.js"></script>
23-
<script type="text/javascript" src="../jspdf.plugin.addimage.js"></script>
24-
the plugin to test
25-
<script type="text/javascript" src="../jspdf.plugin.context2d.js"></script>
26-
<script type="text/javascript" src="test_harness.js"></script> -->
27-
28-
<script src='../libs/require/require.js'></script>
17+
<script src='../../libs/require/require.js'></script>
2918

3019
<script>
31-
require(['../libs/require/config'], function(){
32-
require(['jspdf.plugin.context2d', 'test/test_harness'], function(){
20+
require_baseUrl_override = '../../';
21+
require(['../../libs/require/config'], function(){
22+
require(['jspdf.plugin.context2d', 'examples/js/test_harness'], function(){
3323

3424
var pdf = new jsPDF('p', 'pt', 'letter');
3525
var ctx = pdf.context2d;
@@ -409,8 +399,8 @@
409399
pdf_test_harness_init(pdf);
410400

411401

412-
});
413-
});
402+
}); // require
403+
}); // require
414404

415405
</script>
416406

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!doctype html>
2+
<!--
3+
/**
4+
* jsPDF Context2d PlugIn
5+
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
6+
*
7+
* Licensed under the MIT License.
8+
* http://opensource.org/licenses/mit-license
9+
*/
10+
-->
11+
12+
<html>
13+
<head>
14+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
15+
16+
<title>Context2D Paths Test</title>
17+
18+
<script src='../../libs/require/require.js'></script>
19+
20+
<script>
21+
require_baseUrl_override = '../../';
22+
require(['../../libs/require/config'], function(){
23+
require(['jspdf.plugin.context2d', 'examples/js/test_harness'], function(){
24+
25+
var pdf = new jsPDF('p', 'pt', 'letter');
26+
var context = pdf.context2d;
27+
28+
context.beginPath();
29+
context.arc(150,150,50,0,Math.PI, false);
30+
context.lineTo(300,300);
31+
//context.moveTo(300,150);
32+
//context.rect(5,5,150,150);
33+
//context.arc(150,150,50,0,Math.PI, false);
34+
context.stroke();
35+
36+
context.fillStyle = 'red';
37+
context.fillRect(545,205,50,40);
38+
39+
pdf_test_harness_init(pdf);
40+
41+
42+
}); // require
43+
}); // require
44+
45+
</script>
46+
47+
</head>
48+
49+
<body style='background-color: silver; margin: 0;'>
50+
</body>
51+
</html>

examples/html2pdf/auto_break.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
</style>
88
</head>
99
<body>
10-
<div style='position: absolute; left: 0; top: 0; bottom: 0; width:400px; overflow: auto'>
10+
<div style='position: absolute; left: 0; top: 0; bottom: 0; width: 400px; overflow: auto'>
1111
<h1>Autobreak</h1>
1212
<p>The context2d plugin was tweaked to auto-break a document into multiple pages.</p>
1313
<p>The auto-page-break feature allows vertical positioning by addressing the Y coordinate beyond the PDF page.</p>
14+
<p>
15+
Note: <em>There is a margin bug that causes an item to not draw in the break.</em>
16+
</p>
1417
<ol>
1518
<li>OL Item</li>
1619
<li>OL Item</li>
@@ -141,13 +144,13 @@ <h1>Autobreak</h1>
141144
</ol>
142145
</div>
143146

144-
<script src='../../libs/require/require.js'></script>
147+
<script src='../../libs/require/require.js'></script>
145148

146-
<script>
149+
<script>
147150
require_baseUrl_override = '../..';
148151
require(['../../libs/require/config'], function(){
149152
require(['html2pdf'], function(){
150-
var pdf = new jsPDF('p', 'pt', 'letter');
153+
var pdf = new jsPDF('p', 'pt', 'letter');
151154
var canvas = pdf.canvas;
152155
canvas.height = 72 * 11;
153156
canvas.width=72 * 8.5;;
@@ -166,8 +169,9 @@ <h1>Autobreak</h1>
166169
//document.body.appendChild(div);
167170
}
168171
);
169-
});
170-
});
172+
173+
}); // require
174+
}); // require
171175
</script>
172176
</body>
173177
</html>

examples/html2pdf/lists.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h2>Not Implemented</h2>
5050
require(['../../libs/require/config'], function(){
5151
require(['html2pdf'], function(){
5252

53-
var pdf = new jsPDF('p', 'pt', 'letter');
53+
var pdf = new jsPDF('p', 'pt', 'letter');
5454
var canvas = pdf.canvas;
5555
canvas.height = 72 * 11;
5656
canvas.width=72 * 8.5;;
@@ -68,8 +68,8 @@ <h2>Not Implemented</h2>
6868
}
6969
);
7070

71-
});
72-
});
71+
}); // require
72+
}); // require
7373
</script>
7474
</body>
7575
</html>

examples/html2pdf/page_break.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
</head>
1717
<body>
1818
<div style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>
19-
This example show how the <em>page-break-before</em> style is rendered.
20-
19+
This example show how the <em>page-break-before</em> style is rendered.
20+
2121
<h1 style='page-break-before: always'>Numbers</h1>
2222
<p>1</p>
2323
<p>2</p>
2424
<p>3</p>
2525
<p>4</p>
2626

27-
<h1 style='page-break-before: always'>Letters </h1>
27+
<h1 style='page-break-before: always'>Letters</h1>
2828
<p>a</p>
2929
<p>b</p>
3030
<p>c</p>
3131
<p>d</p>
3232

3333
<h1 style='page-break-before: always'>Text</h1>
3434
<p>This is the content.</p>
35-
35+
3636
</div>
3737

3838
<script src='../../libs/require/require.js'></script>
@@ -53,8 +53,9 @@ <h1 style='page-break-before: always'>Text</h1>
5353
document.body.appendChild(iframe);
5454
iframe.src = pdf.output('datauristring');
5555
});
56-
});
57-
});
56+
57+
}); // require
58+
}); // require
5859
</script>
5960
</body>
6061
</html>

examples/html2pdf/pdf.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ <h1>sing to me, erbarme dich</h1>
160160
require(['../../libs/require/config'], function(){
161161
require(['html2pdf'], function(){
162162

163-
var pdf = new jsPDF('p', 'pt', 'letter');
164-
var canvas = pdf.canvas;
163+
var pdf = new jsPDF('p', 'pt', 'letter');
164+
var canvas = pdf.canvas;
165165

166166
canvas.width=8.5*72;
167167

@@ -178,8 +178,9 @@ <h1>sing to me, erbarme dich</h1>
178178
//document.body.appendChild(div);
179179
}
180180
});
181-
});
182-
});
181+
182+
}); // require
183+
}); // require
183184
</script>
184185
</body>
185186
</html>

0 commit comments

Comments
 (0)