Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ImportDataAction | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getActionType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Action; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\FileSpec\FileSpec; |
| 8 | use Phpdftk\Pdf\Core\PdfReference; |
| 9 | use Phpdftk\Pdf\Core\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | |
| 12 | /** |
| 13 | * Import-data action (/S /ImportData) — ISO 32000-2 §12.7.5.4. |
| 14 | * Imports FDF data from a file into form fields. |
| 15 | */ |
| 16 | #[RequiresPdfVersion(PdfVersion::V1_2)] |
| 17 | class ImportDataAction extends Action |
| 18 | { |
| 19 | public FileSpec|PdfReference $f; // /F required |
| 20 | |
| 21 | public function __construct(FileSpec|PdfReference $f) |
| 22 | { |
| 23 | $this->f = $f; |
| 24 | } |
| 25 | |
| 26 | public function getActionType(): string |
| 27 | { |
| 28 | return 'ImportData'; |
| 29 | } |
| 30 | |
| 31 | public function toPdf(): string |
| 32 | { |
| 33 | $dict = $this->baseDictionary(); |
| 34 | $dict->set('F', $this->f); |
| 35 | return $dict->toPdf(); |
| 36 | } |
| 37 | } |