9
9
describe ( "Core: Standard Encryption" , ( ) => {
10
10
beforeAll ( loadGlobals ) ;
11
11
it ( "should allow text insertion" , ( ) => {
12
- const doc = jsPDF ( {
12
+ const doc = jsPDF ( {
13
13
floatPrecision : 2 ,
14
14
encryption : {
15
15
userPassword : "password"
16
16
}
17
17
} ) ;
18
18
doc . __private__ . setFileId ( "0000000000000000000000000BADFACE" ) ;
19
+ doc . __private__ . setCreationDate ( "D:19871210000000+00'00'" ) ;
19
20
doc . text ( 10 , 10 , "This is a test!" ) ;
20
21
comparePdf ( doc . output ( ) , "encrypted_standard.pdf" , "encryption" ) ;
21
- doc . internal . encryption = null ;
22
- doc . internal . encryptionOptions = null ;
23
22
} ) ;
24
23
it ( "should be printable" , ( ) => {
25
- const doc = jsPDF ( {
24
+ const doc = jsPDF ( {
26
25
floatPrecision : 2 ,
27
26
encryption : {
28
27
userPassword : "password" ,
29
28
userPermissions : [ "print" ]
30
29
}
31
30
} ) ;
32
31
doc . __private__ . setFileId ( "0000000000000000000000000BADFACE" ) ;
32
+ doc . __private__ . setCreationDate ( "D:19871210000000+00'00'" ) ;
33
33
doc . text ( 10 , 10 , "This is a test!" ) ;
34
34
comparePdf ( doc . output ( ) , "encrypted_printable.pdf" , "encryption" ) ;
35
- doc . internal . encryption = null ;
36
- doc . internal . encryptionOptions = null ;
37
35
} ) ;
38
36
it ( "should display forms properly" , ( ) => {
39
37
var doc = new jsPDF ( {
40
38
floatPrecision : 2 ,
41
39
encryption : { }
42
40
} ) ;
43
41
doc . __private__ . setFileId ( "0000000000000000000000000BADFACE" ) ;
42
+ doc . __private__ . setCreationDate ( "D:19871210000000+00'00'" ) ;
44
43
var {
45
44
ComboBox,
46
45
ListBox,
@@ -49,7 +48,7 @@ describe("Core: Standard Encryption", () => {
49
48
TextField,
50
49
PasswordField,
51
50
RadioButton,
52
- Appearance,
51
+ Appearance
53
52
} = jsPDF . AcroForm ;
54
53
55
54
doc . setFontSize ( 12 ) ;
@@ -112,14 +111,9 @@ describe("Core: Standard Encryption", () => {
112
111
var radioButton3 = radioGroup . createOption ( "Test3" ) ;
113
112
radioButton3 . Rect = [ 50 , 190 , 20 , 10 ] ;
114
113
radioGroup . setAppearance ( Appearance . RadioButton . Cross ) ;
115
-
116
- comparePdf (
117
- doc . output ( ) ,
118
- "encrypted_withAcroForm.pdf" ,
119
- "encryption"
120
- ) ;
121
114
122
- } )
115
+ comparePdf ( doc . output ( ) , "encrypted_withAcroForm.pdf" , "encryption" ) ;
116
+ } ) ;
123
117
it ( "colortype_3_indexed_single_colour_alpha_4_bit_png" , ( ) => {
124
118
var colortype_3_indexed_single_colour_alpha_4_bit_png =
125
119
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEX/////AAD/pQD//wAA/wAAgAAAgIAAAP+BAIC08EFzAAAAAXRSTlMAQObYZgAAAJtJREFUCB0BkABv/wAREQAAAAAAAAAiIhEQAAAAAAAzMyIhEAAAAABERDMyIQAAAABVVUQzIhAAAABmZlVEMyEAAAB3d2ZVQzIQAACIh3dlVDIhAAAACId2VUMhAAAAAAiHZUMyEAAAAACHdlQyEAAAAAAIdlQyEAAAAAAId2VDIQAAAAAAh2VDIQAAAAAAh2VDIQAAAAAAh2VDIWfgFTHZzlYNAAAAAElFTkSuQmCC" ;
@@ -134,6 +128,7 @@ describe("Core: Standard Encryption", () => {
134
128
}
135
129
} ) ;
136
130
doc . __private__ . setFileId ( "0000000000000000000000000BADFACE" ) ;
131
+ doc . __private__ . setCreationDate ( "D:19871210000000+00'00'" ) ;
137
132
doc . addImage (
138
133
colortype_3_indexed_single_colour_alpha_4_bit_png ,
139
134
"PNG" ,
@@ -144,12 +139,6 @@ describe("Core: Standard Encryption", () => {
144
139
undefined ,
145
140
undefined
146
141
) ;
147
- comparePdf (
148
- doc . output ( ) ,
149
- "encrypted_withImage.pdf" ,
150
- "encryption"
151
- ) ;
152
- doc . internal . encryption = null ;
153
- doc . internal . encryptionOptions = null ;
142
+ comparePdf ( doc . output ( ) , "encrypted_withImage.pdf" , "encryption" ) ;
154
143
} ) ;
155
144
} ) ;
0 commit comments