@@ -28,7 +28,7 @@ public function testCanPassDocumentToConstructor()
28
28
$ this ->assertFileExists ($ file );
29
29
30
30
$ tmpFile = (string ) $ pdf ->getTmpFile ();
31
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
31
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
32
32
}
33
33
public function testCanPassPdfInstanceToConstructor ()
34
34
{
@@ -48,7 +48,7 @@ public function testCanPassPdfInstanceToConstructor()
48
48
$ this ->assertFileExists ($ file );
49
49
50
50
$ tmpFile = (string ) $ pdf2 ->getTmpFile ();
51
- $ this ->assertEquals ("pdftk A =' $ outFile1' output ' $ tmpFile' " , (string ) $ pdf2 ->getCommand ());
51
+ $ this ->assertEquals ("pdftk 'A' =' $ outFile1' ' output' ' $ tmpFile' " , (string ) $ pdf2 ->getCommand ());
52
52
}
53
53
public function testCanPassDocumentsToConstructor ()
54
54
{
@@ -64,7 +64,7 @@ public function testCanPassDocumentsToConstructor()
64
64
$ this ->assertFileExists ($ file );
65
65
66
66
$ tmpFile = (string ) $ pdf ->getTmpFile ();
67
- $ this ->assertEquals ("pdftk A =' $ document1' B =' $ document2' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
67
+ $ this ->assertEquals ("pdftk 'A' =' $ document1' 'B' =' $ document2' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
68
68
}
69
69
public function testCanPassPdfInstancesToConstructor ()
70
70
{
@@ -94,7 +94,7 @@ public function testCanPassPdfInstancesToConstructor()
94
94
$ this ->assertFileExists ($ file );
95
95
96
96
$ tmpFile = (string ) $ pdf ->getTmpFile ();
97
- $ this ->assertEquals ("pdftk A =' $ outFile1' B =' $ outFile2' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
97
+ $ this ->assertEquals ("pdftk 'A' =' $ outFile1' 'B' =' $ outFile2' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
98
98
}
99
99
public function testCanPassDocumentsWithPasswordToConstructor ()
100
100
{
@@ -111,7 +111,7 @@ public function testCanPassDocumentsWithPasswordToConstructor()
111
111
112
112
$ tmpFile = (string ) $ pdf ->getTmpFile ();
113
113
$ this ->assertEquals (
114
- "pdftk A =' $ document1' B =' $ document2' input_pw A ='complex'\'' \"password' output ' $ tmpFile' " ,
114
+ "pdftk 'A' =' $ document1' 'B' =' $ document2' ' input_pw' 'A' ='complex'\'' \"password' ' output' ' $ tmpFile' " ,
115
115
(string ) $ pdf ->getCommand ()
116
116
);
117
117
}
@@ -129,7 +129,7 @@ public function testCanAddFiles()
129
129
130
130
$ tmpFile = (string ) $ pdf ->getTmpFile ();
131
131
$ this ->assertEquals (
132
- "pdftk A =' $ document1' D =' $ document2' input_pw A ='complex'\'' \"password' output ' $ tmpFile' " ,
132
+ "pdftk 'A' =' $ document1' 'D' =' $ document2' ' input_pw' 'A' ='complex'\'' \"password' ' output' ' $ tmpFile' " ,
133
133
(string ) $ pdf ->getCommand ()
134
134
);
135
135
}
@@ -146,7 +146,7 @@ public function testCanPerformEmptyOperation()
146
146
147
147
$ tmpFile = (string ) $ pdf ->getTmpFile ();
148
148
$ this ->assertEquals (
149
- "pdftk A =' $ document1' input_pw A ='complex'\'' \"password' output ' $ tmpFile' " ,
149
+ "pdftk 'A' =' $ document1' ' input_pw' 'A' ='complex'\'' \"password' ' output' ' $ tmpFile' " ,
150
150
(string ) $ pdf ->getCommand ()
151
151
);
152
152
}
@@ -168,7 +168,7 @@ public function testCanCatFile()
168
168
169
169
$ tmpFile = (string ) $ pdf ->getTmpFile ();
170
170
$ this ->assertEquals (
171
- "pdftk A =' $ document' cat 1-5 2 3 4 end-2even 3-5east 4-8eveneast 1south output ' $ tmpFile' " ,
171
+ "pdftk 'A' =' $ document' cat 1-5 2 3 4 end-2even 3-5east 4-8eveneast 1south ' output' ' $ tmpFile' " ,
172
172
(string ) $ pdf ->getCommand ()
173
173
);
174
174
}
@@ -194,7 +194,7 @@ public function testCanCatFiles()
194
194
195
195
$ tmpFile = (string ) $ pdf ->getTmpFile ();
196
196
$ this ->assertEquals (
197
- "pdftk A =' $ document1' B =' $ document2' cat A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south output ' $ tmpFile' " ,
197
+ "pdftk 'A' =' $ document1' 'B' =' $ document2' cat A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south ' output' ' $ tmpFile' " ,
198
198
(string ) $ pdf ->getCommand ()
199
199
);
200
200
}
@@ -220,7 +220,7 @@ public function testCanShuffleFiles()
220
220
221
221
$ tmpFile = (string ) $ pdf ->getTmpFile ();
222
222
$ this ->assertEquals (
223
- "pdftk A =' $ document1' B =' $ document2' shuffle A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south output ' $ tmpFile' " ,
223
+ "pdftk 'A' =' $ document1' 'B' =' $ document2' shuffle A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south ' output' ' $ tmpFile' " ,
224
224
(string ) $ pdf ->getCommand ()
225
225
);
226
226
}
@@ -290,7 +290,7 @@ public function testCanFillFormFromData()
290
290
291
291
$ tmpFile = (string ) $ pdf ->getTmpFile ();
292
292
$ this ->assertRegExp (
293
- "#pdftk A =' $ form' fill_form '/tmp/[^ ]+\.xfdf' output ' $ tmpFile' drop_xfa need_appearances# " ,
293
+ "#pdftk 'A' =' $ form' ' fill_form' '/tmp/[^ ]+\.xfdf' ' output' ' $ tmpFile' ' drop_xfa' ' need_appearances' # " ,
294
294
(string ) $ pdf ->getCommand ()
295
295
);
296
296
}
@@ -310,7 +310,7 @@ public function testCanFillFormFromFile()
310
310
311
311
$ tmpFile = (string ) $ pdf ->getTmpFile ();
312
312
$ this ->assertRegExp (
313
- "#pdftk A =' $ form' fill_form ' $ fdf' output ' $ tmpFile' drop_xfa need_appearances# " ,
313
+ "#pdftk 'A' =' $ form' ' fill_form' ' $ fdf' ' output' ' $ tmpFile' ' drop_xfa' ' need_appearances' # " ,
314
314
(string ) $ pdf ->getCommand ()
315
315
);
316
316
}
@@ -319,15 +319,15 @@ public function testCanUpdateInfo()
319
319
{
320
320
$ document1 = $ this ->getDocument1 ();
321
321
$ file = $ this ->getOutFile ();
322
-
322
+
323
323
$ pdf = new Pdf ($ document1 );
324
324
$ this ->assertInstanceOf ('mikehaertl\pdftk\Pdf ' , $ pdf ->updateInfo ([
325
325
'Creator ' => 'php-pdftk '
326
326
]));
327
327
$ this ->assertTrue ($ pdf ->saveAs ($ file ));
328
-
328
+
329
329
$ this ->assertFileExists ($ file );
330
-
330
+
331
331
$ tmpFile = (string ) $ pdf ->getTmpFile ();
332
332
$ pdf = new Pdf ($ file );
333
333
$ data = $ pdf ->getData ();
@@ -346,7 +346,7 @@ public function testCanSetBackground()
346
346
$ this ->assertFileExists ($ file );
347
347
348
348
$ tmpFile = (string ) $ pdf ->getTmpFile ();
349
- $ this ->assertEquals ("pdftk A =' $ document1' background ' $ document2' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
349
+ $ this ->assertEquals ("pdftk 'A' =' $ document1' ' background' ' $ document2' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
350
350
}
351
351
352
352
public function testCanSetMultiBackground ()
@@ -361,7 +361,7 @@ public function testCanSetMultiBackground()
361
361
$ this ->assertFileExists ($ file );
362
362
363
363
$ tmpFile = (string ) $ pdf ->getTmpFile ();
364
- $ this ->assertEquals ("pdftk A =' $ document1' multibackground ' $ document2' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
364
+ $ this ->assertEquals ("pdftk 'A' =' $ document1' ' multibackground' ' $ document2' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
365
365
}
366
366
367
367
public function testCanStamp ()
@@ -376,7 +376,7 @@ public function testCanStamp()
376
376
$ this ->assertFileExists ($ file );
377
377
378
378
$ tmpFile = (string ) $ pdf ->getTmpFile ();
379
- $ this ->assertEquals ("pdftk A =' $ document1' stamp ' $ document2' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
379
+ $ this ->assertEquals ("pdftk 'A' =' $ document1' ' stamp' ' $ document2' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
380
380
}
381
381
382
382
public function testCanMultiStamp ()
@@ -391,7 +391,7 @@ public function testCanMultiStamp()
391
391
$ this ->assertFileExists ($ file );
392
392
393
393
$ tmpFile = (string ) $ pdf ->getTmpFile ();
394
- $ this ->assertEquals ("pdftk A =' $ document1' multistamp ' $ document2' output ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
394
+ $ this ->assertEquals ("pdftk 'A' =' $ document1' ' multistamp' ' $ document2' ' output' ' $ tmpFile' " , (string ) $ pdf ->getCommand ());
395
395
}
396
396
397
397
public function testCanRemovePermissions ()
@@ -405,7 +405,7 @@ public function testCanRemovePermissions()
405
405
$ this ->assertFileExists ($ file );
406
406
407
407
$ tmpFile = (string ) $ pdf ->getTmpFile ();
408
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' allow " , (string ) $ pdf ->getCommand ());
408
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' allow' " , (string ) $ pdf ->getCommand ());
409
409
}
410
410
411
411
public function testCanSetPermissions ()
@@ -419,7 +419,7 @@ public function testCanSetPermissions()
419
419
$ this ->assertFileExists ($ file );
420
420
421
421
$ tmpFile = (string ) $ pdf ->getTmpFile ();
422
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' allow Assembly CopyContents " , (string ) $ pdf ->getCommand ());
422
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' allow Assembly CopyContents " , (string ) $ pdf ->getCommand ());
423
423
}
424
424
425
425
public function testCanFlatten ()
@@ -433,7 +433,7 @@ public function testCanFlatten()
433
433
$ this ->assertFileExists ($ file );
434
434
435
435
$ tmpFile = (string ) $ pdf ->getTmpFile ();
436
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' flatten " , (string ) $ pdf ->getCommand ());
436
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' flatten' " , (string ) $ pdf ->getCommand ());
437
437
}
438
438
439
439
public function testCanCompress ()
@@ -447,7 +447,7 @@ public function testCanCompress()
447
447
$ this ->assertFileExists ($ file );
448
448
449
449
$ tmpFile = (string ) $ pdf ->getTmpFile ();
450
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' compress " , (string ) $ pdf ->getCommand ());
450
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' compress' " , (string ) $ pdf ->getCommand ());
451
451
}
452
452
453
453
public function testCanUncompress ()
@@ -461,7 +461,7 @@ public function testCanUncompress()
461
461
$ this ->assertFileExists ($ file );
462
462
463
463
$ tmpFile = (string ) $ pdf ->getTmpFile ();
464
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' uncompress " , (string ) $ pdf ->getCommand ());
464
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' uncompress' " , (string ) $ pdf ->getCommand ());
465
465
}
466
466
467
467
public function testCanKeepFirstId ()
@@ -475,7 +475,7 @@ public function testCanKeepFirstId()
475
475
$ this ->assertFileExists ($ file );
476
476
477
477
$ tmpFile = (string ) $ pdf ->getTmpFile ();
478
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' keep_first_id " , (string ) $ pdf ->getCommand ());
478
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' keep_first_id' " , (string ) $ pdf ->getCommand ());
479
479
}
480
480
481
481
public function testCanKeepFinalId ()
@@ -489,7 +489,7 @@ public function testCanKeepFinalId()
489
489
$ this ->assertFileExists ($ file );
490
490
491
491
$ tmpFile = (string ) $ pdf ->getTmpFile ();
492
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' keep_final_id " , (string ) $ pdf ->getCommand ());
492
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' keep_final_id' " , (string ) $ pdf ->getCommand ());
493
493
}
494
494
495
495
public function testCanDropXfa ()
@@ -503,7 +503,7 @@ public function testCanDropXfa()
503
503
$ this ->assertFileExists ($ file );
504
504
505
505
$ tmpFile = (string ) $ pdf ->getTmpFile ();
506
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' drop_xfa " , (string ) $ pdf ->getCommand ());
506
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' drop_xfa' " , (string ) $ pdf ->getCommand ());
507
507
}
508
508
509
509
public function testCanSetPasswords ()
@@ -518,7 +518,7 @@ public function testCanSetPasswords()
518
518
$ this ->assertFileExists ($ file );
519
519
520
520
$ tmpFile = (string ) $ pdf ->getTmpFile ();
521
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' owner_pw ' \"'\''**' user_pw '** \"'\''' " , (string ) $ pdf ->getCommand ());
521
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' owner_pw' ' \"'\''**' ' user_pw' '** \"'\''' " , (string ) $ pdf ->getCommand ());
522
522
}
523
523
524
524
public function testSet128BitEncryption ()
@@ -532,7 +532,7 @@ public function testSet128BitEncryption()
532
532
$ this ->assertFileExists ($ file );
533
533
534
534
$ tmpFile = (string ) $ pdf ->getTmpFile ();
535
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' encrypt_128bit " , (string ) $ pdf ->getCommand ());
535
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' encrypt_128bit' " , (string ) $ pdf ->getCommand ());
536
536
}
537
537
538
538
public function testSet40BitEncryption ()
@@ -546,7 +546,7 @@ public function testSet40BitEncryption()
546
546
$ this ->assertFileExists ($ file );
547
547
548
548
$ tmpFile = (string ) $ pdf ->getTmpFile ();
549
- $ this ->assertEquals ("pdftk A =' $ document' output ' $ tmpFile' encrypt_40bit " , (string ) $ pdf ->getCommand ());
549
+ $ this ->assertEquals ("pdftk 'A' =' $ document' ' output' ' $ tmpFile' ' encrypt_40bit' " , (string ) $ pdf ->getCommand ());
550
550
}
551
551
552
552
@@ -656,7 +656,7 @@ protected function getOutFile()
656
656
PageMediaRect: 0 0 595 842
657
657
PageMediaDimensions: 595 842
658
658
EOD ;
659
-
659
+
660
660
protected $ formDataArray = array (
661
661
"Info " => array (
662
662
"CreationDate " => "D:20140709121536+02'00' " ,
@@ -698,7 +698,7 @@ protected function getOutFile()
698
698
"Dimensions " => "595 842 "
699
699
),
700
700
)
701
-
701
+
702
702
);
703
703
704
704
protected $ formDataFields = <<<EOD
0 commit comments