Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| FileAttachmentAnnotation | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
| getSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Annotation; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfName; |
| 8 | use Phpdftk\Pdf\Core\PdfReference; |
| 9 | use Phpdftk\Pdf\Core\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | |
| 12 | /** |
| 13 | * FileAttachment annotation (/Subtype /FileAttachment). |
| 14 | */ |
| 15 | #[RequiresPdfVersion(PdfVersion::V1_3)] |
| 16 | class FileAttachmentAnnotation extends MarkupAnnotation |
| 17 | { |
| 18 | public ?PdfReference $fs = null; // /FS - file specification |
| 19 | public ?PdfName $name = null; // /Name - icon name |
| 20 | |
| 21 | public function getSubtype(): string |
| 22 | { |
| 23 | return 'FileAttachment'; |
| 24 | } |
| 25 | |
| 26 | public function toPdf(): string |
| 27 | { |
| 28 | $dict = $this->buildDictionary(); |
| 29 | |
| 30 | if ($this->fs !== null) { |
| 31 | $dict->set('FS', $this->fs); |
| 32 | } |
| 33 | if ($this->name !== null) { |
| 34 | $dict->set('Name', $this->name); |
| 35 | } |
| 36 | |
| 37 | return $dict->toPdf(); |
| 38 | } |
| 39 | } |