example54_new_mPDF_v5-1_features_gradients_and_images.php 24 KB

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