aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/mpdf/examples/example58_new_mPDF_v5-4_features.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/3rdparty/libraries/mpdf/examples/example58_new_mPDF_v5-4_features.php')
-rw-r--r--inc/3rdparty/libraries/mpdf/examples/example58_new_mPDF_v5-4_features.php547
1 files changed, 0 insertions, 547 deletions
diff --git a/inc/3rdparty/libraries/mpdf/examples/example58_new_mPDF_v5-4_features.php b/inc/3rdparty/libraries/mpdf/examples/example58_new_mPDF_v5-4_features.php
deleted file mode 100644
index 6772fa95..00000000
--- a/inc/3rdparty/libraries/mpdf/examples/example58_new_mPDF_v5-4_features.php
+++ /dev/null
@@ -1,547 +0,0 @@
1<?php
2
3ini_set("memory_limit","64M");
4
5include("../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}
27h4 {
28 font-weight: bold;
29 margin-top: 1em;
30 margin-bottom: 0.3em;
31 margin-top: 0;
32}
33div.text {
34 padding:0.8em;
35 margin-bottom: 0.7em;
36}
37p { 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}
47table {
48 overflow: visible;
49 empty-cells: hide;
50 border:1px solid #000000;
51 font-family: sans-serif;
52 font-size: 10pt;
53 background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
54}
55td, th {
56 border:1px solid #000000;
57 text-align: left;
58 font-weight: normal;
59}
60td.markedcell {
61 text-decoration: line-through;
62 color: #CC0000;
63}
64td.underlinedcell {
65 text-decoration: underline;
66 color: #CC0000;
67}
68td.rotatedcell {
69 text-decoration: line-through;
70 color: #CC0000;
71 text-rotate: 45;
72}
73td.cost { text-align: right; }
74caption.tablecaption {
75 font-family: sans-serif;
76 font-weight: bold;
77 border: none;
78 caption-side: top;
79 margin-bottom: 0;
80 text-align: center;
81}
82u.doubleu {
83 text-decoration: none;
84 border-bottom: 3px double #000088;
85}
86a.reddashed {
87 text-decoration: none;
88 border: 1px dashed #880000;
89}
90.shadowtitle {
91 height: 8mm;
92 background-color: #EEDDFF;
93 background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
94 padding: 0.8em;
95 padding-left: 3em;
96 font-family:sans;
97 font-size: 26pt;
98 font-weight: bold;
99 border: 0.2mm solid white;
100 border-radius: 0.2em;
101 box-shadow: 0 0 2em 0.5em rgba(0,0,255,0.9);
102 color: #AAAACC;
103 text-shadow: 0.03em 0.03em #666, 0.05em 0.05em rgba(127,127,127,0.5), -0.015em -0.015em white;
104}
105h3 {
106 margin: 3em 0 2em -15mm;
107 background-color: #EEDDFF;
108 background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
109 padding: 0.5em;
110 padding-left: 3em;
111 width: 50%;
112 font-family:sans;
113 font-size: 16pt;
114 font-weight: bold;
115 border-left: none;
116 border-radius: 0 2em 2em 0;
117 box-shadow: 0 0 2em 0.5em rgba(255,0,0,1);
118 text-shadow: 0.05em 0.04em rgba(127,127,127,0.5);
119}
120.css {
121 font-family: arial;
122 font-style: italic;
123 color: #000088;
124}
125table.zebra tbody tr:nth-child(2n+1) td { background-color: rgba(255,255,127,0.6); }
126table.zebra tbody tr:nth-child(2n+1) th { background-color: rgba(255,255,127,0.6); }
127table.zebra thead tr { background-color: #FFBBFF; }
128table.zebra tfoot tr { background-color: #BBFFFF; }
129
130
131</style>
132<body>
133
134
135<div class="shadowtitle">New Features in mPDF v5.4</div>
136
137
138<h3>Bookmark styles<bookmark content="Bookmark styles" level="0" /></h3>
139<div>
140<p>Bookmarks can be styled by adding code as below to your script. You can define a colour (array of RGB) and/or a font-style (B, I, or BI) for each level (starting at 0). Results may depend on the PDF Reader you are using.</p>
141<p class="code">
142$this->bookmarkStyles = array(<br />
143 &nbsp; &nbsp; &nbsp; 0 => array(\'color\'=> array(0,64,128), \'style\'=>\'B\'),<br />
144 &nbsp; &nbsp; &nbsp; 1 => array(\'color\'=> array(128,0,0), \'style\'=>\'\'),<br />
145 &nbsp; &nbsp; &nbsp; 2 => array(\'color\'=> array(0,128,0), \'style\'=>\'I\'),<br />
146);
147</p>
148</div>
149
150<h3>Embedded SVG code<bookmark content="Embedded SVG code" level="0" /></h3>
151<p>SVG Images can be embedded in your HTML code. This is formally part of the XHTML specification and is supported by IE9+ and most other browsers.</p>
152<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 400 200" width="400" height="200">
153 <circle cx="130" cy="100" r="80" stroke="black" stroke-width="1" fill="red" />
154 <circle cx="200" cy="100" r="80" stroke="black" stroke-width="1" fill="blue" />
155</svg>
156<p class="code">
157&lt;svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 200 200" width="200" height="200"&gt; <br />
158&nbsp; &lt;circle cx="100" cy="50" r="40" stroke="black" stroke-width="1" fill="red" /&gt;<br />
159&nbsp; &lt;circle cx="130" cy="50" r="40" stroke="black" stroke-width="1" fill="blue" /&gt;<br />
160&lt;/svg&gt;
161</p>
162
163
164<h3>Improved CSS support<bookmark content="Improved CSS support" level="0" /></h3>
165<div class="gradient text">
166<p><span class="css">border-radius</span> is now supported on fixed/absolute-positioned block elements.</p>
167<p><span class="css">visibility</span> can be set on any block-style element e.g. DIV,P or images IMG as: visible|hidden|printonly|screenonly</p>
168<p><span class="css">background-color</span> now supports rgba() and cmyka() alpha transparency formats in tables.</p>
169<p>Color, underline and strike-through are now supported in table cells, including with rotated text (see example below of spread table)</p>
170<p><span class="css">page-break-after: left|right|always</span> is supported on all block-style elements and tables</p>
171<p><span class="css">text-transform: capitalize|uppercase|lowercase</span> is supported in table cells</p>
172</div>
173
174
175<div class="gradient text">
176<h4>Zebra stripes in Tables<bookmark content="Zebra stripes" level="1" /></h4>
177<div>
178<p><span class="css">:nth-child()</span> selector can be used in tables (on TR, TD or TH) to stripe rows or columns. Both the <i>a</i>n+<i>b</i> and odd/even forms are supported e.g.</p>
179
180<p class="code">
181tr:nth-child(2n+1) { background-color: rgba(255,255,127,0.6); } <i>or</i><br />
182tr:nth-child(odd) { background-color: rgba(255,255,127,0.6); }
183</p>
184
185<table class="zebra" align="center">
186<tbody>
187<tr>
188<th>Row 1</th>
189<td>This is data</td>
190<td class="cost">167.00</td>
191</tr>
192<tr>
193<th>Row 2</th>
194<td>
195<p>This is data p</p>
196</td>
197<td class="cost">
198<p>444.53</p>
199</td>
200</tr>
201<tr>
202<th>
203<p>Row 3</p>
204</th>
205<td>
206<p>This is long data</p>
207</td>
208<td class="cost">14.00</td>
209</tr>
210<tr>
211<td>
212<p>Row 4</p>
213</td>
214<td>This is data</td>
215<td class="cost">
216<p>0.88</p>
217</td>
218</tr>
219<tr>
220<td>Row 5</td>
221<td>Also data</td>
222<td class="cost">144.00</td>
223</tr>
224<tr>
225<td>Row 6</td>
226<td>Also data</td>
227<td class="cost">8089.00</td>
228</tr>
229</tbody></table>
230
231<p><b>Note:</b> mPDF does NOT correctly apply specificity to all CSS. The following stylesheet:</p>
232<p class="code">
233table.zebra tbody tr:nth-child(2n+1) td { background-color: yellow; }<br />
234table.zebra tbody td:nth-child(odd) { background-color: blue; }
235</p>
236<p>should make every odd row yellow, and every odd column blue, but with the row/yellow overriding the column/blue.
237In mPDF the td:nth-child(odd) trumps the plain td, so the column colour wins out. You can force the effect you want by using:</p>
238<p class="code">
239table.zebra tbody tr:nth-child(2n+1) td:nth-child(1n+0) { background-color: yellow; }
240</p>
241<p>The :nth-child(1n+0) selector just selects every td cell.</p>
242
243</div>
244</div>
245
246
247<div class="gradient text">
248<p><span class="css">border</span> can now be defined on in-line elements eg SPAN</p>
249<ul><li style="font-family: arial;">Cum sociis natoque <u class="doubleu">penatibus</u> et <a class="reddashed" href="#">magnis dis parturient</a> montes</li></ul>
250<p><b>Note:</b> Remember that in mPDF, inside table cells, properties set on block elements are set when possible as in-line properties - so a P element inside a table with border set, will appear with a border around the text line as though it had been set on SPAN </p>
251</div>
252
253
254
255
256<div class="gradient text">
257<h4>Shadows<bookmark content="Shadows" level="1" /></h4>
258<p><span class="css">box-shadow</span> can be defined on any block-level element (P, DIV etc). It follows the CSS3 recommendation, but <i>inset</i> is not supported.</p>
259<p><span class="css">text-shadow</span> can be defined on any element. It follows the CSS3 recommendation, but <i>blur</i> is not supported.</p>
260<p class="code">
261&lt;span style="text-shadow: 0.03em 0.03em #666, -0.015em -0.015em white;"&gt;<br />
262&lt;div style="box-shadow: 0.3em 0.3em #888888;"&gt;
263</p>
264</div>
265
266
267<h3>Other Enhancements<bookmark content="Other Enhancements" level="0" /></h3>
268
269<h4>Column Totals (Tables)<bookmark content="Column totals" level="1" /></h4>
270<p>{colsum} placed in the footer of a table will automatically display the sum of that column. If the table breaks across more than one page, the sum of the values on that page will be displayed. A number following the colsum e.g. {colsum2} will force that number of decimal places to be displayed.</p>
271
272<table class="zebra" align="center">
273<caption class="tablecaption" align="bottom">Table caption goes here</caption>
274<thead>
275<tr>
276<th>Header Row</th>
277<td>Header Row</td>
278<td>Header Row</td>
279</tr>
280</thead>
281<tfoot>
282<tr>
283<th></th>
284<td>Column total: (using colsum2 in {})</td>
285<td class="cost"><b>{colsum2}</b></td>
286</tr>
287</tfoot>
288<tbody>
289<tr>
290<th>Row 1</th>
291<td>This is data</td>
292<td class="cost">167.00</td>
293</tr>
294<tr>
295<th>Row 2</th>
296<td>
297<p>This is data p</p>
298</td>
299<td class="cost">
300<p>444.53</p>
301</td>
302</tr>
303<tr>
304<th>
305<p>Row 3</p>
306</th>
307<td>
308<p>This is long data</p>
309</td>
310<td class="cost">14.00</td>
311</tr>
312<tr>
313<td>
314<p>Row 4</p>
315</td>
316<td>This is data</td>
317<td class="cost">
318<p>0.88</p>
319</td>
320</tr>
321<tr>
322<td>Row 5</td>
323<td>Also data</td>
324<td class="cost">144.00</td>
325</tr>
326<tr>
327<td>Row 6</td>
328<td>Also data</td>
329<td class="cost">8089.00</td>
330</tr>
331<tr>
332<td>Row 7</td>
333<td>Also data</td>
334<td class="cost">3.00</td>
335</tr>
336<tr>
337<td>Row 8</td>
338<td>Also data</td>
339<td class="cost">23.00</td>
340</tr>
341</tbody></table>
342<br />
343
344<h4>Table <span style="font-variant: small-caps">caption</span><bookmark content="Table caption" level="1" /></h4>
345<p>The caption element for tables is partially supported (see example above).</p>
346<p class="code">
347&lt;caption align="top|bottom" style="caption-side: top|bottom"&gt;
348</p>
349<ul>
350<li>The caption must come immediately after &lt;table&gt;.</li>
351<li>The CSS <span class="css">caption-side</span> or HTML <span class="css">align</span> attribute of top|bottom supported</li>
352<li>Left or right placement are not supported.</li>
353<li>The caption is handled as a separate block element brought outside the table, so:
354<ul>
355 <li>CSS will not cascade correctly from the table</li>
356 <li>the width of the caption block is that of page or of the block element containing the table</li>
357 <li>text alignment will be to the page-width not the table width</li>
358 <li>if table page-break-after: always, the caption will follow the pagebreak</li>
359</ul></li>
360</ul>
361
362
363<h4>Core fonts in non-core font document<bookmark content="Core fonts" level="1" /></h4>
364
365<p>Core fonts, which do not need to be embedded in a PDF, can now be included in a document which uses non-core fonts. The pseudo font-family names: <span style="font-family: chelvetica">chelvetica</span>, <span style="font-family: ctimes">ctimes</span> and <span style="font-family: ccourier">ccourier</span> should be used.</p>
366<p class="code">
367&lt;div style="font-family: chelvetica"&gt;
368</p>
369<p>NB You could force mPDF to always use core fonts when Arial/Helvetica/Courier are specified, by editing $this->fonttrans in config_fonts.php:</p>
370<p class="code">
371$this->fonttrans = array(<br />
372 \'arial\' => \'chelvetica\',<br />
373 \'helvetica\' => \'chelvetica\',<br />
374 \'timesnewroman\' => \'ctimes\',<br />
375 \'times\' => \'ctimes\',<br />
376 \'couriernew\' => \'ccourier\',<br />
377 \'courier\' => \'ccourier\',<br />
378...
379</p>
380<br />
381
382<h4>Javascript in Forms<bookmark content="Javascript in Forms" level="1" /></h4>
383
384<p>Javascript used in (active) forms has been altered to reflect the Adobe Acrobat specification for Javascript in PDF documents.</p>
385<p>textarea and input (text-types) now accept javascript as: onKeystroke, onValidate, onCalculate and onFormat. onChange is depracated but is not ignored; it works as though for onCalculate. (PS Select still accepts onChange)</p>
386
387
388<br />
389
390
391
392<h4>Overlapping Rows in Tables<bookmark content="Overlapping Table Rows" level="1" /></h4>
393<p> Support for overlapping rowspans in tables has been improved (although probably not foolproof!)</p>
394<table style="border-collapse: separate; border-spacing: 3.5mm;">
395<tr>
396<td style="width: 30mm; height: 30mm; background-color: rgb(213,226,253)">&nbsp;</td>
397<td style="width: 30mm; height: 30mm; background-color: rgb(75,155,215)">&nbsp;</td>
398<td rowspan="2" style="width: 30mm; height: 63.5mm; background-color: rgb(183,225,253)">&nbsp;</td>
399</tr>
400<tr>
401<td colspan="2" rowspan="2" style="width: 63.5mm; height: 63.5mm; background-color: rgb(183,225,253)">&nbsp;</td>
402</tr>
403<tr>
404<td style="width: 30mm; height: 30mm; background-color: rgb(75,155,215)">&nbsp;</td>
405</tr>
406</table>
407
408<br />
409
410
411
412<h3>Circular Text<bookmark content="Circular Text" level="0" /></h3>
413<p>Circular Text can be included in a PDF document as a custom HTML tag (or a function)</p>
414<ul>
415<li>top-text and/or bottom-text can be specified</li>
416<li>Radius (r) and font-size (using CSS) are user-defined</li>
417<li>Width and height are calculated from radius and font-size</li>
418<li>Other CSS styles supported on Circular Text: border, margin, padding, color, background-color, font-family, font-size, font-weight, font-style, display, visibility, and opacity</li>
419<li>space-width should be specified as an integer defining the letter-spacing as a percentage of normal (default 120)</li>
420<li>char-width should be specified as an integer defining the width of each character as a percentage of normal (default 100)</li>
421<li>Circular Text is displayed as though an in-line element</li>
422</ul>
423<p>NB If $mpdf->useKerning is true then automatic kerning will be used on Circular Text.</p>
424
425<p class="code">
426&lt;textcircle r="30mm" top-text="Circular Text Circular Text" style="color: blue; font-size: 34pt; font-style: italic" /&gt;<br /><br />
427&lt;textcircle r="30mm" space-width="120" char-width="150" top-text="&amp;bull; Circular Text &amp;bull;" bottom-text="Circular Text" style="background-color: #FFAAAA; border:1px solid red; padding: 0.3em; margin: 0.3em; color: #000000; font-size: 21pt; font-weight:bold; font-family: Arial" /&gt;
428</p>
429
430<textcircle r="30mm" top-text="Circular Text Circular Text" style="color: blue; font-size: 34pt; font-style: italic" />
431
432<textcircle r="30mm" space-width="120" char-width="150" top-text="&bull; Circular Text &bull;" bottom-text="Circular Text" style="background-color: #FFAAAA; border:1px solid red; padding: 0.3em; margin: 0.3em; color: #000000; font-size: 21pt; font-weight:bold; font-family: Arial" />
433
434
435
436
437
438<h3 style="page-break-before: left;">Spread tables<bookmark content="Spread Tables" level="0" /></h3>
439<div class="gradient text">
440Setting the CSS property "overflow: visible" on a table now has the effect of cancelling resizing, and allowing tables to split columns across multiple pages.
441The maximum width for a column (or group of columns set by colspan) is the page width. It is recommended to specify absolute values of width on each column (not percentages).
442</div>
443<br />
444<input type="button" name="javascriptButton" value="Show 2 pages" onClick="TwoPages()" />
445<input type="button" name="javascriptButton2" value="Show 1 page" onClick="OnePage()" />
446
447
448<br /><br />
449
450<table cellPadding="9" style="font-size: 16pt;">
451<caption class="tablecaption">Periodic Table (table caption)</caption>
452<thead>
453<tr><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th><th>11</th><th>12</th><th>13</th><th>14</th><th>15</th><th>16</th><th>17</th><th>18</th></tr></thead>
454<tbody>
455<tr>
456<td>H </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
457<td></td><td></td><td></td><td></td><td>He </td>
458</tr>
459<tr>
460<td>Li </td><td>Be </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
461<td>B </td><td>C </td><td>N </td><td>O </td><td>F </td><td>Ne </td>
462</tr>
463<tr>
464<td>Na </td><td>Mg </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
465<td>Al </td><td>Si </td><td>P </td><td>S </td><td>Cl </td><td>Ar </td>
466</tr>
467<tr>
468<td>K </td><td>Ca </td><td>Sc </td><td>Ti </td><td>V </td><td class="markedcell">Cr </td><td>Mn </td><td>Fe </td><td>Co </td><td>Ni </td>
469<td>Cu </td><td>Zn </td><td>Ga </td><td>Ge </td><td>As </td><td>Se </td><td>Br </td><td>Kr </td>
470</tr>
471<tr>
472<td>Rb </td><td>Sr </td><td>Y </td><td>Zr </td><td>Nb </td><td>Mo </td><td>Tc </td><td class="underlinedcell">Ru </td><td>Rh </td>
473<td>Pd </td><td>Ag </td><td>Cd </td><td>In </td><td>Sn </td><td>Sb </td><td>Te </td><td>I </td><td>Xe </td>
474</tr>
475<tr>
476<td>Cs </td><td>Ba </td><td class="rotatedcell">Lu </td><td>Hf </td><td>Ta </td><td>W </td><td>Re </td><td>Os </td><td>Ir </td><td>Pt </td>
477<td>Au </td><td>Hg </td><td>Tl </td><td>Pb </td><td>Bi </td><td>Po </td><td>At </td><td>Rn </td>
478</tr>
479<tr>
480<td>Fr </td><td>Ra </td><td> </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
481<td></td><td></td><td></td><td></td><td></td>
482</tr>
483</tbody></table>
484
485<br /><br />
486
487<div class="gradient text">
488<h4>Limitations of Spread tables<bookmark content="Limitations" level="1" /></h4>
489Spread tables cannot be used with: keep-headings-with-table ($mpdf->use_kwt), table rotate, table page-break-inside:avoid, columns,
490CJK (chinese-japanese-korean) or RTL (right-to-left) languages.
491They will also cause problems with $mpdf->forcePortraitHeaders or $mpdf->forcePortraitMargins.<br />
492Warning: If a table row is too tall to fit on a page, mPDF will crash with an error message.<br />
493If the width settings within the table cause conflicts, it will override some of these settings.
494</div>
495<br />
496
497
498';
499
500//==============================================================
501if ($_REQUEST['html']) { echo $html; exit; }
502if ($_REQUEST['source']) {
503 $file = __FILE__;
504 header("Content-Type: text/plain");
505 header("Content-Length: ". filesize($file));
506 header("Content-Disposition: attachment; filename='".$file."'");
507 readfile($file);
508 exit;
509}
510
511//==============================================================
512$mpdf->useActiveForms = true;
513
514$mpdf->bookmarkStyles = array(
515 0 => array('color'=> array(0,64,128), 'style'=>'B'),
516 1 => array('color'=> array(128,0,0), 'style'=>''),
517 2 => array('color'=> array(0,128,0), 'style'=>'I'),
518);
519
520$mpdf->useKerning=true; // set this to improve appearance of Circular text
521 // must be set before the font is first loaded
522
523$mpdf->WriteHTML($html);
524
525// JAVASCRIPT FOR WHOLE DOCUMENT
526$mpdf->SetJS('
527function TwoPages() {
528 this.layout="TwoColumnRight";
529 this.zoomType = zoomtype.fitW;
530}
531function OnePage() {
532 this.layout="SinglePage";
533 this.zoom = 100;
534}
535');
536
537// OUTPUT
538$mpdf->Output(); exit;
539
540
541//==============================================================
542//==============================================================
543//==============================================================
544//==============================================================
545
546
547?> \ No newline at end of file