123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532 |
- <?php
- $html = '
- <head>
- <style>
- table {
- border-collapse: separate;
- border: 4px solid #880000;
- padding: 3px;
- margin: 0px 20px 0px 20px;
- empty-cells: hide;
- background-color:#FFFFCC;
- }
- table.outer2 {
- border-collapse: separate;
- border: 4px solid #088000;
- padding: 3px;
- margin: 10px 0px;
- empty-cells: hide;
- background-color: yellow;
- }
- table.outer2 td {
- font-family: Times;
- }
- table.inner {
- border-collapse: collapse;
- border: 2px solid #000088;
- padding: 3px;
- margin: 5px;
- empty-cells: show;
- background-color:#FFCCFF;
- }
- td {
- border: 1px solid #008800;
- padding: 0px;
- background-color:#ECFFDF;
- }
- table.inner td {
- border: 1px solid #000088;
- padding: 0px;
- font-family: monospace;
- font-style: italic;
- font-weight: bold;
- color: #880000;
- background-color:#FFECDF;
- }
- table.collapsed {
- border-collapse: collapse;
- }
- table.collapsed td {
- background-color:#EDFCFF;
- }
- </style>
- </head>
- <body>
- <h1>mPDF</h1>
- <h2>Tables - Nested</h2>
- <div style="border: 2px solid #000088; background-color: #DDDDFF; padding: 2mm;">
- Text before table
- <div style="border: 2px solid #008888; background-color: #DCAFCF; padding: 2mm;">
- <table cellSpacing="2" rotate="-90" align="center" autosize="1.5">
- <tbody>
- <tr>
- <td>This is data</td>
- <td>This is data</td>
- <td>
- <table cellSpacing="2">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td>B3</td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>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. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id <a href="http://www.dummy.com">euismod auctor</a>, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>This is data</td>
- <td>This is data</td>
- <td>
- <table cellSpacing="2">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td>B3</td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td style="background: transparent url(\'bg.jpg\') repeat scroll right top;" >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. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>This is data</td>
- <td>This is data</td>
- <td>
- <table cellSpacing="2">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td>B3</td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>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. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>This is data</td>
- <td>This is data</td>
- <td>
- <table cellSpacing="2">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td>B3</td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>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. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>This is data</td>
- <td></td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- </tbody></table>
- </div>
- <p>Text before table</p>
- <table cellSpacing="2" class="outer2" autosize="3" style="page-break-inside:avoid">
- <tbody>
- <tr>
- <td>Row 1</td>
- <td>This is data</td>
- <td style="text-align: right;">
- Text before table
- <table cellSpacing="2" class="inner" width="80%">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td>B3</td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>C3</td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- <p>Text after table</p>
- </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>Row 2</td>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>Row 3</td>
- <td style="text-align: center; vertical-align: middle;">
- <table cellSpacing="2" class="inner" width="80%">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td style="text-align:center;"><img src="sunset.jpg" width="84" style="border:3px solid #44FF44; vertical-align:top; " /></td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>
- <table cellSpacing="2">
- <tbody>
- <tr>
- <td>F1</td>
- <td>F2</td>
- </tr>
- <tr>
- <td>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. Morbi feugiat pulvinar dolor. Cras odio. Donec et nulla. Sed quis orci.</td>
- <td>G2</td>
- </tr>
- </tbody></table>
- </td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td style="vertical-align: bottom; ">
- <table cellSpacing="2" class="inner" align="right">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td>B3</td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>C3</td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>Row 4</td>
- <td>This is data</td>
- <td><table cellSpacing="2" class="inner">
- <tbody>
- <tr>
- <td>Row A</td>
- <td>A2</td>
- <td>A3</td>
- <td>A4</td>
- </tr>
- <tr>
- <td>Row B</td>
- <td>B2</td>
- <td style="text-align:center;"><img src="sunset.jpg" width="84" style="border:3px solid #44FF44; vertical-align:top; " /></td>
- <td>B4</td>
- </tr>
- <tr>
- <td>Row C</td>
- <td>C2</td>
- <td>
- <table cellSpacing="2">
- <tbody>
- <tr>
- <td>F1</td>
- <td>F2</td>
- </tr>
- <tr>
- <td>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. Morbi feugiat pulvinar dolor. Cras odio. Donec et nulla. Sed quis orci.</td>
- <td>G2</td>
- </tr>
- </tbody></table>
- </td>
- <td>C4</td>
- </tr>
- <tr>
- <td>Row D</td>
- <td>D2</td>
- <td>D3</td>
- <td>D4</td>
- </tr>
- </tbody></table>
- </td>
- <td>This is data</td>
- </tr>
- </tbody></table>
- </div>
- <p> </p>
- <div style="border: 1px solid #000088; background-color: #DDDDFF; padding: 5mm;">
- Text before table
- <table cellSpacing="2" class="separate">
- <tbody>
- <tr>
- <td style="background-color:#FFCCFF;">Row 1</td>
- <td>This is data</td>
- <td>
- NO NESTING </td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>Row 2</td>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>Row 3</td>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- <tr>
- <td>Row 4</td>
- <td>This is data</td>
- <td>This is data</td>
- <td>This is data</td>
- </tr>
- </tbody></table>
- </div>
- </body>
- ';
- //==============================================================
- //==============================================================
- //==============================================================
- include("../mpdf.php");
- $mpdf=new mPDF('c','A4','','',32,25,27,25,16,13);
- $mpdf->SetDisplayMode('fullpage');
- $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
- // LOAD a stylesheet
- $stylesheet = file_get_contents('mpdfstyletables.css');
- $mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
- $mpdf->WriteHTML($html);
- $mpdf->Output();
- exit;
- ?>
|