-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesrotate2.php
82 lines (65 loc) · 1.61 KB
/
tesrotate2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
require __DIR__ . '/vendor/autoload.php';
use Ptdi\Mpub\Object\DML;
use Ptdi\Mpub\Object\DModule;
use Ptdi\Mpub\Pdf2\PMC_PDF;
$pdf = new TCPDF('P','mm','A5');
$pdf->AddPage();
$n = 0;
$html_start =
'<div>
<style>
table, th, td {
border:1px solid red;
}
</style>
<table rotate="90">
<thead>';
function get_tr(){
global $n;
$n += 1;
return " <tr>
<th>$n foo</th>
</tr>";
}
$html_end = "</thead>
</table>
</div>";
$html = $html_start;
for ($i=0; $i < 50; $i++) {
$html .= get_tr();
}
$html .= $html_end;
// $html = <<<EOD
// <div>
// <style>
// table, th, td {
// border:1px solid red;
// }
// </style>
// <table rotate="90">
// <thead>
// <tr>
// <th>foo</th>
// </tr>
// </thead>
// </table>
// </div>
// EOD;
// dd($html);
// $pdf->writeHTML($html, true, false, true, false, '');
// dump($pdf->GetX(), $pdf->GetY());
// dump($pdf->getPageHeight() - $pdf->getMargins()['top'] - $pdf->getMargins()['bottom']);
// $ah = $pdf->getPageHeight() - $pdf->getMargins()['top'] - $pdf->getMargins()['bottom'];
// $aw = $pdf->getPageWidth() - $pdf->getMargins()['left'] - $pdf->getMargins()['right'];
// // dd($aw, $ah);
// $pdf->StartTransform();
// // Rotate 90 degrees counter-clockwise
// $pdf->Rotate(90,$ah/2, $aw/2);
// $pdf->writeHTML($html, true,false,true);
// // Stop Transformation
// $pdf->StopTransform();
$pdf->writeHTML($html, true,false,true, false, '', true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');