Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UR3TransformParams | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
9 | |
100.00% |
1 / 1 |
| toPdf | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
9 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Interactive\Signature; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfArray; |
| 8 | use Phpdftk\Pdf\Core\PdfName; |
| 9 | use Phpdftk\Pdf\Core\PdfString; |
| 10 | use Phpdftk\Pdf\Core\PdfVersion; |
| 11 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 12 | |
| 13 | /** |
| 14 | * UR3 (usage rights) transform parameters — ISO 32000-2 §12.8.2.3, Table 256. |
| 15 | * |
| 16 | * Enables specific reader features (form filling, commenting, etc.) via |
| 17 | * per-right name arrays. |
| 18 | */ |
| 19 | #[RequiresPdfVersion(PdfVersion::V2_0)] |
| 20 | class UR3TransformParams extends TransformParams |
| 21 | { |
| 22 | public ?PdfArray $document = null; // /Document rights: FullSave |
| 23 | public ?PdfString $msg = null; // /Msg warning shown to user |
| 24 | public ?PdfName $v = null; // /V |
| 25 | public ?PdfArray $annots = null; // /Annots rights |
| 26 | public ?PdfArray $form = null; // /Form rights |
| 27 | public ?PdfArray $signature = null; // /Signature rights |
| 28 | public ?PdfArray $ef = null; // /EF rights |
| 29 | public ?PdfString $p = null; // /P usage-rights URL |
| 30 | |
| 31 | public function toPdf(): string |
| 32 | { |
| 33 | $dict = $this->baseDictionary(); |
| 34 | if ($this->document !== null) { |
| 35 | $dict->set('Document', $this->document); |
| 36 | } |
| 37 | if ($this->msg !== null) { |
| 38 | $dict->set('Msg', $this->msg); |
| 39 | } |
| 40 | if ($this->v !== null) { |
| 41 | $dict->set('V', $this->v); |
| 42 | } |
| 43 | if ($this->annots !== null) { |
| 44 | $dict->set('Annots', $this->annots); |
| 45 | } |
| 46 | if ($this->form !== null) { |
| 47 | $dict->set('Form', $this->form); |
| 48 | } |
| 49 | if ($this->signature !== null) { |
| 50 | $dict->set('Signature', $this->signature); |
| 51 | } |
| 52 | if ($this->ef !== null) { |
| 53 | $dict->set('EF', $this->ef); |
| 54 | } |
| 55 | if ($this->p !== null) { |
| 56 | $dict->set('P', $this->p); |
| 57 | } |
| 58 | return $dict->toPdf(); |
| 59 | } |
| 60 | } |