123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- <?php
- $html = '
- <html><head>
- <style>
- table {
- font-family: sans-serif;
- border: 7mm solid aqua;
- border-collapse: collapse;
- }
- table.table2 {
- border: 2mm solid aqua;
- border-collapse: collapse;
- }
- table.layout {
- border: 0mm solid black;
- border-collapse: collapse;
- }
- td.layout {
- text-align: center;
- border: 0mm solid black;
- }
- td {
- padding: 3mm;
- border: 2mm solid blue;
- vertical-align: middle;
- }
- td.redcell {
- border: 3mm solid red;
- }
- td.redcell2 {
- border: 2mm solid red;
- }
- </style>
- </head>
- <body>
- <h1>mPDF</h1>
- <h2>Tables - Borders</h2>
- <h4>mPDF</h4>
- Border conflict resolution in tables with border-collapse set to "collapse". mPDF follows the rules set by CSS as well as possible, but as you can see, there is some difference in interpretation of the rules:
- <table class="layout">
- <tr>
- <td class="layout">mPDF</td>
- <td class="layout">Internet Explorer<br />IE 7</td>
- <td class="layout">Firefox<br />v 3.0.3</td>
- </tr>
- <tr>
- <td class="layout">
- <table>
- <tr>
- <td style="border:5mm solid green">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td rowspan="2" class="redcell" style="border:5mm solid teal">1</td>
- <td style="border:3mm solid pink">1</td>
- <td style="border:5mm solid purple">1</td>
- </tr>
- <tr>
- <td style="border:2mm solid gray">1</td>
- <td>1</td>
- </tr>
- <tr>
- <td class="redcell">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </table>
- </td>
- <td class="layout" rowspan="3"><img src="bordersIE.jpg" /></td>
- <td class="layout" rowspan="3"><img src="bordersFF.jpg" /></td>
- </tr>
- <tr>
- <td class="layout" style="text-align: left">
- <table style="border: 2.5mm solid aqua">
- <tr>
- <td class="redcell">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td rowspan="2" class="redcell" style="border:5mm solid green">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td class="redcell">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td class="layout">
- <table>
- <tr>
- <td class="redcell">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td rowspan="2" >1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td style="border:5mm solid yellow">1</td>
- <td>1</td>
- </tr>
- <tr>
- <td class="redcell">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <pagebreak />
- <table class="layout">
- <tr>
- <td class="layout">mPDF</td>
- <td class="layout">mPDF < v3</td>
- <td class="layout">Internet Explorer<br />IE 7</td>
- <td class="layout">Firefox<br />v 3.0.3</td>
- </tr>
- <tr>
- <td class="layout">
- <table class="table2">
- <tr>
- <td style="border:2mm solid green">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td rowspan="2" class="redcell2" style="border:2mm solid teal">1</td>
- <td style="border:2mm solid pink">1</td>
- <td style="border:2mm solid purple">1</td>
- </tr>
- <tr>
- <td style="border:2mm solid gray">1</td>
- <td>1</td>
- </tr>
- <tr>
- <td class="redcell2">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </table>
- </td>
- <td class="layout" rowspan="3"><img src="bordersMPDF2.jpg" /></td>
- <td class="layout" rowspan="3"><img src="borders2IE.jpg" /></td>
- <td class="layout" rowspan="3"><img src="borders2FF.jpg" /></td>
- </tr>
- <tr>
- <td class="layout" style="text-align: left">
- <table style="border: 2mm solid aqua" class="table2">
- <tr>
- <td class="redcell2">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td rowspan="2" class="redcell2" style="border:2mm solid green">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td class="redcell2">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td class="layout">
- <table class="table2">
- <tr>
- <td class="redcell2">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td rowspan="2" >1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- <tr>
- <td style="border:2mm solid yellow">1</td>
- <td>1</td>
- </tr>
- <tr>
- <td class="redcell2">1</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <pagebreak />
- <h4>mPDF</h4>
- <table style="border: 10px solid orange">
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px double red">double red</td>
- <td style="border: 10px dashed yellow">dashed yellow</td>
- <td style="border: 10px dotted green">dotted green</td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px hidden orange">hidden </td>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px none orange">none</td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px ridge blue">ridge blue</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px groove pink">groove pink</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px inset gray">inset gray</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px outset purple">outset purple</td>
- <td style="border: 10px none orange">none </td>
- </tr>
- </table>
- <h4>Firefox</h4>
- <img src="borders3FF.jpg" />
- <br />
- <h4>IE 7</h4>
- <img src="borders3IE.jpg" />
- <pagebreak />
- <div>mPDF</div>
- <table style="border: 10px solid orange; border-collapse: separate;">
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px double red">double red</td>
- <td style="border: 10px dashed yellow">dashed yellow</td>
- <td style="border: 10px dotted green">dotted green</td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px hidden orange">hidden </td>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px none orange">none</td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px ridge blue">ridge blue</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px solid orange">Data</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px groove pink">groove pink</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px solid orange">Data</td>
- </tr>
- <tr>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px inset gray">inset gray</td>
- <td style="border: 10px none orange">none </td>
- <td style="border: 10px outset purple">outset purple</td>
- <td style="border: 10px none orange">none </td>
- </tr>
- </table>
- <div>Firefox</div>
- <img style="margin:0;" src="borders4FF.jpg" />
- <div>IE 7</div>
- <img style="margin:0;" src="borders4IE.jpg" />
- <pagebreak />
- <table style="border: 5px inset teal">
- <tr>
- <td style="border: 5px solid orange">solid orange</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px double red">double red</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px inset gray">inset gray</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px outset purple">outset purple</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px groove pink">groove pink</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px ridge blue">ridge blue</td>
- </tr>
- </table>
- <table style="border: 5px inset gray; border-collapse: separate;">
- <tr>
- <td style="border: 5px solid orange">solid orange</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px double red">double red</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px inset gray">inset gray</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px outset purple">outset purple</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px groove pink">groove pink</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px ridge blue">ridge blue</td>
- </tr>
- </table>
- <table style="border: 5px outset purple; border-collapse: separate;">
- <tr>
- <td style="border: 5px solid orange">solid orange</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px double red">double red</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px inset gray">inset gray</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px outset purple">outset purple</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px groove pink">groove pink</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px ridge blue">ridge blue</td>
- </tr>
- </table>
- <table style="border: 5px groove pink; border-collapse: separate;">
- <tr>
- <td style="border: 5px solid orange">solid orange</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px double red">double red</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px inset gray">inset gray</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px outset purple">outset purple</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px groove pink">groove pink</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px ridge blue">ridge blue</td>
- </tr>
- </table>
- <table style="border: 5px ridge blue; border-collapse: separate;">
- <tr>
- <td style="border: 5px solid orange">solid orange</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px double red">double red</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px inset gray">inset gray</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px outset purple">outset purple</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px groove pink">groove pink</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px ridge blue">ridge blue</td>
- </tr>
- </table>
- <table style="border: 5px double red; border-collapse: separate;">
- <tr>
- <td style="border: 5px solid orange">solid orange</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px double red">double red</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px inset gray">inset gray</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px outset purple">outset purple</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px groove pink">groove pink</td>
- <td style="border: 0px none black">none</td>
- <td style="border: 5px ridge blue">ridge blue</td>
- </tr>
- </table>
- </body>
- </html>
- ';
- //==============================================================
- //==============================================================
- //==============================================================
- include("../mpdf.php");
- $mpdf=new mPDF('en-GB-x','A4','','',10,10,10,10,6,3);
- $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;
- //==============================================================
- //==============================================================
- //==============================================================
- ?>
|