Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| BorderEffect | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
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\PdfDictionary; |
| 8 | use Phpdftk\Pdf\Core\PdfName; |
| 9 | use Phpdftk\Pdf\Core\PdfNumber; |
| 10 | use Phpdftk\Pdf\Core\Serializable; |
| 11 | use Phpdftk\Pdf\Core\PdfVersion; |
| 12 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 13 | |
| 14 | /** |
| 15 | * PDF Border Effect dictionary (/BE). |
| 16 | * |
| 17 | * Describes a visual effect to apply to the border of an annotation |
| 18 | * (FreeText, Square, Circle, Polygon, PolyLine). |
| 19 | * |
| 20 | * Style (/S) values: |
| 21 | * S - No effect (default) |
| 22 | * C - Cloudy border |
| 23 | * |
| 24 | * Example: |
| 25 | * $be = new BorderEffect(); |
| 26 | * $be->s = new PdfName('C'); |
| 27 | * $be->i = new PdfNumber(2.0); |
| 28 | * $annotation->be = $be; |
| 29 | */ |
| 30 | #[RequiresPdfVersion(PdfVersion::V1_5)] |
| 31 | class BorderEffect implements Serializable |
| 32 | { |
| 33 | public ?PdfName $s = null; // /S - style: S (none) or C (cloudy) |
| 34 | public ?PdfNumber $i = null; // /I - cloud intensity, 0–2 (only meaningful when S=C) |
| 35 | |
| 36 | public function toPdf(): string |
| 37 | { |
| 38 | $dict = new PdfDictionary(); |
| 39 | |
| 40 | if ($this->s !== null) { |
| 41 | $dict->set('S', $this->s); |
| 42 | } |
| 43 | if ($this->i !== null) { |
| 44 | $dict->set('I', $this->i); |
| 45 | } |
| 46 | |
| 47 | return $dict->toPdf(); |
| 48 | } |
| 49 | } |