Skip to content

Commit 725e49e

Browse files
committed
Added demo functions to basic.js
To demo text alignment and angling.
1 parent 5f482ab commit 725e49e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

examples/js/basic.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,28 @@ function demoFromHTML() {
351351
margins
352352
)
353353
}
354+
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+
364+
function demoTextAlign() {
365+
var pdf = new jsPDF('p', 'pt', 'letter');
366+
367+
pdf.text( 'This text is centered\raround\rthis point.', 150, 50, 'center' );
368+
pdf.text( 'This text is centered\raround\rthis point.', 150, 300, 45, 'center' );
369+
pdf.text( 'This text is\raligned to the\rright.', 150, 400, 'right' );
370+
pdf.text( 'This text is\raligned to the\rright.', 150, 550, 45, 'right' );
371+
372+
pdf.text( 'This text is centered\raround\rthis point.', 400, 50, 'center' );
373+
pdf.text( 'This text is centered\raround\rthis point.', 400, 150, -85, 'center' );
374+
pdf.text( 'This text is\raligned to the\rright.', 400, 400, 'right' );
375+
pdf.text( 'This text is\raligned to the\rright.', 400, 550, -85, 'right' );
376+
377+
pdf.save('Test.pdf');
378+
}

0 commit comments

Comments
 (0)