1 | <?php |
||
16 | trait InteractionTrait |
||
17 | { |
||
18 | /** |
||
19 | * Whether argument is set |
||
20 | * |
||
21 | * @param string $name |
||
22 | * |
||
23 | * @return bool |
||
24 | */ |
||
25 | abstract protected function hasArgument($name); |
||
26 | |||
27 | /** |
||
28 | * Get argument value |
||
29 | * |
||
30 | * @param string $name |
||
31 | * |
||
32 | * @return null|string |
||
33 | */ |
||
34 | abstract protected function getArgumentValue($name); |
||
35 | |||
36 | /** |
||
37 | * Set argument |
||
38 | * |
||
39 | * @param string $argument |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | abstract protected function setArgument($argument); |
||
44 | |||
45 | /** |
||
46 | * Whether BATCH flag is set |
||
47 | * |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function isBatch() |
||
54 | |||
55 | /** |
||
56 | * Set BATCH flag |
||
57 | * |
||
58 | * Causes Ghostscript to exit after processing all files named on the command line, rather than going into an |
||
59 | * interactive loop reading PostScript commands. Equivalent to putting -c quit at the end of the command line. |
||
60 | * |
||
61 | * @return $this |
||
62 | */ |
||
63 | public function setBatch() |
||
69 | |||
70 | /** |
||
71 | * Whether NOPAGEPROMPT flag is set |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function isNoPagePrompt() |
||
79 | |||
80 | /** |
||
81 | * Set NOPAGEPROMPT flag |
||
82 | * |
||
83 | * Disables only the prompt, but not the pause, at the end of each page. This may be useful on PC displays that get |
||
84 | * confused if a program attempts to write text to the console while the display is in a graphics mode. |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function setNoPagePrompt() |
||
94 | |||
95 | /** |
||
96 | * Whether NOPAUSE flag is set |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function isNoPause() |
||
104 | |||
105 | /** |
||
106 | * Set NOPAUSE flag |
||
107 | * |
||
108 | * Disables the prompt and pause at the end of each page. Normally one should use this (along with -dBATCH) when |
||
109 | * producing output on a printer or to a file; it also may be desirable for applications where another program is |
||
110 | * "driving" Ghostscript. |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | public function setNoPause() |
||
120 | |||
121 | /** |
||
122 | * Whether NOPROMPT flag is set |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function isNoPrompt() |
||
130 | |||
131 | /** |
||
132 | * Set NOPROMPT flag |
||
133 | * |
||
134 | * Disables the prompt printed by Ghostscript when it expects interactive input, as well as the end-of-page prompt |
||
135 | * (-dNOPAGEPROMPT). This allows piping input directly into Ghostscript, as long as the data doesn't refer to |
||
136 | * currentfile. |
||
137 | * |
||
138 | * @return $this |
||
139 | */ |
||
140 | public function setNoPrompt() |
||
146 | |||
147 | /** |
||
148 | * Whether QUIET flag is set |
||
149 | * |
||
150 | * @return bool |
||
151 | */ |
||
152 | public function isQuiet() |
||
156 | |||
157 | /** |
||
158 | * Set QUIET flag |
||
159 | * |
||
160 | * Suppresses routine information comments on standard output. This is currently necessary when redirecting device |
||
161 | * output to standard output. |
||
162 | * |
||
163 | * @return $this |
||
164 | */ |
||
165 | public function setQuiet() |
||
171 | |||
172 | /** |
||
173 | * Whether SHORTERRORS flag is set |
||
174 | * |
||
175 | * @return bool |
||
176 | */ |
||
177 | public function isShortErrors() |
||
181 | |||
182 | /** |
||
183 | * Set SHORTERRORS flag |
||
184 | * |
||
185 | * Makes certain error and information messages more Adobe-compatible. |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | public function setShortErrors() |
||
195 | |||
196 | /** |
||
197 | * Get value of stdout parameter if set |
||
198 | * |
||
199 | * @return string|null |
||
200 | */ |
||
201 | public function getStdout() |
||
205 | |||
206 | /** |
||
207 | * Set stdout parameter |
||
208 | * |
||
209 | * Redirect PostScript %stdout to a file or stderr, to avoid it being mixed with device stdout. To redirect stdout |
||
210 | * to stderr use -sstdout=%stderr. To cancel redirection of stdout use -sstdout=%stdout or -sstdout=-. |
||
211 | * |
||
212 | * Note that this redirects PostScript output to %stdout but does not change the destination FILE of device output |
||
213 | * as with -sOutputFile=- or even -sOutputFile=%stdout since devices write directly using the stdout FILE * pointer |
||
214 | * with C function calls such as fwrite or fputs. |
||
215 | * |
||
216 | * @param string $filename file to redirect PostScript %stdout to |
||
217 | * @return $this |
||
218 | */ |
||
219 | public function setStdout($filename) |
||
225 | |||
226 | /** |
||
227 | * Whether TTYPAUSE flag is set |
||
228 | * |
||
229 | * @return bool |
||
230 | */ |
||
231 | public function isTtyPause() |
||
235 | |||
236 | /** |
||
237 | * Set TTYPAUSE flag |
||
238 | * |
||
239 | * Causes Ghostscript to read a character from /dev/tty, rather than standard input, at the end of each page. This |
||
240 | * may be useful if input is coming from a pipe. Note that -dTTYPAUSE overrides -dNOPAUSE. Also note that -dTTYPAUSE |
||
241 | * requires opening the terminal device directly, and may cause problems in combination with -dSAFER. Permission |
||
242 | * errors can be avoided by adding the device to the permitted reading list before invoking safer mode. For example: |
||
243 | * gs -dTTYPAUSE -dDELAYSAFER -c '<< /PermitFileReading [ (/dev/tty)] >> setuserparams .locksafe' -dSAFER |
||
244 | * |
||
245 | * @return $this |
||
246 | */ |
||
247 | public function setTtyPause() |
||
253 | } |
||
254 |