1 | <?php |
||
18 | final class DocumentInformation |
||
19 | { |
||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | private $data = ['Producer' => 'BaconPdf']; |
||
24 | |||
25 | /** |
||
26 | * Sets an entry in the information dictionary. |
||
27 | * |
||
28 | * The CreationData and ModDate values are restricted for internal use, so trying to set them will trigger an |
||
29 | * exception. Setting the "Trapped" value is allowed, but it must be one of the values "True", "False" or "Unknown". |
||
30 | * You can set any key in here, but the following are the standard keys recognized by the PDF standard. Keep in mind |
||
31 | * that the keys are case-sensitive: |
||
32 | * |
||
33 | * Title, Author, Subject, Keywords, Creator, Producer and Trapped. |
||
34 | * |
||
35 | * @param string $key |
||
36 | * @param string $value |
||
37 | * @throws DomainException |
||
38 | */ |
||
39 | public function set($key, $value) |
||
56 | |||
57 | /** |
||
58 | * Removes an entry from the information dictionary. |
||
59 | * |
||
60 | * @param string $key |
||
61 | */ |
||
62 | public function remove($key) |
||
66 | |||
67 | /** |
||
68 | * Checks whether an entry exists in the information dictionary. |
||
69 | * |
||
70 | * @param string $key |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function has($key) |
||
77 | |||
78 | /** |
||
79 | * Retrieves the value for a specific entry in the information dictionary. |
||
80 | * |
||
81 | * You may retrieve any entry from the information dictionary through this method, except for "CreationData" and |
||
82 | * "ModDate". Those two entries have their own respective methods to be retrieved. |
||
83 | * |
||
84 | * @param string $key |
||
85 | * @return string |
||
86 | * @throws DomainException |
||
87 | * @throws OutOfBoundsException |
||
88 | */ |
||
89 | public function get($key) |
||
101 | |||
102 | /** |
||
103 | * @return DateTimeImmutable |
||
104 | */ |
||
105 | public function getCreationDate() |
||
109 | |||
110 | /** |
||
111 | * @return DateTimeImmutable |
||
112 | */ |
||
113 | public function getModificationDate() |
||
117 | |||
118 | /** |
||
119 | * Writes the info dictionary. |
||
120 | * |
||
121 | * @param ObjectWriter $objectWriter |
||
122 | * @internal |
||
123 | */ |
||
124 | public function writeInfoDictionary(ObjectWriter $objectWriter) |
||
148 | |||
149 | /** |
||
150 | * @param string $key |
||
151 | * @return DateTimeImmutable |
||
152 | * @throws OutOfBoundsException |
||
153 | */ |
||
154 | private function retrieveDate($key) |
||
162 | } |
||
163 |