Exemplo n.º 1
0
 function renderHeaderBand($bandparams)
 {
     if (array_key_exists('grid', $bandparams)) {
         $grid = $bandparams['grid'];
     } else {
         $grid = $this->phpgrid;
     }
     $headerstyle = 'reportheader';
     if ($this->issubreport) {
         $headerstyle = 'subreportheader';
     }
     $grid->getlookupquery();
     $what = $grid->statustext;
     if ($this->outputformat == HTML) {
         if ($what != '') {
             $cs = count($grid->printable);
             echo "<tr><td colspan=\"{$cs}\"><b>{$what}</b></td></tr>\n";
         }
         echo "<tr class=\"{$headerstyle}\">";
     }
     reset($grid->printable);
     while (list($k, $v) = each($grid->printable)) {
         $column = $grid->getLabel($k);
         if ($this->outputformat == HTML) {
             echo "<td>{$column}</td>";
         }
         if ($this->outputformat == PDF) {
             $column = strip_tags($column);
             $colh = new jh_pdf_text_jhpci(&$this->pdf);
             if (array_key_exists($k, $this->coltypes)) {
                 $colr = new jh_pdf_container_jhpci(&$this->pdf);
                 $barcode = new jh_pdf_barcode_jhpci(&$this->pdf);
                 $barcode->settype('128a');
                 /* Adjust the height of the barcode */
                 $barcode->setheight(20);
                 $bctext = new jh_pdf_text_jhpci(&$this->pdf);
                 $bctext->setalignment("center");
                 $colr->addobject($barcode);
                 $colr->addemptyspace(3);
                 $bctext->setfontsize($this->pdffontsize);
                 $colr->addobject($bctext);
             } else {
                 $colr = new jh_pdf_text_jhpci(&$this->pdf);
                 $colr->setfontsize($this->pdffontsize);
             }
             $colh->setfontsize($this->pdffontsize);
             $colh->setfontcolor(1);
             if (array_key_exists($k, $this->pdfwidths)) {
                 $w = $this->pdfwidths[$k];
             } else {
                 $w = '*';
             }
             $col =& $this->table->addcolumn($column, $w, $colh, $colr);
         }
     }
     if ($this->outputformat == HTML) {
         echo "</tr>";
     }
 }
Exemplo n.º 2
0
    if ($closepage) {
        PDF_end_page($pdf);
        /* Output the current part of the in-memory created PDF document */
        print PDF_get_buffer($pdf);
    }
    /* Create a DIN A4 page */
    PDF_begin_page($pdf, 595, 842);
    return 812;
}
/* Create the first page */
$ypos = newpage(false);
/* Create a text object which will contain the weekday name */
$day = new jh_pdf_text_jhpci(&$pdf);
$day->setalignment("center");
/* Create a barcode object which will contain some number */
$barcode = new jh_pdf_barcode_jhpci(&$pdf);
$barcode->settype('25i');
$barcode->setheight(20);
/* Create a text object which will contain the same number as
   the barcode, but this time as plain text */
$bctext = new jh_pdf_text_jhpci(&$pdf);
$bctext->setalignment("center");
/* Create a container object and put in the three objects
   created above and some empty space between them */
$content = new jh_pdf_container_jhpci(&$pdf);
$content->addobject($day);
$content->addemptyspace(3);
$content->addobject($barcode);
$content->addemptyspace(3);
$content->addobject($bctext);
/* Make an instance of the table class */
// +----------------------------------------------------------------------+
// | Author: Johann Hanne <*****@*****.**>                                |
// +----------------------------------------------------------------------+
require_once "class.jh_pdf_barcode_jhpci-1.2.1.inc.php";
require_once "class.jh_pdf_text_jhpci-1.2.1.inc.php";
require_once "class.jh_pdf_container-1.2.1.inc.php";
/* Tell the browser that we will send a PDF document */
header("Content-type: application/pdf");
/* Create a PDFlib object */
$pdf = PDF_new();
/* Create a PDF document in memory */
PDF_open_file($pdf, "");
/* Create a DIN A4 page */
PDF_begin_page($pdf, 595, 842);
/* Create a barcode object and set the type to 2 of 5 interleaved */
$barcode = new jh_pdf_barcode_jhpci(&$pdf);
$barcode->settype('25i');
/* Create a text object which will contain the barcode data as plain text */
$text = new jh_pdf_text_jhpci(&$pdf);
$text->setalignment("center");
/* Create a container object and put the barcode and text objects into it
   with some empty space between them */
$container = new jh_pdf_container(&$pdf);
$container->addobject($barcode);
$container->addemptyspace(5);
$container->addobject($text);
$container->setwidth(100);
/* Define some test codes */
$code1 = "1231231230";
$code2 = "4564564560";
$code3 = "7897897890";
Exemplo n.º 4
0
   does not include any parameter, thus the default is set to true */
function newpage($closepage = true)
{
    global $pdf;
    if ($closepage) {
        PDF_end_page($pdf);
        /* Output the current part of the in-memory created PDF document */
        print PDF_get_buffer($pdf);
    }
    /* Create a DIN A4 page */
    //    PDF_begin_page($pdf, 595, 842);
    PDF_begin_page($pdf, 842, 595);
    //return 812;
    return 565;
}
$barcode = new jh_pdf_barcode_jhpci(&$pdf);
$barcode->settype('39');
/* Adjust the height of the barcode */
$barcode->setheight(20);
$bctext = new jh_pdf_text_jhpci(&$pdf);
$bctext->setalignment("center");
/* Create the first page */
$ypos = newpage(false);
/* Create instances of JHPCI conformant classes for
   the header and the rows of every column */
$col1h = new jh_pdf_text_jhpci(&$pdf);
$col1r = new jh_pdf_text_jhpci(&$pdf);
$col2h = new jh_pdf_text_jhpci(&$pdf);
$col2r = new jh_pdf_text_jhpci(&$pdf);
$col3h = new jh_pdf_text_jhpci(&$pdf);
$col3r = new jh_pdf_text_jhpci(&$pdf);