@@ -355,15 +355,28 @@ function demoFromHTML() {
355
355
function demoTextAlign ( ) {
356
356
var pdf = new jsPDF ( 'p' , 'pt' , 'letter' ) ;
357
357
358
- pdf . text ( 'This text is centered\raround\rthis point.' , 150 , 50 , 'center' ) ;
359
- pdf . text ( 'This text is centered\raround\rthis point.' , 150 , 300 , 45 , 'center' ) ;
360
- pdf . text ( 'This text is\raligned to the\rright.' , 150 , 400 , 'right' ) ;
361
- pdf . text ( 'This text is\raligned to the\rright.' , 150 , 550 , 45 , 'right' ) ;
362
-
363
- pdf . text ( 'This text is centered\raround\rthis point.' , 400 , 50 , 'center' ) ;
364
- pdf . text ( 'This text is centered\raround\rthis point.' , 400 , 150 , - 85 , 'center' ) ;
365
- pdf . text ( 'This text is\raligned to the\rright.' , 400 , 400 , 'right' ) ;
366
- pdf . text ( 'This text is\raligned to the\rright.' , 400 , 550 , - 85 , 'right' ) ;
358
+ pdf . setFillColor ( 0 ) ;
359
+ pdf . circle ( 140 , 50 , 2 , "F" ) ;
360
+ pdf . text ( 'This text is normally\raligned.' , 140 , 50 ) ;
361
+
362
+ pdf . circle ( 140 , 120 , 2 , "F" ) ;
363
+ pdf . text ( 'This text is centered\raround\rthis point.' , 140 , 120 , 'center' ) ;
364
+
365
+ pdf . circle ( 140 , 300 , 2 , "F" ) ;
366
+ pdf . text ( 'This text is rotated\rand centered around\rthis point.' , 140 , 300 , 45 , 'center' ) ;
367
+
368
+ pdf . circle ( 140 , 400 , 2 , "F" ) ;
369
+ pdf . text ( 'This text is\raligned to the\rright.' , 140 , 400 , 'right' ) ;
370
+
371
+ pdf . circle ( 140 , 550 , 2 , "F" ) ;
372
+ pdf . text ( 'This text is\raligned to the\rright.' , 140 , 550 , 45 , 'right' ) ;
373
+
374
+ pdf . circle ( 460 , 50 , 2 , "F" ) ;
375
+ pdf . text ( 'This single line is centered' , 460 , 50 , 'center' ) ;
376
+
377
+ pdf . circle ( 460 , 200 , 2 , "F" ) ;
378
+ pdf . text ( 'This right aligned text\r\rhas an empty line.' , 460 , 200 , 'right' ) ;
379
+
367
380
368
381
pdf . save ( 'Test.pdf' ) ;
369
382
}
0 commit comments