Skip to content

Commit de9aa82

Browse files
committed
Demo function and html for text alignment
Removed text angling demo since that was not really relevant to my additions.
1 parent 725e49e commit de9aa82

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

examples/basic.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,23 @@ <h2></h2>
342342
</pre>
343343
<button onclick="javascript:demoFromHTML()" class="button">Run Code</button></p></div></div>
344344

345+
346+
<h2><a href="#">Text alignment</a></h2>
347+
<div><p><pre>var pdf = new jsPDF('p', 'pt', 'letter');
348+
349+
pdf.text( 'This text is centered\raround\rthis point.', 150, 50, 'center' );
350+
pdf.text( 'This text is centered\raround\rthis point.', 150, 300, 45, 'center' );
351+
pdf.text( 'This text is\raligned to the\rright.', 150, 400, 'right' );
352+
pdf.text( 'This text is\raligned to the\rright.', 150, 550, 45, 'right' );
353+
354+
pdf.text( 'This text is centered\raround\rthis point.', 400, 50, 'center' );
355+
pdf.text( 'This text is centered\raround\rthis point.', 400, 150, -85, 'center' );
356+
pdf.text( 'This text is\raligned to the\rright.', 400, 400, 'right' );
357+
pdf.text( 'This text is\raligned to the\rright.', 400, 550, -85, 'right' );
358+
359+
pdf.save('Test.pdf');</pre>
360+
<a href="javascript:demoTextAlign()" class="button">Run Code</a></p></div>
361+
345362
</div>
346363
</div>
347364

examples/js/basic.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,6 @@ function demoFromHTML() {
352352
)
353353
}
354354

355-
function demoTextAngles() {
356-
var pdf = new jsPDF('p', 'pt', 'letter');
357-
358-
pdf.text( 'This text is at angle 0', 150, 50, 0 );
359-
pdf.text( 'This text is at angle 45', 150, 300, 45 );
360-
pdf.text( 'This text is at angle 90', 150, 600, 90 );
361-
pdf.save('Test.pdf');
362-
}
363-
364355
function demoTextAlign() {
365356
var pdf = new jsPDF('p', 'pt', 'letter');
366357

0 commit comments

Comments
 (0)