Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
RichMediaExecuteAction
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
5
100.00% covered (success)
100.00%
1 / 1
 getActionType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Action;
6
7use Phpdftk\Pdf\Core\PdfDictionary;
8use Phpdftk\Pdf\Core\PdfReference;
9use Phpdftk\Pdf\Core\PdfVersion;
10use Phpdftk\Pdf\Core\RequiresPdfVersion;
11
12/**
13 * Rich-media execute action (/S /RichMediaExecute) — ISO 32000-2 §13.6.9.
14 * Invokes a command on a rich-media annotation's embedded content.
15 */
16#[RequiresPdfVersion(PdfVersion::V2_0)]
17class RichMediaExecuteAction extends Action
18{
19    public ?PdfReference $ta = null;           // /TA target annotation
20    public ?PdfReference $ti = null;           // /TI target instance
21    public ?PdfDictionary $cmd = null;         // /CMD command dict
22
23    public function getActionType(): string
24    {
25        return 'RichMediaExecute';
26    }
27
28    public function toPdf(): string
29    {
30        $dict = $this->baseDictionary();
31        if ($this->ta !== null) {
32            $dict->set('TA', $this->ta);
33        }
34        if ($this->ti !== null) {
35            $dict->set('TI', $this->ti);
36        }
37        if ($this->cmd !== null) {
38            $dict->set('CMD', $this->cmd);
39        }
40        return $dict->toPdf();
41    }
42}