Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| PopupAnnotation | |
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\PdfBoolean; |
| 8 | use Phpdftk\Pdf\Core\PdfReference; |
| 9 | use Phpdftk\Pdf\Core\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | |
| 12 | /** |
| 13 | * Popup annotation (/Subtype /Popup). |
| 14 | * Displays the pop-up window for a parent annotation's text. |
| 15 | */ |
| 16 | #[RequiresPdfVersion(PdfVersion::V1_3)] |
| 17 | class PopupAnnotation extends Annotation |
| 18 | { |
| 19 | public ?PdfReference $parent = null; // /Parent |
| 20 | public ?bool $open = null; // /Open |
| 21 | |
| 22 | public function getSubtype(): string |
| 23 | { |
| 24 | return 'Popup'; |
| 25 | } |
| 26 | |
| 27 | public function toPdf(): string |
| 28 | { |
| 29 | $dict = $this->buildDictionary(); |
| 30 | |
| 31 | if ($this->parent !== null) { |
| 32 | $dict->set('Parent', $this->parent); |
| 33 | } |
| 34 | if ($this->open !== null) { |
| 35 | $dict->set('Open', new PdfBoolean($this->open)); |
| 36 | } |
| 37 | |
| 38 | return $dict->toPdf(); |
| 39 | } |
| 40 | } |