@@ -41,91 +41,89 @@ describe("Module: putTotalPages", () => {
41
41
42
42
comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
43
43
} ) ;
44
- } ) ;
45
-
46
- it ( "customfont with encoding without passing fontWeight" , ( ) => {
47
- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
48
- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
49
- var totalPagesExp = "{totalPages}" ;
50
44
51
- doc . addFileToVFS ( "PTSans.ttf ", PTSans ) ;
52
- doc . addFont ( "PTSans.ttf" , " PTSans" , "normal" , "Identity-H ") ;
53
-
54
- doc . setFont ( "PTSans" ) ;
45
+ it ( "customfont with encoding without passing fontWeight ", ( ) => {
46
+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf ") ;
47
+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
48
+ var totalPagesExp = "{totalPages}" ;
55
49
56
- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
57
- doc . addPage ( ) ;
50
+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
51
+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , "Identity-H" ) ;
58
52
59
- doc . text ( 10 , 10 , "Page 2 of {totalPages} ") ;
53
+ doc . setFont ( "PTSans ") ;
60
54
61
- if ( typeof doc . putTotalPages === "function" ) {
62
- doc . putTotalPages ( totalPagesExp ) ;
63
- }
55
+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
56
+ doc . addPage ( ) ;
64
57
65
- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
66
- } ) ;
58
+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
67
59
60
+ if ( typeof doc . putTotalPages === "function" ) {
61
+ doc . putTotalPages ( totalPagesExp ) ;
62
+ }
68
63
69
- it ( "customfont check without passing fontweight in setfont" , ( ) => {
70
- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
71
- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
72
- var totalPagesExp = "{totalPages}" ;
64
+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
65
+ } ) ;
73
66
74
- doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
75
- doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" ) ;
67
+ it ( "customfont check without passing fontweight in setfont" , ( ) => {
68
+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
69
+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
70
+ var totalPagesExp = "{totalPages}" ;
76
71
77
- doc . setFont ( "PTSans" , 'normal' ) ;
72
+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
73
+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" ) ;
78
74
79
- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
80
- doc . addPage ( ) ;
75
+ doc . setFont ( "PTSans" , "normal" ) ;
81
76
82
- doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
77
+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
78
+ doc . addPage ( ) ;
83
79
84
- if ( typeof doc . putTotalPages === "function" ) {
85
- doc . putTotalPages ( totalPagesExp ) ;
86
- }
87
- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
88
- } ) ;
80
+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
89
81
82
+ if ( typeof doc . putTotalPages === "function" ) {
83
+ doc . putTotalPages ( totalPagesExp ) ;
84
+ }
85
+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
86
+ } ) ;
90
87
91
- it ( "customfont with fontweight" , ( ) => {
92
- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
93
- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
94
- var totalPagesExp = "{totalPages}" ;
88
+ it ( "customfont with fontweight" , ( ) => {
89
+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
90
+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
91
+ var totalPagesExp = "{totalPages}" ;
95
92
96
- doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
97
- doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , 200 , "Identity-H" ) ;
93
+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
94
+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , 200 , "Identity-H" ) ;
98
95
99
- doc . setFont ( "PTSans" , ' normal' , 200 ) ;
96
+ doc . setFont ( "PTSans" , " normal" , 200 ) ;
100
97
101
- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
102
- doc . addPage ( ) ;
98
+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
99
+ doc . addPage ( ) ;
103
100
104
- doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
101
+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
105
102
106
- if ( typeof doc . putTotalPages === "function" ) {
107
- doc . putTotalPages ( totalPagesExp ) ;
108
- }
109
- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
110
- } ) ;
103
+ if ( typeof doc . putTotalPages === "function" ) {
104
+ doc . putTotalPages ( totalPagesExp ) ;
105
+ }
106
+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
107
+ } ) ;
111
108
112
- it ( "customfont with samevalue in fontweight and fontstyle " , ( ) => {
113
- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
114
- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
115
- var totalPagesExp = "{totalPages}" ;
109
+ it ( "customfont with samevalue in fontweight and fontstyle " , ( ) => {
110
+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
111
+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
112
+ var totalPagesExp = "{totalPages}" ;
116
113
117
- doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
118
- doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , "normal" , "Identity-H" ) ;
114
+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
115
+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , "normal" , "Identity-H" ) ;
119
116
120
- doc . setFont ( "PTSans" , ' normal' , "normal" ) ;
117
+ doc . setFont ( "PTSans" , " normal" , "normal" ) ;
121
118
122
- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
123
- doc . addPage ( ) ;
119
+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
120
+ doc . addPage ( ) ;
124
121
125
- doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
122
+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
126
123
127
- if ( typeof doc . putTotalPages === "function" ) {
128
- doc . putTotalPages ( totalPagesExp ) ;
129
- }
130
- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
124
+ if ( typeof doc . putTotalPages === "function" ) {
125
+ doc . putTotalPages ( totalPagesExp ) ;
126
+ }
127
+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
128
+ } ) ;
131
129
} ) ;
0 commit comments