Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MarkInfo | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
| toPdf | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Document; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfBoolean; |
| 8 | use Phpdftk\Pdf\Core\PdfDictionary; |
| 9 | use Phpdftk\Pdf\Core\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | use Phpdftk\Pdf\Core\Serializable; |
| 12 | |
| 13 | /** |
| 14 | * PDF MarkInfo dictionary. |
| 15 | * |
| 16 | * Indicates whether and how the document is structured for accessibility. |
| 17 | * Assigned to /MarkInfo in the document Catalog. |
| 18 | * |
| 19 | * Example: |
| 20 | * $markInfo = new MarkInfo(); |
| 21 | * $markInfo->marked = true; |
| 22 | * $catalog->markInfo = $markInfo; |
| 23 | */ |
| 24 | class MarkInfo implements Serializable |
| 25 | { |
| 26 | public ?bool $marked = null; // /Marked - document contains marked content |
| 27 | #[RequiresPdfVersion(PdfVersion::V1_6)] |
| 28 | public ?bool $userProperties = null; // /UserProperties - user properties attached to marked content (PDF 1.6+) |
| 29 | #[RequiresPdfVersion(PdfVersion::V1_6)] |
| 30 | public ?bool $suspects = null; // /Suspects - structure may contain suspects (PDF 1.6+) |
| 31 | |
| 32 | public function toPdf(): string |
| 33 | { |
| 34 | $dict = new PdfDictionary(); |
| 35 | |
| 36 | if ($this->marked !== null) { |
| 37 | $dict->set('Marked', new PdfBoolean($this->marked)); |
| 38 | } |
| 39 | if ($this->userProperties !== null) { |
| 40 | $dict->set('UserProperties', new PdfBoolean($this->userProperties)); |
| 41 | } |
| 42 | if ($this->suspects !== null) { |
| 43 | $dict->set('Suspects', new PdfBoolean($this->suspects)); |
| 44 | } |
| 45 | |
| 46 | return $dict->toPdf(); |
| 47 | } |
| 48 | } |