@@ -90,10 +90,10 @@ This is a bonus feature that is not available from `pdftk`.
90
90
use mikehaertl\pdftk\XfdfFile;
91
91
use mikehaertl\pdftk\FdfFile;
92
92
93
- $xfdf = new XfdfFile(['name'=> 'Jürgen мирано']);
93
+ $xfdf = new XfdfFile(['name' => 'Jürgen мирано']);
94
94
$xfdf->saveAs('/path/to/data.xfdf');
95
95
96
- $fdf = new FdfFile(['name'=> 'Jürgen мирано']);
96
+ $fdf = new FdfFile(['name' => 'Jürgen мирано']);
97
97
$fdf->saveAs('/path/to/data.fdf');
98
98
```
99
99
@@ -243,7 +243,7 @@ $pdf->cat(1, 5)
243
243
244
244
// We now use the above PDF as source file for a new PDF
245
245
$pdf2 = new Pdf($pdf);
246
- $pdf2->fillForm(['name'=> 'ÄÜÖ äüö мирано čárka'])
246
+ $pdf2->fillForm(['name' => 'ÄÜÖ äüö мирано čárka'])
247
247
->needAppearances()
248
248
->saveAs('/path/filled.pdf');
249
249
```
@@ -272,7 +272,7 @@ $pdf->allow('AllFeatures') // Change permissions
272
272
// Example: Fill PDF form and merge form data into PDF
273
273
// Fill form with data array
274
274
$pdf = new Pdf('/path/form.pdf');
275
- $pdf->fillForm(['name'=> 'My Name'])
275
+ $pdf->fillForm(['name' => 'My Name'])
276
276
->flatten()
277
277
->saveAs('/path/filled.pdf');
278
278
@@ -282,7 +282,7 @@ $pdf->addPage('/path/my.pdf', null, 'some**password')
282
282
->saveAs('/path/new.pdf');
283
283
```
284
284
285
- ### Execution
285
+ ### Shell Command
286
286
287
287
The class uses [ php-shellcommand] ( https://github.com/mikehaertl/php-shellcommand ) to execute
288
288
` pdftk ` . You can pass ` $options ` for its ` Command ` class as second argument to the constructor:
@@ -298,6 +298,21 @@ $pdf = new Pdf('/path/my.pdf', [
298
298
]);
299
299
```
300
300
301
+ ### Temporary File
302
+
303
+ Internally a temporary file is created via [ php-tmpfile] ( https://github.com/mikehaertl/php-tmpfile ) .
304
+ You can also access that file directly, e.g. if you neither want to send or save the
305
+ file but only need the binary PDF content:
306
+
307
+ ``` php
308
+ use mikehaertl\pdftk\Pdf;
309
+
310
+ $pdf = new Pdf('/path/my.pdf');
311
+ $pdf->fillForm(['name' => 'My Name'])
312
+ ->execute();
313
+ $content = file_get_contents( (string) $pdf->getTmpFile() );
314
+ ```
315
+
301
316
## API
302
317
303
318
Please consult the source files for a full documentation of each method.
0 commit comments