Skip to content

Commit 2cd9c0e

Browse files
GavversFlamenco
authored andcommitted
Demo function and html for text alignment
Removed text angling demo since that was not really relevant to my additions.
1 parent 619b288 commit 2cd9c0e

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

examples/basic.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,23 @@ <h2><a href="#">Text alignment</a></h2>
364364
pdf.save('Test.pdf');</pre>
365365
<a href="javascript:demoTextAlign()" class="button">Run Code</a></p></div>
366366

367+
368+
<h2><a href="#">Text alignment</a></h2>
369+
<div><p><pre>var pdf = new jsPDF('p', 'pt', 'letter');
370+
371+
pdf.text( 'This text is centered\raround\rthis point.', 150, 50, 'center' );
372+
pdf.text( 'This text is centered\raround\rthis point.', 150, 300, 45, 'center' );
373+
pdf.text( 'This text is\raligned to the\rright.', 150, 400, 'right' );
374+
pdf.text( 'This text is\raligned to the\rright.', 150, 550, 45, 'right' );
375+
376+
pdf.text( 'This text is centered\raround\rthis point.', 400, 50, 'center' );
377+
pdf.text( 'This text is centered\raround\rthis point.', 400, 150, -85, 'center' );
378+
pdf.text( 'This text is\raligned to the\rright.', 400, 400, 'right' );
379+
pdf.text( 'This text is\raligned to the\rright.', 400, 550, -85, 'right' );
380+
381+
pdf.save('Test.pdf');</pre>
382+
<a href="javascript:demoTextAlign()" class="button">Run Code</a></p></div>
383+
367384
</div>
368385
</div>
369386

examples/js/basic.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ function demoFromHTML() {
352352
)
353353
}
354354

355+
<<<<<<< Upstream, based on mr_rio/master
355356
function demoTextAlign() {
356357
var pdf = new jsPDF('p', 'pt', 'letter');
357358

@@ -390,6 +391,8 @@ function demoTextAngles() {
390391
pdf.save('Test.pdf');
391392
}
392393

394+
=======
395+
>>>>>>> f2bcc5e Demo function and html for text alignment
393396
function demoTextAlign() {
394397
var pdf = new jsPDF('p', 'pt', 'letter');
395398

@@ -404,4 +407,4 @@ function demoTextAlign() {
404407
pdf.text( 'This text is\raligned to the\rright.', 400, 550, -85, 'right' );
405408

406409
pdf.save('Test.pdf');
407-
}
410+
}

0 commit comments

Comments
 (0)