diff options
Diffstat (limited to 'inc/3rdparty/libraries/mpdf/examples/example59_new_mPDF_v5-6_features.php')
-rw-r--r-- | inc/3rdparty/libraries/mpdf/examples/example59_new_mPDF_v5-6_features.php | 387 |
1 files changed, 387 insertions, 0 deletions
diff --git a/inc/3rdparty/libraries/mpdf/examples/example59_new_mPDF_v5-6_features.php b/inc/3rdparty/libraries/mpdf/examples/example59_new_mPDF_v5-6_features.php new file mode 100644 index 00000000..fc908d5e --- /dev/null +++ b/inc/3rdparty/libraries/mpdf/examples/example59_new_mPDF_v5-6_features.php | |||
@@ -0,0 +1,387 @@ | |||
1 | <?php | ||
2 | |||
3 | ini_set("memory_limit","64M"); | ||
4 | |||
5 | include("../mpdf.php"); | ||
6 | |||
7 | $mpdf=new mPDF(''); | ||
8 | |||
9 | |||
10 | //============================================================== | ||
11 | |||
12 | $html = ' | ||
13 | <style> | ||
14 | .gradient { | ||
15 | border:0.1mm solid #220044; | ||
16 | background-color: #f0f2ff; | ||
17 | background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; | ||
18 | box-shadow: 0.3em 0.3em #888888; | ||
19 | } | ||
20 | .rounded { | ||
21 | border:0.1mm solid #220044; | ||
22 | background-color: #f0f2ff; | ||
23 | background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; | ||
24 | border-radius: 2mm; | ||
25 | background-clip: border-box; | ||
26 | } | ||
27 | h4 { | ||
28 | font-weight: bold; | ||
29 | margin-top: 1em; | ||
30 | margin-bottom: 0.3em; | ||
31 | margin-top: 0; | ||
32 | } | ||
33 | div.text { | ||
34 | padding:0.8em; | ||
35 | margin-bottom: 0.7em; | ||
36 | } | ||
37 | p { margin: 0.25em 0; } | ||
38 | .code { | ||
39 | font-family: monospace; | ||
40 | font-size: 9pt; | ||
41 | background-color: #d5d5d5; | ||
42 | margin: 1em 1cm; | ||
43 | padding: 0 0.3cm; | ||
44 | border:0.2mm solid #000088; | ||
45 | box-shadow: 0.3em 0.3em #888888; | ||
46 | } | ||
47 | table { | ||
48 | border:1px solid #000000; | ||
49 | font-family: sans-serif; | ||
50 | font-size: 10pt; | ||
51 | background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; | ||
52 | } | ||
53 | td, th { | ||
54 | border:1px solid #000000; | ||
55 | text-align: left; | ||
56 | font-weight: normal; | ||
57 | } | ||
58 | .shadowtitle { | ||
59 | height: 8mm; | ||
60 | background-color: #EEDDFF; | ||
61 | background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; | ||
62 | padding: 0.8em; | ||
63 | padding-left: 3em; | ||
64 | font-family:sans; | ||
65 | font-size: 26pt; | ||
66 | font-weight: bold; | ||
67 | border: 0.2mm solid white; | ||
68 | border-radius: 0.2em; | ||
69 | box-shadow: 0 0 2em 0.5em rgba(0,0,255,0.9); | ||
70 | color: #AAAACC; | ||
71 | text-shadow: 0.03em 0.03em #666, 0.05em 0.05em rgba(127,127,127,0.5), -0.015em -0.015em white; | ||
72 | } | ||
73 | h3 { | ||
74 | margin: 3em 0 2em -15mm; | ||
75 | background-color: #EEDDFF; | ||
76 | background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; | ||
77 | padding: 0.5em; | ||
78 | padding-left: 3em; | ||
79 | width: 50%; | ||
80 | font-family:sans; | ||
81 | font-size: 16pt; | ||
82 | font-weight: bold; | ||
83 | border-left: none; | ||
84 | border-radius: 0 2em 2em 0; | ||
85 | box-shadow: 0 0 2em 0.5em rgba(255,0,0,1); | ||
86 | text-shadow: 0.05em 0.04em rgba(127,127,127,0.5); | ||
87 | } | ||
88 | .css { | ||
89 | font-family: arial; | ||
90 | font-style: italic; | ||
91 | color: #000088; | ||
92 | } | ||
93 | table.pop { | ||
94 | border-collapse: collapse; | ||
95 | } | ||
96 | table.pop td { | ||
97 | font-family: arial; | ||
98 | font-size: 10px; | ||
99 | border: 1px solid #888888; | ||
100 | } | ||
101 | meter.pop { | ||
102 | margin: 3px; | ||
103 | } | ||
104 | fieldset { border: 1px solid #000000; border-radius: 5px; padding: 10px; } | ||
105 | div.folder { | ||
106 | background: url(data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7) no-repeat 4px center; | ||
107 | padding: 5px 0 5px 25px; | ||
108 | border: 1px solid #000000; | ||
109 | } | ||
110 | </style> | ||
111 | <body> | ||
112 | |||
113 | |||
114 | <div class="shadowtitle">New Features in mPDF v5.6</div> | ||
115 | |||
116 | <h3>HTML5 tags</h3> | ||
117 | <div class="gradient text"> | ||
118 | <p>New tags introduced in HTML5 now have basic support in mPDF, and will thus support CSS style references.</p> | ||
119 | <p>The following are treated as block elements similar to <div>:</p> | ||
120 | <p class="code"><article> <aside> <details> <figure> <figcaption> <footer> <header> <hgroup> <nav> <section> <summary> </p> | ||
121 | <p>The following are treated as in-line elements:</p> | ||
122 | <p class="code"><time> <mark></p> | ||
123 | <p>Mark is set by default to highlight in yellow in config.php using $defaultCSS e.g. <mark>mark</mark></p> | ||
124 | <p>Progress and meter are discussed below:</p> | ||
125 | </div> | ||
126 | |||
127 | <h3><progress></h3> | ||
128 | <div class="gradient text"> | ||
129 | <p>Progress: accepts the attributes value and max. A progress element without a value is called an indeterminate progress bar. | ||
130 | Text between the opening and closing tags is not displayed.</p> | ||
131 | <p>CSS styles properties can be applied: display, visibility, margin, padding, border, vertical-align, width, height and opacity. | ||
132 | HTML attributes width and height are supported, although not officially part of the spec.</p> | ||
133 | <p>Example:</p> | ||
134 | <p class="code"><progress value="5" max="10">50%</progress></p> | ||
135 | |||
136 | <ul class="compact"> | ||
137 | <li> | ||
138 | <label>Indeterminate</label> | ||
139 | <progress max="100"></progress> | ||
140 | </li> | ||
141 | <li> | ||
142 | <label>Progress: 0%</label> | ||
143 | <progress max="10" value="0"></progress> | ||
144 | </li> | ||
145 | <li> | ||
146 | <label>Progress: 100%</label> | ||
147 | <progress max="3254" value="3254"></progress> | ||
148 | </li> | ||
149 | <li> | ||
150 | <label>Progress: 57%</label> | ||
151 | <progress max="0.7" value="0.4"></progress> | ||
152 | </li> | ||
153 | </ul> | ||
154 | </div> | ||
155 | |||
156 | <h3><meter></h3> | ||
157 | <div class="gradient text"> | ||
158 | <p>Meter: accepts the attributes min, max, value, optimum, low, and high. | ||
159 | Text between the opening and closing tags is not displayed.</p> | ||
160 | <p>CSS styles properties can be applied: display, visibility, margin, padding, border, vertical-align, width, height and opacity. | ||
161 | HTML attributes width and height are supported, although not officially part of the spec.</p> | ||
162 | <p>Example:</p> | ||
163 | <p class="code"><meter value="5" max="10" min="1" low="2" high="8" optimum="5.6">5</meter></p> | ||
164 | |||
165 | |||
166 | |||
167 | <ul class="compact"> | ||
168 | <li> | ||
169 | <label>Meter: full</label> | ||
170 | <meter value="1"></meter> | ||
171 | </li> | ||
172 | <li> | ||
173 | <label>Preferred usage</label> | ||
174 | <meter min="1024" max="10240" low="2048" high="8192" value="1824" optimum="1024"></meter> | ||
175 | </li> | ||
176 | <li> | ||
177 | <label>Too much traffic</label> | ||
178 | <meter min="1024" max="10240" low="2048" high="8192" value="6216" optimum="1024"></meter> | ||
179 | </li> | ||
180 | <li> | ||
181 | <label>Much too much traffic</label> | ||
182 | <meter min="1024" max="10240" low="2048" high="8192" value="9216" optimum="1024"></meter> | ||
183 | </li> | ||
184 | </ul> | ||
185 | </div> | ||
186 | |||
187 | <div class="gradient text"> | ||
188 | <h4>Custom appearances for <meter> and <progress></h4> | ||
189 | <p>Meter (and to a lesser extent progress) can be used with custom appearances e.g. by using optimum to display the average, and low/high to indicate 90th centiles</p> | ||
190 | |||
191 | <p>Custom appearances can be written by editing the script in classes/meter.php - Use a custom attribute of type="anyname" which is passed to the class as a variable e.g.</p> | ||
192 | <p class="code"><meter type="2" value="612.7" optimum="580.4" min="517.0 " max="642.7" low="542" high="600">612.7</meter></p> | ||
193 | </div> | ||
194 | |||
195 | |||
196 | <table class="pop"> | ||
197 | <tbody> | ||
198 | <tr> | ||
199 | <td><p><b>Domain</b></p></td> | ||
200 | <td><p><b>Indicator</b></p></td> | ||
201 | <td><p><b>LHB</b></p><p><b>number</b></p></td> | ||
202 | <td><p><b>LHB</b></p><p><b>Indicator</b></p> | ||
203 | <p><b>value</b></p> | ||
204 | </td> | ||
205 | <td><p><b>Wales</b></p><p><b>average</b></p> | ||
206 | </td> | ||
207 | <td><p><b>Wales range</b></p></td> | ||
208 | <td><p><b>Comparison</b></p></td> | ||
209 | </tr> | ||
210 | |||
211 | <tr> | ||
212 | <td rowspan="4"><p><b>Deaths</b></p></td> | ||
213 | <td><p>Death Rates per 100,000 population</p></td> | ||
214 | <td><p>3046</p></td> | ||
215 | <td><p><b>612.7</b><b></b></p></td> | ||
216 | <td><p>580.4</p></td> | ||
217 | <td><p>517.0 - 642.7</p></td> | ||
218 | <td><meter class="pop" type="2" value="612.7" optimum="580.4" min="517.0 " max="642.7" low="542" high="600">612.7</meter></td> | ||
219 | </tr> | ||
220 | |||
221 | <tr> | ||
222 | <td><p>Death Rates per 100,000 from cancer</p></td> | ||
223 | <td><p>789</p></td> | ||
224 | <td><p><b>178.2</b><b></b></p></td> | ||
225 | <td><p>172.7</p></td> | ||
226 | <td><p>159.5 - 182.2</p></td> | ||
227 | <td><meter class="pop" type="2" value="178.2" optimum="172.7" min="159.5 " max="182.2" low="162" high="180">178.2</meter></td> | ||
228 | </tr> | ||
229 | |||
230 | <tr> | ||
231 | <td><p>Death Rates per 100,000 from respiratory disease</p></td> | ||
232 | <td><p>505</p></td> | ||
233 | <td><p><b>60.5</b><b></b></p></td> | ||
234 | <td><p>72.11</p></td> | ||
235 | <td><p>54.41 - 95.5</p></td> | ||
236 | <td><meter class="pop" type="2" value="60.5" optimum="72.11" min="54.41 " max="95.5" low="68" high="80">60.5</meter></td> | ||
237 | </tr> | ||
238 | |||
239 | <tr> | ||
240 | <td><p>Death Rates per 100,000 from cardiovascular disease</p></td> | ||
241 | <td><p>913</p></td> | ||
242 | <td><p><b>178.2</b><b></b></p></td> | ||
243 | <td><p>165.0</p></td> | ||
244 | <td><p>151.8 - 179.9</p></td> | ||
245 | <td><meter class="pop" type="2" value="160.2" optimum="165" min="151.8 " max="179.9" low="158" high="170">160.2</meter></td> | ||
246 | </tr> | ||
247 | |||
248 | </tbody> | ||
249 | </table> | ||
250 | |||
251 | |||
252 | <h3>Fieldset and Legend</h3> | ||
253 | <form> | ||
254 | <fieldset> | ||
255 | <legend>Fieldset and legend</legend> | ||
256 | <p>Support for fieldset and legend was introduced in mPDF v5.5. Consider it experimental!</p> | ||
257 | <label for="name">Username:</label> | ||
258 | <input type="text" name="name" id="name" /> | ||
259 | <br /> | ||
260 | <label for="mail">E-mail:</label> | ||
261 | <input type="text" name="mail" id="mail" /> | ||
262 | </fieldset> | ||
263 | </form> | ||
264 | |||
265 | |||
266 | <h3>CSS styles</h3> | ||
267 | <div class="gradient text"> | ||
268 | <h4></h4> | ||
269 | <p><span class="css">min-height</span>, <span class="css">min-width</span>, <span class="css">max-height</span> and <span class="css">max-width</span> are now supported in CSS style sheets for <img> (only).</p> | ||
270 | <p><span class="css">background: url(data:image/gif;base64,...)</span> is now supported in CSS style sheets (gif, png and jpeg).</p> | ||
271 | </div> | ||
272 | |||
273 | <div class="folder">This <div> has the folder icon set as an embedded image in the CSS</div> | ||
274 | <p class="code">div.folder { | ||
275 | background: url(data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7) no-repeat 4px center; | ||
276 | padding: 5px 0 5px 25px; | ||
277 | border: 1px solid #000000; | ||
278 | } | ||
279 | </p> | ||
280 | |||
281 | |||
282 | |||
283 | <h3>Arabic text</h3> | ||
284 | |||
285 | |||
286 | |||
287 | <br /><br /> | ||
288 | |||
289 | <div class="gradient text"> | ||
290 | |||
291 | <p>The script handling Arabic text (RTL) was rewritten in mPDF 5.5 with improved support for Pashto/Sindhi/Urdu/Kurdish, especially for joining characters and added new presentation forms.</p> | ||
292 | <p>Some characters in Pashto/Sindhi/Urdu/Kurdish do not have Unicode values for the final/initial/medial forms of the characters. However, some fonts include glyphs for these characters "un-mapped" to Unicode (including XB Zar and XB Riyaz, which are bundled with mPDF).</p> | ||
293 | <p>By editing config_fonts.php and adding:</p> | ||
294 | <p class="code"> | ||
295 | \'unAGlyphs\' => true, | ||
296 | </p> | ||
297 | <p>to appropriate fonts, this will force mPDF to use unmapped glyphs. It requires the font file to include a Format 2.0 POST table which references the glyphs by name as e.g. uni067C.med or uni067C.medi</p> | ||
298 | <p>XB Riyaz, XB Zar, Arabic Typesetting (MS), Arial (MS) all contain this table. NB If you want to know if a font file is suitable, you can open a .ttf file in a text editor and search for "uni067C.med" - if it exists, it may work!</p> | ||
299 | <p>Using "unAGlyphs" forces subsetting of fonts, and will not work with SIP/SMP fonts (using characters beyond the Unicode BMP Plane).</p> | ||
300 | <p>mPDF maps these characters to part of the Private Use Area allocated by Unicode U+F500-F7FF. This could interfere with correct use | ||
301 | if the font already utilises these codes (unlikely).</p> | ||
302 | </div> | ||
303 | |||
304 | <pagebreak /> | ||
305 | <p>Using Arial MS font:</p> | ||
306 | '; | ||
307 | //============================================================== | ||
308 | // Test for all Arabic characters which may need joining | ||
309 | //============================================================== | ||
310 | $mpdf->cacheTables = true; | ||
311 | $html .=' | ||
312 | <style> | ||
313 | .script-arabic { font-family: arial; font-size: 22pt; direction: rtl; padding: 0.1em 0.5em; text-align: center; } | ||
314 | .joined { color: #888888; } | ||
315 | </style> | ||
316 | <div dir="ltr"> | ||
317 | '; | ||
318 | |||
319 | |||
320 | $ranges = array(0=>array(0x0621, 0x063a), 1=>array(0x0640, 0x064a), 2=>array(0x0671, 0x0672), 3=>array(0x0674, 0x06d3)); | ||
321 | |||
322 | foreach($ranges AS $r) { | ||
323 | $html .= '<table border="1" style="border-collapse: collapse">'; | ||
324 | $html .= '<thead><tr>'; | ||
325 | $html .= '<td></td>'; | ||
326 | $html .= '<td style="text-align:center; padding: 0 0.5em;">Isolated</td>'; | ||
327 | $html .= '<td></td>'; | ||
328 | $html .= '<td style="text-align:center; padding: 0 0.5em;">Final</td>'; | ||
329 | $html .= '<td style="text-align:center; padding: 0 0.5em;">Medial</td>'; | ||
330 | $html .= '<td style="text-align:center; padding: 0 0.5em;">Initial</td>'; | ||
331 | $html .= '<td></td>'; | ||
332 | $html .= '</tr></thead><tbody>'; | ||
333 | for($n=$r[0];$n<=$r[1];$n++) { | ||
334 | |||
335 | $html .= '<tr>'; | ||
336 | $html .= '<td>U+0'.strtoupper(dechex($n)) .'</td>'; | ||
337 | |||
338 | $html .= '<td class="script-arabic">�'.dechex($n) .';</td>'; | ||
339 | $html .= '<td class="script-arabic joined">ئ�'.dechex($n) .';</td>'; | ||
340 | $html .= '<td class="script-arabic">ـ�'.dechex($n) .';</td>'; | ||
341 | $html .= '<td class="script-arabic">ـ�'.dechex($n) .';ـ</td>'; | ||
342 | $html .= '<td class="script-arabic">�'.dechex($n) .';ـ</td>'; | ||
343 | $html .= '<td class="script-arabic joined">�'.dechex($n) .';ه</td>'; | ||
344 | |||
345 | $html .= '</tr>'; | ||
346 | } | ||
347 | $html .='</tbody></table>'; | ||
348 | $html .='<br />'; | ||
349 | } | ||
350 | |||
351 | |||
352 | |||
353 | $html .='</div>'; | ||
354 | //============================================================== | ||
355 | |||
356 | $html .=' | ||
357 | <br /> | ||
358 | |||
359 | |||
360 | '; | ||
361 | |||
362 | //============================================================== | ||
363 | if ($_REQUEST['html']) { echo $html; exit; } | ||
364 | if ($_REQUEST['source']) { | ||
365 | $file = __FILE__; | ||
366 | header("Content-Type: text/plain"); | ||
367 | header("Content-Length: ". filesize($file)); | ||
368 | header("Content-Disposition: attachment; filename='".$file."'"); | ||
369 | readfile($file); | ||
370 | exit; | ||
371 | } | ||
372 | |||
373 | //============================================================== | ||
374 | |||
375 | $mpdf->WriteHTML($html); | ||
376 | |||
377 | // OUTPUT | ||
378 | $mpdf->Output(); exit; | ||
379 | |||
380 | |||
381 | //============================================================== | ||
382 | //============================================================== | ||
383 | //============================================================== | ||
384 | //============================================================== | ||
385 | |||
386 | |||
387 | ?> \ No newline at end of file | ||