Commit f75a06930f185e12cc81895c310922c3b7e24907
1 parent
aa058d0073
Exists in
master
table_demo: fixed table to fit on Letter sized paper
- Added a bunch of defines that represent paper sizes
Showing 1 changed file with 18 additions and 6 deletions Side-by-side Diff
table_demo
View file @
f75a069
... | ... | @@ -26,16 +26,26 @@ |
26 | 26 | //require_once('tcpdf_include.php'); |
27 | 27 | $outfile = __DIR__ . '/pdflib_table_output.pdf'; |
28 | 28 | |
29 | -// page placement defaults | |
30 | -$pageTopYPortrait = 750; | |
31 | -$pageTopYLandscape = 570; | |
32 | - | |
29 | +define("PAGE_WIDTH_LETTER", 612); | |
30 | +define("PAGE_HEIGHT_LETTER", 792); | |
31 | +define("PAGE_WIDTH_A4", 595); | |
32 | +define("PAGE_HEIGHT_A4", 842); | |
33 | 33 | // table params |
34 | 34 | $tbl = 0; |
35 | 35 | $rowmax = 50; |
36 | 36 | $colmax = 5; |
37 | -$llx= 50; $lly=50; $urx=550; $ury=800; | |
38 | 37 | |
38 | +// page placement defaults | |
39 | +$letterPageTopYPortrait = 752; | |
40 | +$letterPageTopYLandscape = 592; | |
41 | +$letterPageRightPortrait = 592; | |
42 | +$letterPageRightLandscape = 752; | |
43 | +// lower left X, lower left Y, upper right X, upper right Y | |
44 | +// A4 paper size | |
45 | +//$llx= 50; $lly=50; $urx=550; $ury=800; | |
46 | +// Letter paper size | |
47 | +$llx= 50; $lly=50; $urx=550; $ury=$letterPageTopYPortrait; | |
48 | + | |
39 | 49 | // wrap PDFlib usage in a try{} block |
40 | 50 | try { |
41 | 51 | $pdf = new PDFlib(); |
... | ... | @@ -44,7 +54,9 @@ |
44 | 54 | $pdf->set_option("errorpolicy=return"); |
45 | 55 | $pdf->set_option("stringformat=utf8"); |
46 | 56 | // set up the license key; Linux x86_64 |
47 | - $pdf->set_option("license=L900202-010053-139026-P52782-GB5G52"); | |
57 | + // This will be skipped on Macs | |
58 | + if ( php_uname('s') === "Linux" ) | |
59 | + $pdf->set_option("license=L900202-010053-139026-P52782-GB5G52"); | |
48 | 60 | |
49 | 61 | // all paths in 'searchpath' need to be inside curly braces |
50 | 62 | // multiple curly-braced paths in $searchpath need to be separated with |