example58_new_mPDF_v5-4_features.php 19 KB

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