example52_new_mPDF_4-2_features.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <?php
  2. ini_set("memory_limit","256M");
  3. $html = '
  4. <style>
  5. body {
  6. font-family: sans-serif;
  7. }
  8. @page {
  9. margin-top: 2.0cm;
  10. margin-bottom: 2.0cm;
  11. margin-left: 2.3cm;
  12. margin-right: 1.7cm;
  13. margin-header: 8mm;
  14. margin-footer: 8mm;
  15. footer: html_myHTMLFooter;
  16. background-color:#ffffff;
  17. }
  18. @page :first {
  19. margin-top: 6.5cm;
  20. margin-bottom: 2cm;
  21. header: html_myHTMLHeader;
  22. footer: _blank;
  23. resetpagenum: 1;
  24. background-gradient: linear #FFFFFF #FFFF44 0 0.5 1 0.5;
  25. background: #ccffff url(bgbarcode.png) repeat-y fixed left top;
  26. }
  27. @page letterhead {
  28. margin-top: 2.0cm;
  29. margin-bottom: 2.0cm;
  30. margin-left: 2.3cm;
  31. margin-right: 1.7cm;
  32. margin-header: 8mm;
  33. margin-footer: 8mm;
  34. footer: html_myHTMLFooter;
  35. background-color:#ffffff;
  36. }
  37. @page letterhead :first {
  38. margin-top: 6.5cm;
  39. margin-bottom: 2cm;
  40. header: html_myHTMLHeader;
  41. footer: _blank;
  42. resetpagenum: 1;
  43. }
  44. .gradient {
  45. border:0.1mm solid #220044;
  46. background-color: #f0f2ff;
  47. background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
  48. }
  49. .rounded {
  50. border:0.1mm solid #220044;
  51. background-color: #f0f2ff;
  52. background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
  53. border-radius: 2mm;
  54. background-clip: border-box;
  55. }
  56. h4 {
  57. font-weight: bold;
  58. margin-top: 1em;
  59. margin-bottom: 0.3em;
  60. }
  61. div.text {
  62. padding:1em;
  63. margin-bottom: 0.25em;
  64. text-align:justify;
  65. }
  66. div.artificial {
  67. font-family: arialuni; /* custom font using MS Arial Unicode */
  68. }
  69. p { margin-top: 0; }
  70. .code {
  71. font-family: mono;
  72. font-size: 9pt;
  73. background-color: #d5d5d5;
  74. margin: 1em 1cm;
  75. padding: 0 0.3cm;
  76. }
  77. </style>
  78. <body>
  79. <!--mpdf
  80. <htmlpageheader name="myHTMLHeader">
  81. <div style="float:right; width: 90; height: 90; text-align: right; vertical-align: bottom; border: 1mm double #000088"><img src="tiger.png" width="90" /></div>
  82. <div style="color:#0000BB;"><span style="font-weight: bold; font-size: 14pt;">mPDF Version 4.2</span><br />123 Anystreet<br />Your City<br />GD12 4LP<br /><span style="font-size: 15pt;">&#x260e;</span> 01777 123 567
  83. </div>
  84. <div style="clear: both; margin-top: 1cm; text-align: right;">{DATE jS F Y}</div>
  85. </htmlpageheader>
  86. <htmlpagefooter name="myHTMLFooter">
  87. <table width="100%" style="border-top: 0.1mm solid #000000; vertical-align: top; font-size: 9pt; color: #000055;"><tr>
  88. <td width="25%"></td>
  89. <td width="50%" align="center">See <a href="http://mpdf1.com/manual/index.php">documentation manual</a> for further details</td>
  90. <td width="25%" align="right">Page {PAGENO} of {nbpg} pages</td>
  91. </tr></table>
  92. </htmlpagefooter>
  93. mpdf-->
  94. <h2>mPDF Version 4.2</h2>
  95. <h2>New Features</h2>
  96. <div class="gradient text">
  97. <ul>
  98. <li>image handling improved</li>
  99. <li>table layout - additional control over resizing</li>
  100. <li>vertical-alignment of images - better support for all CSS types</li>
  101. <li>top and bottom margins collapse between block elements</li>
  102. <li>improved support for CSS line-height</li>
  103. <li>display progress bar whilst generating file</li>
  104. <li>CSS @page selector can be specified when adding a pagebreak</li>
  105. <li>CSS @page selector allows different margins, backgrounds, headers/footers on :first :left and :right pages</li>
  106. <li>PNG images with alpha channel fully supported</li>
  107. <li>ability to generate italic and bold font variants from base font file</li>
  108. <li>CJK fonts to embed as subsets</li>
  109. <li>"double" border on block elements</li>
  110. <li>character substitution for missing characters in UTF-8 fonts</li>
  111. <li>direct passing of dynamically produced image data</li>
  112. <li>background-gradient and background-image can now co-exist </li>
  113. </ul>
  114. Note: automatic top- and bottom-margin to accomodate varying header/footer size was introduced in v4.0 but was not highlighted cf. AutoHeaderMargin in the Manual.
  115. </div>
  116. <br />
  117. <div class="gradient text">
  118. <h4>Page backgrounds</h4>
  119. Background images, gradients and/or colours can be used together on the same page. On this page, the bars on the left hand side are created using a background-image, whilst a background-gradient sets the background to the whole page.
  120. </div>
  121. <br />
  122. <div class="gradient text" style="background-color: #d9def0; border-style: double; border-color:#444444; border-width:1mm;">
  123. <h4>CSS "double" border</h4>
  124. Block elements can now use the CSS property: border(style) = double. See also the tiger logo in the header of this page.
  125. </div>
  126. <br />
  127. <div class="gradient text">
  128. <h4>CJK fonts to embed as subsets</h4>
  129. When writing documents with Chinese, Japanese or Korean characters, mPDF has previously required the end-user to download Adobe\'s free CJK font pack.
  130. The ability to embed font subsets now makes it feasible to use open license CJK fonts. 2 fonts are now available to download as an additional font-pack:
  131. <ul>
  132. <li>zn_hannom_a - contains all characters in the SJIS, BIG-5, and GBK codepages; original file was Han Nom A font (Hi-res version) from http://vietunicode.sourceforge.net/fonts/fonts_hannom.html</li>
  133. <li>unbatang_0613 - contains all the (Korean) characters in the UHC codepage; original file from from http://kldp.net/projects/unfonts/download</li>
  134. </ul>
  135. The following characters only added an extra 15kB to the size of this PDF file, and approximately 0.15 seconds extra to compile:<br />
  136. Chinese (traditional) <span style="font-family:zn_hannom_a">'."\xe6\x86\x82\xe9\xac\xb1".'</span> ; chinese (simplified) <span style="font-family:zn_hannom_a">'."\xe6\x9d\xa5\xe8\x87\xaa".'</span> ; japanese <span style="font-family:zn_hannom_a">'."\xe3\x81\x9f\xe3\x82\x90".'</span> ; korean <span style="font-family:unBatang_0613">'."\xed\x82\xa4\xec\x8a\xa4".'</span>
  137. </div>
  138. <br />
  139. <div class="artificial gradient text">
  140. <h4>Artificial Bold and Italic</h4>
  141. The text in this block is in ArialUnicodeMS font. Using embedded subsets it covers most characters you want to print - BUT it does not have bold, italic, or bold-italic forms.<br />
  142. From version 4.2, mPDF will create "artificial" font styles if they are not available as separate font files:<br />
  143. <p style="font-weight: bold">The quick brown fox jumps over a lazy dog</p>
  144. <p style="font-style: italic">The quick brown fox jumps over a lazy dog</p>
  145. <p style="font-weight: bold; font-style: italic">The quick brown fox jumps over a lazy dog</p>
  146. </div>
  147. <br />
  148. <div class="gradient text" style="font-family: \'Trebuchet MS\'">
  149. <h4>Character substitution in UTF-8 files</h4>
  150. This paragraph has the font-family set to Trebuchet MS, and the document has the default font set as DejaVuSansCondensed.
  151. The following characters are not present in the Trebuchet font, and are substituted from the core Adobe Zapfdingbats font:<br />
  152. &#x2710; &#x2711; &#x2712; &#x2713; &#x2714; &#x2715; &#x2716; &#x2717; &#x2718; &#x2719; &#x271a; &#x271b; &#x271c; &#x271d; &#x271e; &#x271f;<br />
  153. The characters are not present in the Trebuchet font, and are substituted from the (default) DejaVuSansCondensed font:<br />
  154. &#x280; &#x281; &#x282; &#x283; &#x284; &#x285; &#x286; &#x287; &#x288; &#x289; &#x28a; &#x28b; &#x28c; &#x28d; &#x28e; &#x28f;<br />
  155. Character substitution in UTF-8 files is enabled by setting:
  156. <p class="code">
  157. $mpdf->useSubstitutionsMB = true;
  158. </p>
  159. <div style="color:red; padding:0; margin:0;">NB In mPDF 5.0 this has changed to
  160. <p class="code" style="padding:0; margin:0;">
  161. $mpdf->useSubstitutions = true;
  162. </p>
  163. </div>
  164. It is not recommended to enable this for regular use, as it will add to the processing time.
  165. </div>
  166. <pagebreak />
  167. <h2>Margin-collapse</h2>
  168. <p>mPDF has always allowed margins to be collapsed at the top and bottom of pages. This is specified by the custom CSS property "margin-collapse: collapse"</p>
  169. <p>mPDF 4.2 also allows margins to collapse between block elements on the page. This is the default behaviour in browsers, and has been enabled in mPDF 4.2 by default.</p>
  170. <p>In the next 2 paragraphs, the first one has the margin-bottom set to 3em, and the second has the margin-top set to 0em. So the vertical-space between paragraphs is 3em:</p>
  171. <p class="gradient" style="font-size: 10pt; padding: 0 0.3em; margin-bottom: 3em;">The quick brown fox jumps over a lazy dog</p>
  172. <p class="gradient" style="font-size: 10pt; padding: 0 0.3em; margin-top: 0em;">The quick brown fox jumps over a lazy dog</p>
  173. <p>In the next 2 paragraphs, the first one has the margin-bottom set to 2em, and the second has the margin-top set to 1em. The margins collapse to the larger of the adjoining margins i.e. 2em:</p>
  174. <p class="gradient" style="font-size: 10pt; padding: 0 0.3em; margin-bottom: 2em;">The quick brown fox jumps over a lazy dog</p>
  175. <p class="gradient" style="font-size: 10pt; padding: 0 0.3em; margin-top: 1em;">The quick brown fox jumps over a lazy dog</p>
  176. <pagebreak />
  177. <h2>Images</h2>
  178. <h4>PNG Alpha channel</h4>
  179. PNG alpha channel transparency is now fully supported, and works against solid backgrounds, gradients or background images:
  180. <table>
  181. <tr>
  182. <td><img style="vertical-align: top" src="alpha.png" width="90" /></td>
  183. <td style="background-color:#FFCCFF; "><img style="vertical-align: top" src="alpha.png" width="90" /></td>
  184. <td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="alpha.png" width="90" /></td>
  185. <td style="background-color:#CCFFFF; background-gradient: linear #88FFFF #FFFF44 0 0.5 1 0.5; "><img style="vertical-align: top" src="alpha.png" width="90" /></td>
  186. <td style="background-color:#CCFFFF; background: transparent url(\'bgrock.jpg\') repeat scroll right top;"><img style="vertical-align: top" src="alpha.png" width="90" /></td>
  187. </tr>
  188. </table>
  189. <br />
  190. <h4>Image Border and padding</h4>
  191. Image padding is now supported as well as border and margin:
  192. <img src="sunset.jpg" width="100" style="border:3px solid #44FF44; padding: 1em; vertical-align: text-top; " />
  193. <br />
  194. <h4>Vertical alignment</h4>
  195. <div>From mPDF version 4.2 onwards, most of the values for "vertical-align" are supported: top, bottom, middle, baseline, text-top, and text-bottom.<br />
  196. <b>Note:</b> The default value for vertical alignment has been changed to baseline, and the default padding to 0, consistent with most browsers.
  197. </div>
  198. <br />
  199. <div class="gradient" style="font-size: 80%;">
  200. baseline: <img src="sunset.jpg" width="50" style="vertical-align: baseline;" />
  201. text-bottom: <img src="sunset.jpg" width="30" style="vertical-align: text-bottom;" />
  202. middle: <img src="sunset.jpg" width="30" style="vertical-align: middle;" />
  203. bottom: <img src="sunset.jpg" width="80" style="vertical-align: bottom;" />
  204. text-top: <img src="sunset.jpg" width="50" style="vertical-align: text-top;" />
  205. top: <img src="sunset.jpg" width="100" style="vertical-align: top;" />
  206. </div>
  207. <pagebreak />
  208. <h4>Image Alignment</h4>
  209. <div>From mPDF version 4.2 onwards, in-line images can be individually aligned (vertically).
  210. </div>
  211. <div class="gradient" style="margin: 0.5em 0;">
  212. These images <img src="img1.png" style="vertical-align: top;" />
  213. are <img src="img2.png" style="vertical-align: top;" />
  214. <b>top</b> <img src="img3.png" style="vertical-align: top;" />
  215. aligned <img src="img4.png" style="vertical-align: middle;" />
  216. </div>
  217. <div class="gradient" style="margin: 0.5em 0;">
  218. These images <img src="img1.png" style="vertical-align: text-top;" />
  219. are <img src="img2.png" style="vertical-align: text-top;" />
  220. <b>text-top</b> <img src="img3.png" style="vertical-align: text-top;" />
  221. aligned <img src="img4.png" style="vertical-align: middle;" />
  222. </div>
  223. <div class="gradient" style="margin: 0.5em 0;">
  224. These images <img src="img1.png" style="vertical-align: bottom;" />
  225. are <img src="img2.png" style="vertical-align: bottom;" />
  226. <b>bottom</b> <img src="img3.png" style="vertical-align: bottom;" />
  227. aligned <img src="img4.png" style="vertical-align: middle;" />
  228. </div>
  229. <div class="gradient" style="margin: 0.5em 0;">
  230. These images <img src="img1.png" style="vertical-align: text-bottom;" />
  231. are <img src="img2.png" style="vertical-align: text-bottom;" />
  232. <b>text-bottom</b> <img src="img3.png" style="vertical-align: text-bottom;" />
  233. aligned <img src="img4.png" style="vertical-align: middle;" />
  234. </div>
  235. <div class="gradient" style="margin: 0.5em 0;">
  236. These images <img src="img1.png" style="vertical-align: baseline;" />
  237. are <img src="img2.png" style="vertical-align: baseline;" />
  238. <b>baseline</b> <img src="img3.png" style="vertical-align: baseline;" />
  239. aligned <img src="img4.png" style="vertical-align: middle;" />
  240. </div>
  241. <div class="gradient" style="margin: 0.5em 0;">
  242. These images <img src="img1.png" style="vertical-align: middle;" />
  243. are <img src="img2.png" style="vertical-align: middle;" />
  244. <b>middle</b> <img src="img3.png" style="vertical-align: middle;" />
  245. aligned <img src="img5.png" style="vertical-align: bottom;" />
  246. </div>
  247. <pagebreak />
  248. <h4>Images from PHP</h4>
  249. <br />
  250. <img src="var:smileyface" />
  251. <br />
  252. This image was created with the following code:
  253. <p class="code">
  254. $img = imagecreatetruecolor(200, 200);<br />
  255. $white = imagecolorallocate($img, 255, 255, 255);<br />
  256. $red = imagecolorallocate($img, 255, 0, 0);<br />
  257. $green = imagecolorallocate($img, 0, 255, 0);<br />
  258. $blue = imagecolorallocate($img, 0, 0, 255);<br />
  259. imagearc($img, 100, 100, 200, 200, 0, 360, $white);<br />
  260. imagearc($img, 100, 100, 150, 150, 25, 155, $red);<br />
  261. imagearc($img, 60, 75, 50, 50, 0, 360, $green);<br />
  262. imagearc($img, 140, 75, 50, 50, 0, 360, $blue);<br />
  263. ob_start();<br />
  264. imagejpeg($img);<br />
  265. $mpdf->smileyface = ob_get_clean(); <br />
  266. imagedestroy($img);<br />
  267. </p>
  268. and written to the document using:
  269. <p class="code">
  270. &lt;img src="var:smileyface" /&gt;
  271. </p>
  272. <pagebreak>
  273. <h4>Line-height inheritance</h4>
  274. Line-height inheritance has been altered to follow the CSS2 recommendation:
  275. <ul>
  276. <li>normal is inherited as "normal"</li>
  277. <li>1.2 is inherited as a factor</li>
  278. <li>120% is converted to an actual value and then inherited as the computed value</li>
  279. <li>em is converted to an actual value and then inherited as the computed value</li>
  280. <li>px pt mm are inherited as fixed values</li>
  281. </ul>
  282. <div>Relative values (e.g. 1.3, normal)</div>
  283. <div style="font-size: 12pt; line-height: 2.0; border: 0.2mm solid #880000; background-color: #FFEECC; padding: 0.3em;">
  284. This DIV has the line-height set as "2.0" and font-size as 12pt. The line-height is therefore 24pt, but the factor of 2 is inherited...<br />
  285. Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse...
  286. <div style="font-size: 8pt; border: 0.2mm solid #880000; background-color: #FFEECC; padding: 0.3em;">
  287. This DIV has the font-size set as 8pt. The line-height of 2 is inherited...<br />
  288. 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. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci.
  289. <div style="font-size: 18pt; border: 0.2mm solid #880000; background-color: #FFEECC; padding: 0.3em;">
  290. This DIV has the font-size set as 18pt. The line-height of 2 is inherited...<br />
  291. Nulla felis erat, imperdiet eu, ullamcorper non...
  292. </div>
  293. </div>
  294. </div>
  295. <br />
  296. <div>Absolute values (e.g. 130%, 1.3em, 18pt)</div>
  297. <div style="font-size: 12pt; line-height: 200%; border: 0.2mm solid #880000; background-color: #FFEECC; padding: 0.3em;">
  298. This DIV has the line-height set as "200%" and font-size as 12pt. The computed line-height of 24pt is inherited...<br />
  299. Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse...
  300. <div style="font-size: 8pt; border: 0.2mm solid #880000; background-color: #FFEECC; padding: 0.3em;">
  301. This DIV has the font-size set as 8pt. The computed line-height of 24pt is inherited...<br />
  302. 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. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci.
  303. <div style="font-size: 18pt; border: 0.2mm solid #880000; background-color: #FFEECC; padding: 0.3em;">
  304. This DIV has the font-size set as 18pt. The computed line-height of 24pt is inherited...<br />
  305. Nulla felis erat, imperdiet eu, ullamcorper non...
  306. </div>
  307. </div>
  308. </div>
  309. <pagebreak />
  310. <h4>Line-height & vertical alignment</h4>
  311. <div>In these examples, top and bottom padding are set to 0, so the block height = line height.</div>
  312. <div>The inline text (set to a larger font-size) inherits the line-height as a factor of the largest font-size i.e. the line height will expand to reflect the largest font on the line.<br />
  313. Line-height: "normal" (set in mPDF by default as 1.33).</div>
  314. <p class="gradient" style="font-size: 10pt; line-height: normal; padding: 0 0.3em;">Normal text <span style="font-size: 16pt;">16pt font-size &#194;</span> and normal again</p>
  315. <div>Line-height: 2.0 When using relative line-heights, the text is aligned vertically so that the centre-line of the line goes throught the middle of the largest font.</div>
  316. <p class="gradient" style="font-size: 10pt; line-height: 2.0; padding: 0 0.3em;">Normal text <span style="font-size: 16pt;">16pt font-size &#194;</span> and normal again</p>
  317. <div>Line-heights set as a percentages are computed on the base font-size, and are then inherited and treated the same as absolute lengths. This is also true for "em" values. The line-height of this line is set as 200% of the paragraph font-size (10pt).<br />
  318. When using absolute line-heights, the text is aligned vertically so that the centre-line of the line goes throught the middle of the base font.<br />
  319. This means that as far as possible, multiple lines will remain equally spaced<br />
  320. Line-height: 200% </div>
  321. <p class="gradient" style="font-size: 10pt; line-height: 200%; padding: 0 0.3em;">Normal text <span style="font-size: 16pt;">16pt font-size &#194;</span> and normal again</p>
  322. <div>If the line includes a font-size greater than 1.6 times the computed line-height, then the text baseline is dropped so that the text will approximately fit within the line-height.
  323. <br />Line-height: 2em</div>
  324. <p class="gradient" style="font-size: 10pt; line-height: 2em; padding: 0 0.3em;">Normal text <span style="font-size: 18pt;">18pt font-size &#194;</span> and normal again</p>
  325. <div>If the line includes a font-size greater than 2 times the computed line-height, then the line-height is increased to accommodate the larger fontsize.<br />
  326. Line-height: 2em</div>
  327. <p class="gradient" style="font-size: 10pt; line-height: 2em; padding: 0 0.3em;">Normal text <span style="font-size: 24pt;">24pt font-size &#194;</span> and normal again</p>
  328. <br />
  329. This broadly reflects the behaviour of IE and Firefox. Note that tall characters such as &#194; may fall outside the computed line-heights. See the same in an <a href="example52_lineheight.htm">HTML page</a>.
  330. <pagebreak page-selector="letterhead" />
  331. <h2>Extended use of CSS @page selectors</h2>
  332. The CSS @page selector, together with the pseudo-selectors :first :left :right have increased support in mPDF 4.2<br />
  333. A named @page can be selected when forcing a new page, e.g. this page was started with:<br />
  334. <span style="font-family: mono; font-size: 9pt;">&lt;pagebreak page-selector="letterhead" /&gt;</span>
  335. <br />
  336. The header and background on this page (and page 1 of the document) are set by the CSS selector: @page letterhead :first {} whilst subsequent pages have no header, a footer, and no background.
  337. <br />
  338. CSS @page selectors allow different margins, backgrounds, headers/footers to be set on :first :left and :right pages. Only fixed or mirrored left- and right-margins are supported (i.e. cannot specify different margins for :left and :right).
  339. <br />
  340. This layout can be used to produce company letters with only the first page on letterheaded paper.
  341. <pagebreak />
  342. <h2>Table Layout control</h2>
  343. <p>mPDF attempts to layout tables according to HTML and CSS specifications. However, because of the difference between screen and paged media, mPDF resizes tables when necessary to make them fit the page. This will happen if the minimum table-width is greater than the page-width. Minimum table-width is defined as the minimum width to accomodate the longest word in each column i.e. words will never be split.
  344. </p>
  345. <p>This resizing (minimum-width) can be disabled using a custom CSS property "overflow" on the TABLE tag. There are 4 options:</p>
  346. &lt;table style="overflow: auto"&gt; (this is the default, using resizing)
  347. <table border="1" style="overflow: auto; border-collapse: collapse; padding: 0.1em; background-color: #DDFFFF"><tr>
  348. <td>Verylongwordwithnospacesinitatall</td>
  349. <td>Verylongwordwithnospacesinitatall</td>
  350. <td>Verylongwordwithnospacesinitatall</td>
  351. </tr></table>
  352. <br />
  353. &lt;table style="overflow: visible"&gt; (disables resizing, but allows overflow to show)
  354. <table border="1" style="overflow: visible; border-collapse: collapse; padding: 0.1em; background-color: #DDFFFF"><tr>
  355. <td>Verylongwordwithnospacesinitatall</td>
  356. <td>Verylongwordwithnospacesinitatall</td>
  357. <td>Verylongwordwithnospacesinitatall</td>
  358. </tr></table>
  359. <br />
  360. &lt;table style="overflow: hidden"&gt; (disables resizing, and hides/clips any overflow)
  361. <table border="1" style="overflow: hidden; border-collapse: collapse; padding: 0.1em; background-color: #DDFFFF"><tr>
  362. <td>Verylongwordwithnospacesinitatall</td>
  363. <td>Verylongwordwithnospacesinitatall</td>
  364. <td>Verylongwordwithnospacesinitatall</td>
  365. </tr></table>
  366. <br />
  367. &lt;table style="overflow: wrap"&gt; (forces words to break as necessary)
  368. <table border="1" style="overflow: wrap; border-collapse: collapse; padding: 0.1em; background-color: #DDFFFF"><tr>
  369. <td>Verylongwordwithnospacesinitatall</td>
  370. <td>Verylongwordwithnospacesinitatall</td>
  371. <td>Verylongwordwithnospacesinitatall</td>
  372. </tr></table>
  373. <br />
  374. ';
  375. if ($_REQUEST['html']) { echo $html; exit; }
  376. //==============================================================
  377. //==============================================================
  378. //==============================================================
  379. define('_MPDF_URI','../'); // required for the progress bar
  380. include("../mpdf.php");
  381. $mpdf=new mPDF('','A4','','',15,15,20,20,5,5);
  382. $mpdf->StartProgressBarOutput(2); // 2 => advanced mode
  383. $mpdf->SetDisplayMode('fullpage');
  384. $mpdf->useSubstitutions = true;
  385. // Dynamically create image in var:smileyface
  386. $img = imagecreatetruecolor(200, 200);
  387. $white = imagecolorallocate($img, 255, 255, 255);
  388. $red = imagecolorallocate($img, 255, 0, 0);
  389. $green = imagecolorallocate($img, 0, 255, 0);
  390. $blue = imagecolorallocate($img, 0, 0, 255);
  391. imagearc($img, 100, 100, 200, 200, 0, 360, $white);
  392. imagearc($img, 100, 100, 150, 150, 25, 155, $red);
  393. imagearc($img, 60, 75, 50, 50, 0, 360, $green);
  394. imagearc($img, 140, 75, 50, 50, 0, 360, $blue);
  395. ob_start();
  396. imagejpeg($img);
  397. $mpdf->smileyface = ob_get_clean();
  398. imagedestroy($img);
  399. $mpdf->WriteHTML($html);
  400. $mpdf->Output();
  401. exit;
  402. //==============================================================
  403. //==============================================================
  404. //==============================================================
  405. //==============================================================
  406. ?>