示例#1
0
<?php

include_once '../src/Cezpdf.php';
$pdf = new CezPDF("a4");
$pdf->selectFont('Helvetica');
// some general data used for table output
$data = array(array('num' => 1, 'name' => 'gandalf', 'type' => 'wizard'), array('num' => 2, 'name' => 'bilbo', 'type' => 'hobbit', 'url' => 'http://www.ros.co.nz/pdf/'), array('num' => 3, 'name' => 'frodo', 'type' => 'hobbit'), array('num' => 4, 'name' => 'saruman', 'type' => 'bad dude', 'url' => 'http://sourceforge.net/projects/pdf-php'), array('num' => 5, 'name' => 'sauron', 'type' => 'really bad dude'));
$cols = array('num' => 'No', 'type' => 'Type', 'name' => '<i>Alias</i>');
$coloptions = array('num' => array('justification' => 'right'), 'name' => array('justification' => 'left'), 'type' => array('justification' => 'center'));
$pdf->ezText("<b>GRIDLINE</b>", 12);
$pdf->ezText("<b>using 'showLines' option - DEPRECATED</b>\n", 10);
$pdf->ezText("\nDefault: showLines = 1\n", 10);
$pdf->ezTable($data, $cols);
$pdf->ezText("\nDisabled showLines = 0\n", 10);
$pdf->ezTable($data, $cols, '', array('showHeadings' => 0, 'shaded' => 0, 'showLines' => 0));
$pdf->ezText("\nHorizontal lines (per row) - showLines = 3\n");
$pdf->ezTable($data, $cols, '', array('showHeadings' => 1, 'shaded' => 0, 'showLines' => 3));
$pdf->ezText("\nHeader line only - showLines = 4\n");
$pdf->ezTable($data, array('type' => 'Type', 'name' => '<i>Alias</i>'), '', array('showHeadings' => 1, 'shaded' => 0, 'showLines' => 4));
// get all user defined constants starting with 'EZ_GRIDLINE'
$all_constants = get_defined_constants();
$userConstants = array();
foreach ($all_constants as $k => $v) {
    if (substr($k, 0, 11) == "EZ_GRIDLINE") {
        $userConstants[$k] = $v;
    }
}
$pdf->ezNewPage();
// title for advanced grid line output
$pdf->ezText("\n<b>GRIDLINE options</b>", 12);
$pdf->ezText("<b>using 'gridline' option - available in version >= 0.12-rc11</b>", 10);