aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/mpdf/examples/example55_new_mPDF_v5-1_color_and_other_features.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/3rdparty/libraries/mpdf/examples/example55_new_mPDF_v5-1_color_and_other_features.php')
-rw-r--r--inc/3rdparty/libraries/mpdf/examples/example55_new_mPDF_v5-1_color_and_other_features.php456
1 files changed, 0 insertions, 456 deletions
diff --git a/inc/3rdparty/libraries/mpdf/examples/example55_new_mPDF_v5-1_color_and_other_features.php b/inc/3rdparty/libraries/mpdf/examples/example55_new_mPDF_v5-1_color_and_other_features.php
deleted file mode 100644
index 1cd5bca0..00000000
--- a/inc/3rdparty/libraries/mpdf/examples/example55_new_mPDF_v5-1_color_and_other_features.php
+++ /dev/null
@@ -1,456 +0,0 @@
1<?php
2
3
4include("../mpdf.php");
5
6$mpdf=new mPDF('');
7
8$mpdf->useKerning=true;
9
10$mpdf->restrictColorSpace=3; // forces everything to convert to CMYK colors
11
12$mpdf->AddSpotColor('PANTONE 534 EC',85,65,47,9);
13
14//==============================================================
15$html = '
16<style>
17@page {
18 sheet-size: A4;
19 size: 17cm 25cm;
20 margin: 10%; /* % of page-box width for LR, height for TB */
21 margin-header: 5mm;
22 margin-footer: 5mm;
23 margin-left: 2cm;
24 margin-right: 1cm;
25 marks: cross crop;
26 background-image: -moz-repeating-radial-gradient(rgba(255,0,0,0.1), rgba(0,0,255,0.1) 40px, rgba(255,0,0,0.1) 80px);
27}
28body {
29 font-family: sans-serif;
30 font-size: 10pt;
31}
32h4 {
33 font-variant: small-caps;
34}
35h5 {
36 margin-bottom: 0;
37 color: #110044;
38}
39p { margin-top: 0; }
40dl {
41 margin: 0;
42}
43table {
44 border-spacing: 0.5em;
45 border: 7px dashed teal;
46}
47.table1 {
48 background-image: -moz-linear-gradient(left, #07cdde 20%, #00f200 );
49}
50.table1 tr.thisrow1 {
51 background-image-resolution: 300dpi;
52 background: transparent url(\'bayeux1.jpg\') repeat scroll left top;
53}
54.table1 tr.thisrow1 td {
55 height: 28mm;
56}
57.table1 tr.thisrow2 {
58 background-image: none;
59 background: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
60 background: -webkit-gradient(linear, left bottom, left top, color-stop(0.29, rgb(90,83,12)), color-stop(0.65, rgb(117,117,39)), color-stop(0.83, rgb(153,153,67)));
61}
62.table3 {
63 border-collapse: collapse;
64 /* background-gradient: linear #07cdde #00f200 1 0 0.5 1; */
65 background: -moz-linear-gradient(left, #07cdde 20%, #00f200 );
66}
67tr.thisrow {
68 border: 3px dashed red;
69 background: transparent url(\'bayeux1.jpg\') repeat scroll left top;
70}
71.table3 tr.thisrow {
72 border: 3px dashed orange;
73 background: transparent url(\'bgrock.jpg\') repeat scroll left top;
74}
75tfoot tr {
76 border: 5px dashed blue;
77 /* background-gradient: linear #c7Fdde #FF0000 1 0 0.5 0; */
78 background: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
79}
80.gradient {
81 border:0.1mm solid #220044;
82 background-color: #f0f2ff;
83 background: linear-gradient(top, #c7cdde, #f0f2ff);
84}
85.rounded {
86 border:0.1mm solid #220044;
87 background-color: #f0f2ff;
88 background: linear-gradient(top, #c7cdde, #f0f2ff);
89 border-radius: 2mm;
90 background-clip: border-box;
91}
92div.text {
93 padding:1em;
94 margin: 1em 0;
95 text-align:justify;
96}
97.code {
98 font-family: mono;
99 font-size: 9pt;
100 background-color: #d5d5d5;
101 margin: 1em 1cm;
102 padding: 0 0.3cm;
103}
104</style>
105<body>
106
107<div style="position:fixed; top: 0; right: 0"><img src="tux.svg" width="110" /></div>
108
109<h1></a>mPDF</h1>
110<h2>Other new features in mPDF Version 5.1</h2>
111
112<div class="rounded text">
113<ul>
114<li>Kerning</li>
115<li>Letter- and word-spacing</li>
116<li>Small-caps improved to work with justified text, and now with kerning, letter- and word-spacing</li>
117<li>Bleed area on @page media</li>
118<li>Colorspace and colour conversion (almost everything except BMP images)</li>
119<li>Spot colours</li>
120<li>PDF/X files</li>
121<li>dir="rtl"</li>
122<li>numeric list-styles for arabic and indic</li>
123</ul>
124</div>
125
126
127<!-- ============================================================== -->
128<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Kerning</div>
129
130<div class="rounded text">Font kerning is supported. This corrects the inter-character spacing between specific pairs of letters. It is dependent on kerning information being available in the original font file.
131<br />
132You need to set $mpdf-&gt;useKerning=true; either in the config.php configuration file, or at runtime. This causes the kerning information to be loaded when fonts are accessed (and will therefore increase memory usage).
133<br />
134You can then set kerning on or off using the draft CSS3 style property "font-kerning". Values of normal or auto will turn kerning on; "none" will turn kerning off.
135</div>
136
137<div style="border: 0.2mm solid black; font-family: arial; font-size: 40pt;">
138Off: AWAY To War.
139</div>
140
141<div style="border: 0.2mm solid black; font-family: arial; font-size: 40pt; font-kerning: auto;">
142On: AWAY To War.
143</div>
144
145<!-- ============================================================== -->
146<pagebreak />
147<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Letter and word spacing & text justification</div>
148
149<div class="rounded text">Letter- and word-spacing can be set on almost all block and in-line style elements, using the CSS properties letter-spacing and word-spacing. Values of normal or a length can be specified (em or ex recommended).
150Note that setting the letter-spacing value (including setting it to zero) will prevent any additional letter-spacing to be added when full-justifying text. The word-spacing value, however, is a <i>minimum</i> value, and can be increased in order to justify text.
151<br />
152<br />
153Text-align: justify - no longer uses configurable variable $jSpacing= C | W | \'\'
154<br />
155The default value is for mixed letter- and word-spacing, set by jSWord and jSmaxChar
156<br />
157If a line contains a cursive script (RTL or Indic [devanagari, punjabi, bengali]) then it prevents letter-spacing
158for justification on that line - effectively the same as setting letter-spacing:0
159<br />
160Spacing values have been removed from the config_cp.php configuration file, so the "lang" property
161(in config_cp) no longer determines justification behaviour (this includes the use of Autofont()).
162<br />
163When using RTL or Indic [devanagari, punjabi, bengali] scripts, you should set CSS letter-spacing:0
164whenever you use text-align:justify.
165</div>
166
167<p style="border: 0.2mm solid black; padding: 0.3em;">Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. <span style="letter-spacing: 0.2em; color: red;">Letter spacing set at 0.2em. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci.</span> Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. <span style="word-spacing: 1em; color: teal;">Word spacing set at 1em. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien.</span> Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
168
169
170<!-- ============================================================== -->
171<pagebreak />
172<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Colours</div>
173
174<div class="rounded text">Whenever a colour can be specified in a style, additional formats are now supported: rgb(), rgba(), hsl(), hsla(), cmyk(), cmyka(), or spot().
175<br />
176Spot colours need to be defined at the start of the script using e.g. $mpdf-&gt;AddSpotColor(\'PANTONE 534 EC\',85,65,47,9);
177<br />
178The four values define the CMYK values used when the spot colour is not available. A tint % can be specified when using the spot colour in the document.
179</div>
180
181<div style="border: 0.2mm solid black; background-color: rgba(150,150,255, 0.5); color: rgb(0,150,150);">background-color: rgba(150,150,255, 0.5); color: rgb(0,150,150);</div>
182<div style="border: 0.2mm solid black; background-color: rgba(60%,60%,100%, 0.5); color: rgb(0,60%,60%);">background-color: rgba(60%,60%,100%, 0.5); color: rgb(0,60%,60%);</div>
183<div style="border: 0.2mm solid black; background-color: hsla(180,30%,25%, 0.5); color: hsl(360,100%,50%);">background-color: hsla(180,30%,25%, 0.5); color: hsl(360,100%,50%);</div>
184<div style="border: 0.2mm solid black; background-color: cmyka(0,100,0,30, 0.3); color: spot(PANTONE 534 EC,90%);">background-color: cmyka(85,65,0,30, 0.3); color: spot(PANTONE 300 EC,80%);</div>
185<br />
186<br />
187
188<!-- ============================================================== -->
189<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">@page media</div>
190
191<div class="rounded text">When using @page to create a print publication with page-size less than sheet-size, the bleed margin is now configurable.
192Backgrounds/gradients/images now use the bleed box as their "container box", rather than the whole page. (See this document as an example.)
193<br />
194Crop- and cross-marks can now both be used together, and are more configurable.
195Also, background-image-opacity and background-image-resize have been extended to work with @page CSS.
196<br />
197The following values can be set in the configuration file, config.php:
198$this-&gt;bleedMargin<br />
199$this-&gt;crossMarkMargin<br />
200$this-&gt;cropMarkMargin<br />
201$this-&gt;cropMarkLength<br />
202$this-&gt;nonPrintMargin<br />
203</div>
204
205<!-- ============================================================== -->
206<pagebreak />
207<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Colorspace and colour conversion </div>
208
209<div class="rounded text">PDF files can contain objects using different colorSpaces e.g. Grayscale, RGB and CMYK. By default,
210mPDF creates PDF files using the colours as they are specified: font colour may be set (e.g. #880000) as an RGB colour, and the
211file may contain JPG images in RGB or CMYK format.
212<br />
213In some circumstances, you may wish to create a PDF file with restricted colorSpaces e.g. printers will often want files
214which contain only CMYK, spot colours, or grayscale, but <i>not</i> RGB.
215<br />
216Additional methods for defining colours can be used (see above), but alternatively you can set mPDF to restrict the colorSpace by setting
217the value for $mpdf-&gt;restrictColorSpace:
218<br />
2191 - allow GRAYSCALE only [converts CMYK/RGB->gray]
220<br />
2212 - allow RGB / SPOT COLORS / Grayscale [converts CMYK->RGB]
222<br />
2233 - allow CMYK / SPOT COLORS / Grayscale [converts RGB->CMYK]
224<br />
225This will attempt to convert every colour value used in the document to the permitted colorSpace(s). Almost everything including images
226will be converted (except BMP images), and the conversion of images may take significant time.
227<br />
228This example file is set to (3) CMYK; compare the appearance of the Tux penguin in this file and in the previous example file (RGB).
229</div>
230<br />
231<br />
232
233<!-- ============================================================== -->
234<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">PDF/A and PDF/X files</div>
235
236<div class="rounded text">mPDF can produce files which (attempt to) meet the PDF/A and PDF/X specifications. In addition to restricted colorSpace,
237PDF/A and /X files cannot contain images or colour values with "transparency".
238<br />
239Please note that full compliance with the PDF/A or /X specification is not guaranteed.
240</div>
241
242<!-- ============================================================== -->
243<pagebreak />
244<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">RTL (right-to-left) text</div>
245
246<div class="rounded text"><div>Handling of RTL (right-to-left) languages has been significantly rewritten, and is likely to cause
247changes to the resulting files if you have previously been using mPDF. The changes have made mPDF
248act more like a browser, respecting the HTML/CSS rules.
249Changes include:</div>
250<ul>
251<li>the document now has a baseline direction; this determines the
252 <ul>
253 <li>behaviour of blocks for which text-align has not been specifically set</li>
254 <li>layout of mirrored page-margins, columns, ToC and Indexes, headers / footers</li>
255 <li>base direction can be set by any of:
256 <ul>
257 <li>$mpdf-&gt;SetDirectionality(\'rtl\');</li>
258 <li>&lt;html dir="rtl" or style="direction: rtl;"&gt;</li>
259 <li>&lt;body dir="rtl" or style="direction: rtl;"&gt;</li>
260 </ul></li>
261 <li>base direction is an inherited CSS property, so will affect all content, unless...</li>
262 </ul></li>
263<li>direction can be set for all HTML block elements e.g. &lt;DIV&gt;&lt;P&gt;&lt;TABLE&gt;&lt;UL&gt; etc using
264 <ul>
265 <li>CSS property &lt;style="direction: rtl;"&gt; </li>
266 <li>direction can only be set on the top-level element of nested lists</li>
267 <li>direction can only be set on &lt;TABLE&gt;, NOT on THEAD, TBODY, TD etc.</li>
268 <li>nested tables CAN have different directions</li>
269 </ul></li>
270<li>NOTE that block/table margins/paddings are NOT reversed by direction</li>
271<li>language (either CSS "lang", using Autofont, or through initial set-up e.g. $mpdf = new mPDF(\'ar\') )
272 no longer affects direction in any way.<br />
273 NB config_cp.php has been changed as a result; any values of "dir" set here are now ineffective</li>
274<li>default text-align is now as per CSS spec: "a nameless value which is dependent on direction"<br />
275 NB default text-align removed in default stylesheet in config.php </li>
276<li>once text-align is specified, it is respected and inherited<br />
277 NB mPDF &lt;5.1 reversed the text-align property for all blocks when RTL set.</li>
278<li>the configurable value $rtlcss is depracated, as it is no longer required</li>
279<li>improved algorithm for dtermining text direction
280 <ul>
281 <li>english word blocks are handled in text reversal as one block i.e. dir="rtl"<br />
282 [arabic text] this will not be reversed [arabic text]</li>
283 <li>arabic numerals 0-9 handled correctly</li>
284 </ul></li>
285</ul>
286Although the control of direction for block elements is now more configurable, the control of
287text direction (RTL arabic characters) remains fully automatic and unconfigurable.
288&lt;BDO&gt; etc has no effect. Enclosing text in silent tags can sometimes help e.g.:
289 content&lt;span&gt;[arabic text]&lt;/span&gt;content
290</div>
291
292
293<!-- ============================================================== -->
294<pagebreak />
295<div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">List styles</div>
296<div class="rounded text">Additional numerical list-styles are supported. All of these (except Tamil) are consistent with the draft CSS3 specification:<br />
297<b>list-style</b>: arabic-indic | bengali | devanagari | gujarati | gurmukhi | kannada | malayalam | oriya | persian | telugu | thai | urdu | tamil
298
299</div>
300
301<style>
302ul.arabic { font-family:\'XB Zar\'; text-align: right; direction: rtl; }
303ol.arabic { font-family:\'XB Zar\'; list-style: arabic-indic; text-align: right; direction: rtl; }
304ol.persian { font-family:\'XB Zar\'; list-style: persian; text-align: right; direction: rtl; }
305ol.urdu { font-family:\'XB Zar\'; list-style: urdu; text-align: right; direction: rtl; }
306ol.bengali { font-family: ind_bn_1_001; list-style: bengali; }
307ol.devanagari { font-family: ind_hi_1_001; list-style: devanagari; }
308ol.gujarati { font-family: ind_gu_1_001; list-style: gujarati; }
309ol.gurmukhi { font-family: ind_pa_1_001; list-style: gurmukhi; }
310ol.kannada { font-family: ind_kn_1_001; list-style: kannada; }
311ol.malayalam { font-family: ind_ml_1_001; list-style: malayalam ; }
312ol.oriya { font-family: ind_or_1_001; list-style: oriya ; }
313ol.tamil { font-family: ind_ta_1_001; list-style: tamil ; }
314ol.telugu { font-family: ind_te_1_001; list-style: telugu ; }
315</style>
316
317<ul class="arabic">
318
319
320<li>Arabic
321<ol class="arabic">
322<li>One</li>
323<li>Two</li>
324<li>Three</li>
325<li>Four</li>
326<li>Five</li>
327<li>Six</li>
328</ol>
329</li>
330<li>Persian
331<ol class="persian">
332<li>One</li>
333<li>Two</li>
334<li>Three</li>
335<li>Four</li>
336<li>Five</li>
337<li>Six</li>
338</ol>
339</li>
340<li>Urdu
341<ol class="urdu">
342<li>One</li>
343<li>Two</li>
344<li>Three</li>
345<li>Four</li>
346<li>Five</li>
347<li>Six</li>
348</ol>
349</li>
350
351</ul>
352
353<ul>
354
355<li>Bengali
356<ol class="bengali">
357<li>One</li>
358<li>Two</li>
359<li>Three</li>
360<li>Four</li>
361<li>Five</li>
362</ol>
363</li>
364<li>Devanagari
365<ol class="devanagari">
366<li>One</li>
367<li>Two</li>
368<li>Three</li>
369<li>Four</li>
370<li>Five</li>
371</ol>
372</li>
373<li>Gujarati
374<ol class="gujarati">
375<li>One</li>
376<li>Two</li>
377<li>Three</li>
378<li>Four</li>
379<li>Five</li>
380</ol>
381</li>
382<li>Gurmukhi
383<ol class="gurmukhi">
384<li>One</li>
385<li>Two</li>
386<li>Three</li>
387<li>Four</li>
388<li>Five</li>
389</ol>
390</li>
391<li>Kannada
392<ol class="kannada">
393<li>One</li>
394<li>Two</li>
395<li>Three</li>
396<li>Four</li>
397<li>Five</li>
398</ol>
399</li>
400<li>Malayalam
401<ol class="malayalam">
402<li>One</li>
403<li>Two</li>
404<li>Three</li>
405<li>Four</li>
406<li>Five</li>
407</ol>
408</li>
409<li>Oriya
410<ol class="oriya">
411<li>One</li>
412<li>Two</li>
413<li>Three</li>
414<li>Four</li>
415<li>Five</li>
416</ol>
417</li>
418<li>Tamil
419<ol class="tamil">
420<li>One</li>
421<li>Two</li>
422<li>Three</li>
423<li>Four</li>
424<li>Five</li>
425</ol>
426</li>
427<li>Telugu
428<ol class="telugu">
429<li>One</li>
430<li>Two</li>
431<li>Three</li>
432<li>Four</li>
433<li>Five</li>
434</ol>
435</li>
436
437</ul>
438
439';
440
441//==============================================================
442$mpdf->WriteHTML($html);
443
444//==============================================================
445//==============================================================
446// OUTPUT
447$mpdf->Output(); exit;
448
449
450//==============================================================
451//==============================================================
452//==============================================================
453//==============================================================
454
455
456?> \ No newline at end of file