example56_new_mPDF_v5-1_features_grayscale.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <?php
  2. include("../mpdf.php");
  3. $mpdf=new mPDF('');
  4. $mpdf->restrictColorSpace = 1; // forces to grayscale
  5. //==============================================================
  6. $html = '
  7. <style>
  8. body {
  9. font-family: sans-serif;
  10. font-size: 10pt;
  11. }
  12. h4 {
  13. font-variant: small-caps;
  14. }
  15. h5 {
  16. margin-bottom: 0;
  17. color: #110044;
  18. }
  19. p { margin-top: 0; }
  20. dl {
  21. margin: 0;
  22. }
  23. table {
  24. border-spacing: 0.5em;
  25. border: 7px dashed teal;
  26. }
  27. .table1 {
  28. background-image: -moz-linear-gradient(left, #07cdde 20%, #00f200 );
  29. }
  30. .table1 tr.thisrow1 {
  31. background-image-resolution: 300dpi;
  32. background: transparent url(\'bayeux1.jpg\') repeat scroll left top;
  33. }
  34. .table1 tr.thisrow1 td {
  35. height: 28mm;
  36. }
  37. .table1 tr.thisrow2 {
  38. background-image: none;
  39. background: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
  40. 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)));
  41. }
  42. .table3 {
  43. border-collapse: collapse;
  44. /* background-gradient: linear #07cdde #00f200 1 0 0.5 1; */
  45. background: -moz-linear-gradient(left, #07cdde 20%, #00f200 );
  46. }
  47. tr.thisrow {
  48. border: 3px dashed red;
  49. background: transparent url(\'bayeux1.jpg\') repeat scroll left top;
  50. }
  51. .table3 tr.thisrow {
  52. border: 3px dashed orange;
  53. background: transparent url(\'bgrock.jpg\') repeat scroll left top;
  54. }
  55. tfoot tr {
  56. border: 5px dashed blue;
  57. /* background-gradient: linear #c7Fdde #FF0000 1 0 0.5 0; */
  58. background: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
  59. }
  60. .gradient {
  61. border:0.1mm solid #220044;
  62. background-color: #f0f2ff;
  63. background: linear-gradient(top, #c7cdde, #f0f2ff);
  64. }
  65. .rounded {
  66. border:0.1mm solid #220044;
  67. background-color: #f0f2ff;
  68. background: linear-gradient(top, #c7cdde, #f0f2ff);
  69. border-radius: 2mm;
  70. background-clip: border-box;
  71. }
  72. div.text {
  73. padding:1em;
  74. margin: 1em 0;
  75. text-align:justify;
  76. }
  77. .code {
  78. font-family: mono;
  79. font-size: 9pt;
  80. background-color: #d5d5d5;
  81. margin: 1em 1cm;
  82. padding: 0 0.3cm;
  83. }
  84. </style>
  85. <body style="background: -moz-repeating-radial-gradient(rgba(255,0,0,0.1), rgba(0,0,255,0.1) 40px, rgba(255,0,0,0.1) 80px)">
  86. <div style="position:fixed; top: 0; right: 0"><img src="tux.svg" width="110" /></div>
  87. <h1></a>mPDF</h1>
  88. <h2>New features in mPDF Version 5.1</h2>
  89. <div class="rounded text">
  90. <p>This is a copy of Example 54, but all object colours are converted to grayscale using simply:</p>
  91. <p class="code">$mpdf-&gt;restrictColorSpace = 1;</p>
  92. </div>
  93. <div class="rounded text">
  94. <ul>
  95. <li>CSS background (images, colours or gradients) on &lt;TR&gt; and &lt;TABLE&gt;</li>
  96. <li>CSS border on &lt;TR&gt; (only in border-collapsed mode)</li>
  97. <li>support for Mozilla and CSS3 gradient syntax:
  98. <ul>
  99. <li>-moz-linear-gradient, linear-gradient</li>
  100. <li>-moz-radial-gradient, radial-gradient</li>
  101. <li>-moz-repeating-linear-gradient, linear-repeating-gradient</li>
  102. <li>-moz-repeating-radial-gradient, radial-repeating-gradient</li>
  103. </ul>
  104. </li>
  105. <li>expanded support for gradients (including in SVG images):
  106. <ul>
  107. <li>multiple colour \'stops\'</li>
  108. <li>opacity (transparency)</li>
  109. <li>angle and/or position can be specified</li>
  110. </ul>
  111. </li>
  112. <li>etc...</li>
  113. </ul>
  114. </div>
  115. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Tables: borders, background images & gradients</div>
  116. <div class="rounded text">Background images or gradients can be set on whole tables or table rows (as well as individual table cells)</div>
  117. <table class="table1">
  118. <tbody><tr><td>Row 1</td><td>This is data</td><td>This is data</td></tr>
  119. <tr class="thisrow1"><td>This row has</td><td>a background-image</td><td>of the bayeux tapestry</td></tr>
  120. <tr><td><p>Row 3</p></td><td><p>This is long data</p></td><td>This is data</td></tr>
  121. <tr class="thisrow2"><td>This row has</td><td>a gradient set</td><td>which spans all 3 cells</td></tr>
  122. <tr><td>Row 5</td><td>Also data</td><td>Also data</td></tr>
  123. </tbody></table>
  124. <div class="rounded text">Border can be set on table rows (only when border-collapse is set to collapse)</div>
  125. <table class="table3" border="1">
  126. <tbody><tr><td>Row 1</td><td>This is data</td><td>This is data</td></tr>
  127. <tr class="thisrow"><td>Row 2</td><td>This is data<br />This is data<br />This is data<br />This is data</td><td>Also data</td></tr>
  128. <tr><td><p>Row 3</p></td><td><p>This is long data</p></td><td>This is data</td></tr>
  129. </tbody></table>
  130. <!-- ============================================================== -->
  131. <div style="margin-top: 2em; height: 2mm; background-image: -moz-linear-gradient(45deg, red, blue);"> </div>
  132. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Mozilla and CSS3 gradient syntax</div>
  133. <div style="height: 2mm; background-image: -moz-linear-gradient(45deg, red, blue);"> </div>
  134. <h2>Linear gradients</h2>
  135. <h4> Angle set AND points e.g. -moz-linear-gradient(34% 84% 30deg, red, orange, yellow...</h4>
  136. <table style="border-collapse: collapse; repeat scroll left top; border: none;">
  137. <tr>
  138. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(top right 210deg, red, orange, yellow, green, blue, indigo, violet);">top right 210 degrees&nbsp;</td>
  139. <td>&nbsp;</td>
  140. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(top right 210deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  141. </tr>
  142. <tr>
  143. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(30% 80% 60deg, red, orange, yellow, green, blue, indigo, violet);">30% 80% 60 degrees&nbsp;</td>
  144. <td>&nbsp;</td>
  145. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(30% 80% 60deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  146. </tr>
  147. <tr>
  148. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(10px 40px 325deg, red, orange, yellow, green, blue, indigo, violet);">10px 40px 325 degrees&nbsp;</td>
  149. <td>&nbsp;</td>
  150. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(10px 40px 325deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  151. </tr>
  152. <tr>
  153. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(bottom left 135deg, red, orange, yellow, green, blue, indigo, violet);">bottom left 135deg&nbsp;</td>
  154. <td>&nbsp;</td>
  155. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(bottom left 135deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  156. </tr>
  157. </table>
  158. <h4> Points set only e.g. -moz-linear-gradient(bottom left, red, orange, yellow...</h4>
  159. <table style="border-collapse: collapse; repeat scroll left top; border: none;">
  160. <tr>
  161. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(bottom right, red, orange, yellow, green, blue, indigo, violet);">bottom right</td>
  162. <td>&nbsp;</td>
  163. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(bottom right, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  164. </tr>
  165. <tr>
  166. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(top, red, orange, yellow, green, blue, indigo, violet);">top</td>
  167. <td>&nbsp;</td>
  168. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(top, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  169. </tr>
  170. <tr>
  171. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(10px 40px, red, orange, yellow, green, blue, indigo, violet);">10px 40px</td>
  172. <td>&nbsp;</td>
  173. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(10px 40px, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  174. </tr>
  175. <tr>
  176. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(30% 10%, red, orange, yellow, green, blue, indigo, violet);">30% 10%</td>
  177. <td>&nbsp;</td>
  178. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(30% 10%, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  179. </tr>
  180. </table>
  181. <pagebreak />
  182. <h4> Angle set but no points e.g. -moz-linear-gradient(30deg, red, orange, yellow...</h4>
  183. <table style="border-collapse: collapse; repeat scroll left top; border: none;">
  184. <tr>
  185. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet);">90 degrees&nbsp;</td>
  186. <td>&nbsp;</td>
  187. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  188. </tr>
  189. <tr>
  190. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(120deg, red, orange, yellow, green, blue, indigo, violet);">120 degrees&nbsp;</td>
  191. <td>&nbsp;</td>
  192. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(120deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  193. </tr>
  194. <tr>
  195. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(180deg, red, orange, yellow, green, blue, indigo, violet);">180 degrees&nbsp;</td>
  196. <td>&nbsp;</td>
  197. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(180deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  198. </tr>
  199. <tr>
  200. <td style="height: 25mm; width: 135mm; background-image: -moz-linear-gradient(210deg, red, orange, yellow, green, blue, indigo, violet);">210 degrees&nbsp;</td>
  201. <td>&nbsp;</td>
  202. <td style="height: 25mm; width: 10mm; background-image: -moz-linear-gradient(210deg, red, orange, yellow, green, blue, indigo, violet);">&nbsp;</td>
  203. </tr>
  204. </table>
  205. <div class="rounded text">
  206. <p>Linear and radial gradients are not specified in the CSS2 specification. The CSS3 draft specification gives a way of outputting gradients, but currently this is not supported by any browser.</p>
  207. <p>Mozilla (Firefox) has developed its own way of producing gradients, which approximates to the CSS3 draft specification: </p>
  208. <ul>
  209. <li><i>-moz-linear-gradient</i> </li>
  210. <li><i>-moz-repeating-linear-gradient</i></li>
  211. <li><i>-moz-radial-gradient</i> and </li>
  212. <li><i>-moz-repeating-radial-gradient</i></li>
  213. </ul>
  214. <p>WebKit (Safari, Chrome etc.) have a separate way of defining gradients using <i>-webkit-gradient</i></p>
  215. <p>Microsoft (IE) does not support any such method of specifying gradients, but does have a function <i>filter: progid:DXImageTransform.Microsoft.gradient()</i> </p>
  216. <p>When writing HTML for cross-browser compatibility, it is common to see something like this in a stylesheet:</p>
  217. <p class="code">
  218. background: #999999; /* for non-css3 browsers */<br />
  219. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#cccccc\', endColorstr=\'#000000\'); /* for IE */<br />
  220. background: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#000000)); /* for webkit browsers */<br />
  221. background: -moz-linear-gradient(top, #cccccc, #000000); /* for firefox 3.6+ */<br />
  222. </p>
  223. <p>mPDF versions <= 5.0 supported a custom style property <i>background-gradient</i> which accepted both linear and radial gradients. These continue to be supported (and both old and new forms can be used together); note the differences:</p>
  224. <ul>
  225. <li>mPDF background-gradients are output underneath background-images, and both can be specified; whereas the new CSS3/Mozilla-type gradients are defined as a type of background-image</li>
  226. <li>CSS3/Mozilla gradients support multiple colour-stops, opacity, repeating-gradients, and a greater number of options for defining the gradient axis (linear gradients) or shape and extent (radial gradients)</li>
  227. </ul>
  228. <p>mPDF will attempt to parse a CSS stylesheet written for cross-browser compatibility:</p>
  229. <ul>
  230. <li>parse and support <i>-moz</i> type gradients</li>
  231. <li>parse and support CSS3 gradient syntax</li>
  232. <li>ignore <i>-webkit</i> syntax gradients</li>
  233. </ul>
  234. <p>More details can be found at:</p>
  235. <ul>
  236. <li>Mozilla linear - <a href="https://developer.mozilla.org/en/CSS/-moz-linear-gradient">https://developer.mozilla.org/en/CSS/-moz-linear-gradient</a></li>
  237. <li>Mozilla radial - <a href="https://developer.mozilla.org/en/CSS/-moz-radial-gradient">https://developer.mozilla.org/en/CSS/-moz-radial-gradient</a></li>
  238. <li>Mozilla gradients use - <a href="https://developer.mozilla.org/en/Using_gradients">https://developer.mozilla.org/en/Using_gradients</a></li>
  239. <li>CSS3 linear gradients - <a href="http://dev.w3.org/csswg/css3-images/#linear-gradients">http://dev.w3.org/csswg/css3-images/#linear-gradients</a></li>
  240. <li>CSS3 radial gradients - <a href="http://dev.w3.org/csswg/css3-images/#radial-gradients">http://dev.w3.org/csswg/css3-images/#radial-gradients</a></li>
  241. <li>WebKit gradients - <a href="http://webkit.org/blog/175/introducing-css-gradients/">http://webkit.org/blog/175/introducing-css-gradients/</a></li>
  242. </ul>
  243. </div>
  244. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Repeating gradients</div>
  245. <p class="code">
  246. background: repeating-linear-gradient(red, blue 20px, red 40px);
  247. <br /> <br />
  248. background: -moz-repeating-linear-gradient(top left -45deg, red, red 10px, rgba(255,255,255,0) 10px, rgba(255,255,255,0) 20px);
  249. </p>
  250. <div style="float: right; width: 250px; height: 150px; background: -moz-repeating-linear-gradient(top left -45deg, red, red 10px, rgba(255,255,255,0) 10px, rgba(255,255,255,0) 20px);">&nbsp;</div>
  251. <div style="float: left; width: 250px; height: 150px; background: repeating-linear-gradient(red, blue 20px, red 40px);">&nbsp;</div>
  252. <br style="clear: both;" />
  253. <br />
  254. <br />
  255. <p class="code">
  256. background: repeating-radial-gradient(20px 30px, circle farthest-side, red, yellow, green 10px, yellow 15px, red 20px);
  257. <br /> <br />
  258. background: repeating-radial-gradient(red, blue 20px, red 40px);
  259. </p>
  260. <div style="float: right; width: 250px; height: 150px; background: repeating-radial-gradient(red, blue 20px, red 40px);">&nbsp;</div>
  261. <div style="float: left; width: 250px; height: 150px; background: repeating-radial-gradient(20px 30px, circle farthest-side, red, yellow, green 10px, yellow 15px, red 20px);">&nbsp;</div>
  262. <br style="clear: both;" />
  263. <pagebreak />
  264. <h2>Radial gradients</h2>
  265. <div style="float: right; width: 250px; height: 150px; padding: 15px; background: #F56991; color: #E8F3F8;
  266. border-radius: 155px / 100px;
  267. -moz-border-radius: 155px / 100px;
  268. box-shadow: 10px 10px 25px #CCC;
  269. -moz-box-shadow: 5px 5px 25px #CCC;
  270. background-image: -moz-radial-gradient(70% 30%, ellipse , #ffffff 0%, #F56991 50%, #8A2624 100%);">&nbsp;</div>
  271. <div style="float: left; width: 150px; height: 150px; padding: 15px; background: #F56991; color: #E8F3F8;
  272. border-radius: 100px;
  273. -moz-border-radius: 100px;
  274. box-shadow: 10px 10px 25px #CCC;
  275. -moz-box-shadow: 5px 5px 25px #CCC;
  276. background-image: -moz-radial-gradient(70% 30%, circle , #ffffff 0%, #E56991 50%, #8A2624 100%);">&nbsp;</div>
  277. <br style="clear: both;" />
  278. <div style="float: right; width: 150px; height: 150px; border: 0.2mm solid black;
  279. background: radial-gradient(bottom left, farthest-side, red, blue 50px, pink);
  280. background-image: -moz-radial-gradient(red, yellow, #1E90FF);
  281. background: -webkit-gradient(linear, left bottom, left top, color-stop(0.48, rgb(107,14,86)), color-stop(0.74, rgb(140,41,112)), color-stop(0.87, rgb(168,70,146)));">&nbsp;</div>
  282. <div style="float: left; width: 150px; height: 150px; border: 0.2mm solid black; background-image: -moz-radial-gradient(red 5%, yellow 25%, #1E90FF 50%);">&nbsp;</div>
  283. <br style="clear: both;" />
  284. <div style="float: right; width: 300px; height: 150px; border: 0.2mm solid black; background-image: -moz-radial-gradient(bottom left, circle, red, yellow, #1E90FF);">&nbsp;</div>
  285. <div style="float: left; width: 300px; height: 150px; border: 0.2mm solid black; background-image: -moz-radial-gradient(bottom left, ellipse, red, yellow, #1E90FF);">&nbsp;</div>
  286. <br style="clear: both;" />
  287. <div style="float: right; width: 300px; height: 150px; border: 0.2mm solid black; background-image: -moz-radial-gradient(ellipse closest-side, red, yellow 10%, #1E90FF 50%, white);">&nbsp;</div>
  288. <div style="float: left; width: 300px; height: 150px; border: 0.2mm solid black; background-image: -moz-radial-gradient(ellipse farthest-corner, red, yellow 10%, #1E90FF 50%, white);">&nbsp;</div>
  289. <br style="clear: both;" />
  290. <p style="background-image: -moz-radial-gradient(center , red, orange, yellow, green, blue, indigo, violet);">&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;</p>
  291. <p style="background-image: -moz-radial-gradient(center , circle closest-side, blue 0%, red 100%);">&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;</p>
  292. <pagebreak />
  293. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Gradient Image mask</div>
  294. <div class="rounded text">Gradients (linear or radial) can also be used to produce \'masks\' for images. The same syntax is used as for background gradients (e.g. -moz-linear-gradient) but is set using a custom mPDF style: <i>gradient-mask</i>. The rgba() method for defining colours is used: colours are ignored, but the opacity value is used to mask the image.</div>
  295. <p class="code">&lt;img src="windmill.jpg" style="gradient-mask: -moz-radial-gradient(center, ellipse closest-side, rgba(255,255,255,1), rgba(255,255,255,1) 30%, rgba(255,255,255,0) 90%, rgba(255,255,255,0));" /&gt;
  296. <br /><br />&lt;img src="windmill.jpg" style="gradient-mask: -moz-radial-gradient(center, ellipse closest-side, rgba(255,255,255,1), rgba(255,255,255,1) 70%, rgba(255,255,255,0) 90%, rgba(255,255,255,0));" /&gt;
  297. <br /><br />&lt;img src="windmill.jpg" style="gradient-mask: -moz-linear-gradient(left, rgba(0,0,0,0) , rgba(0,0,0,1) 50% , rgba(0,0,0,0) 100%);" /&gt;
  298. </p>
  299. <img src="windmill.jpg" style="gradient-mask: -moz-radial-gradient(center, ellipse closest-side, rgba(255,255,255,1), rgba(255,255,255,1) 30%, rgba(255,255,255,0) 90%, rgba(255,255,255,0));" />
  300. <img src="windmill.jpg" style="gradient-mask: -moz-radial-gradient(center, ellipse closest-side, rgba(255,255,255,1), rgba(255,255,255,1) 70%, rgba(255,255,255,0) 90%, rgba(255,255,255,0));" />
  301. <img src="windmill.jpg" style="gradient-mask: -moz-linear-gradient(left, rgba(0,0,0,0) , rgba(0,0,0,1) 50% , rgba(0,0,0,0) 100%);" />
  302. <br />
  303. <pagebreak />
  304. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Image orientation</div>
  305. <div class="rounded text">Images can be rotated using a custom mPDF HTML attribute: rotate. mPDF now also supports the draft CSS3 property of image-orientation. Rotation can be expressed in degrees, radians or grad units; it is corrected if necessary to an orthogonal rotation i.e. 90, 180 or 270 degrees. NB This does not work on background-images.</div>
  306. <p class="code">&lt;img src="tiger2.png" style="image-orientation: -90deg" width="100" /&gt;
  307. <br />
  308. &lt;img src="tiger2.png" style="image-orientation: 3.14159rad" width="100" /&gt;
  309. </p>
  310. <img src="tiger2.png" width="100" />
  311. <img src="tiger2.png" style="image-orientation: 75deg;" width="100" />
  312. <img src="tiger2.png" style="image-orientation: 180deg; image-resolution: 300dpi; " width="100" />
  313. <img src="tiger2.png" style="image-orientation: -90deg" width="100" />
  314. <br />
  315. <br />
  316. <br />
  317. <br />
  318. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Image resolution</div>
  319. <div class="rounded text">Image files (which do not have an output width or height specified) are displayed in mPDF at the default resolution set by the variable $mpdf->img_dpi. This can be overridden using the draft CSS3 property \'image-resolution\', which can be applied to &lt;IMG&gt; or background-images.
  320. <br />
  321. The next 3 image files are identical (300px x 300px) but they have been saved with a different specified resolution: the first at 96dpi, the second at 300dpi.
  322. <br />
  323. NB When used in combination with \'from-image\', a specified resolution is only used if the image does not have an intrinsic resolution. Only JPG, PNG and BMP files store a specified DPI resolution in the file.</div>
  324. <p class="code">&lt;img src="tiger300px300dpi.png" style="image-resolution: from-image;" /&gt;
  325. <br />&lt;img src="tiger300px300dpi.png" style="image-resolution: 150dpi;" /&gt;
  326. <br />&lt;img src="tiger300px96dpi.png" style="image-resolution: from-image;" /&gt;</p>
  327. <img src="tiger300px300dpi.png" style="image-resolution: from-image;" />
  328. <img src="tiger300px300dpi.png" style="image-resolution: 150dpi;" />
  329. <img src="tiger300px96dpi.png" style="image-resolution: from-image;" />
  330. <br /> <br />
  331. <pagebreak />
  332. <div class="rounded text">Image resolution can also be applied to a background-image. This can be used as an alternative to the custom mPDF style property - \'background-image-resize\'</div>
  333. <p class="code">&lt;div height="300px" width="300px" style="background: #FFCCEE url(tiger300px96dpi.png); background-image-resolution: from-image; border: 0.2mm solid black;"&gt;</p>
  334. <div height="300px" width="300px" style="background: #FFCCEE url(tiger300px96dpi.png); background-image-resolution: from-image; border: 0.2mm solid black;">Hallo<br />world
  335. </div>
  336. <br />
  337. <p class="code">&lt;div height="300px" width="300px" style="background-image: url(tiger300px300dpi.png); background-image-resolution: from-image; border: 0.2mm solid black;"&gt;</p>
  338. <div height="300px" width="300px" style="background-image: url(tiger300px300dpi.png); background-image-resolution: from-image; border: 0.2mm solid black;">
  339. </div>
  340. <br />
  341. <pagebreak />
  342. <div style="font-family: Arial; font-size: 18pt; color: rgb(49,124,209)">Mixed effects</div>
  343. <div style="padding: 15px; background: url(flowers-pattern.jpg) repeat right; border-radius: 90px;background-color: #00f200 ; ">
  344. <div style="padding: 15px; background: -moz-linear-gradient(top right, red, orange, yellow, green, blue, indigo, violet); border-radius: 75px; ">
  345. <div style="padding: 15px; background-gradient: linear #07cdde #00f200 0 0 0.5 1; border-radius: 60px; ">
  346. <div style="padding: 15px; background: url(flowers-pattern.jpg) repeat right; border-radius: 45px; background-image-resolution: 180dpi; ">
  347. <div style="padding: 15px; background: -moz-linear-gradient(left, red, orange, yellow, green, blue, indigo, violet); border-radius: 30px; ">
  348. <div style="padding: 15px; background: url(alpha3.png) repeat top left; border-radius: 15px; background-image-resolution: 180dpi; ">
  349. Hallo World
  350. </div>
  351. <div style="padding: 15px; background: url(alpha3.png) repeat top left; border-radius: 15px; background-image-resolution: 360dpi; ">
  352. Hallo World
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. </div>
  358. </div>
  359. <br />
  360. <div style="background-color:#FF0000 ; width:180px; background-image: -moz-radial-gradient(center, ellipse closest-side, rgba(255,255,255,1), rgba(255,255,255,1) 70%, rgba(255,255,255,0) 90%, rgba(255,255,255,0));">
  361. <img src="tux.svg" width="180" />
  362. </div>
  363. ';
  364. //==============================================================
  365. if ($_REQUEST['html']) { echo $html; exit; }
  366. if ($_REQUEST['source']) {
  367. $file = __FILE__;
  368. header("Content-Type: text/plain");
  369. header("Content-Length: ". filesize($file));
  370. header("Content-Disposition: attachment; filename='".$file."'");
  371. readfile($file);
  372. exit;
  373. }
  374. //==============================================================
  375. $mpdf->WriteHTML($html);
  376. //==============================================================
  377. //==============================================================
  378. // OUTPUT
  379. $mpdf->Output(); exit;
  380. //==============================================================
  381. //==============================================================
  382. //==============================================================
  383. //==============================================================
  384. ?>