@@ -63,7 +63,7 @@ describe("Module: Annotations", () => {
63
63
} ) ;
64
64
65
65
doc . textWithLink ( "Click me!" , 10 , 10 , {
66
- url : "https://parall.ax/" ,
66
+ url : "https://parall.ax/"
67
67
} ) ;
68
68
69
69
doc . addPage ( "a4" ) ;
@@ -72,4 +72,38 @@ describe("Module: Annotations", () => {
72
72
73
73
comparePdf ( doc . output ( ) , "insertLinkAddPage.pdf" , "annotations" ) ;
74
74
} ) ;
75
+ it ( "should align text link based on the align option" , ( ) => {
76
+ var doc = new jsPDF ( {
77
+ unit : "px" ,
78
+ format : [ 200 , 300 ] ,
79
+ floatPrecision : 2
80
+ } ) ;
81
+
82
+ doc . textWithLink (
83
+ "Left aligned Link" ,
84
+ doc . internal . pageSize . getWidth ( ) / 2 ,
85
+ 10 ,
86
+ { align : "left" , url : "https://www.google.com" }
87
+ ) ;
88
+ doc . textWithLink (
89
+ "Center aligned Link" ,
90
+ doc . internal . pageSize . getWidth ( ) / 2 ,
91
+ 30 ,
92
+ { align : "center" , url : "https://www.google.com" }
93
+ ) ;
94
+ doc . textWithLink (
95
+ "Justify aligned Link" ,
96
+ doc . internal . pageSize . getWidth ( ) / 2 ,
97
+ 50 ,
98
+ { align : "justify" , url : "https://www.google.com" }
99
+ ) ;
100
+ doc . textWithLink (
101
+ "Right aligned Link" ,
102
+ doc . internal . pageSize . getWidth ( ) / 2 ,
103
+ 70 ,
104
+ { align : "right" , url : "https://www.google.com" }
105
+ ) ;
106
+
107
+ comparePdf ( doc . output ( ) , "textLinkWithAlignOptions.pdf" , "annotations" ) ;
108
+ } ) ;
75
109
} ) ;
0 commit comments