Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| DocMDPTransformParams | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Interactive\Signature; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfName; |
| 8 | use Phpdftk\Pdf\Core\PdfNumber; |
| 9 | use Phpdftk\Pdf\Core\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | |
| 12 | /** |
| 13 | * DocMDP transform parameters — ISO 32000-2 §12.8.2.2, Table 254. |
| 14 | * |
| 15 | * Used with a DocMDP (certification) signature to restrict subsequent |
| 16 | * modifications. /P controls what's allowed: |
| 17 | * 1 = no changes |
| 18 | * 2 = form filling, signing, comments allowed |
| 19 | * 3 = same as 2 plus form field creation/deletion |
| 20 | */ |
| 21 | #[RequiresPdfVersion(PdfVersion::V1_3)] |
| 22 | class DocMDPTransformParams extends TransformParams |
| 23 | { |
| 24 | public int $p = 2; // /P permissions (1, 2, 3) |
| 25 | public ?PdfName $v = null; // /V version (default 1.2) |
| 26 | |
| 27 | public function __construct(int $p = 2) |
| 28 | { |
| 29 | $this->p = $p; |
| 30 | } |
| 31 | |
| 32 | public function toPdf(): string |
| 33 | { |
| 34 | $dict = $this->baseDictionary(); |
| 35 | $dict->set('P', new PdfNumber($this->p)); |
| 36 | if ($this->v !== null) { |
| 37 | $dict->set('V', $this->v); |
| 38 | } |
| 39 | return $dict->toPdf(); |
| 40 | } |
| 41 | } |