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>";
     }
 }
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";
/* Set the barcode text and put it onto the PDF document */
$container->setdata($code1);
$container->putcontainer(30, 812, 100);
Exemplo n.º 3
0
$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);
/* Note that the 4th column is a barcode column; the header should
   have the text "Barcode" in it, so it's a instance of jh_pdf_text_jhpci
   just like the other columns; however, the rows should show a barcode;
   this is done by just using another class, the rest is the same as
   with the other columns! */
$col4h = new jh_pdf_text_jhpci(&$pdf);
$col4r = new jh_pdf_container_jhpci(&$pdf);
$col4r->addobject($barcode);
$col4r->addemptyspace(3);
$col4r->addobject($bctext);
/* Use Courier for the rows in the 2nd and 3rd column
   and make the content right-aligned */
$col2r->setfontface("Courier");
$col2r->setalignment("right");
$col2h->setalignment("right");
Exemplo n.º 4
0
    /* 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 */
$table = new jh_pdf_table(&$pdf, &$ypos, 30, 565, 30);
/* Set a function that will be called if a new page is necessary */
$table->setnewpagefunction(newpage);
/* Define the columns; note that all the columns have "*"
   as their width which means that the whole table width
Exemplo n.º 5
0
    /* Create a DIN A4 page */
    PDF_begin_page($pdf, 595, 842);
    return 816.5;
}
/* Create the first page */
$ypos = newpage(false);
/* Create a barcode object which will contain some number */
$barcode = new jh_pdf_barcode_jhpci(&$pdf);
$barcode->settype('128b');
$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 text object which will contain the article name */
$article = new jh_pdf_text_jhpci(&$pdf);
$article->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($barcode);
$content->addemptyspace(3);
$content->addobject($bctext);
$content->addemptyspace(3);
$content->addobject($article);
/* Make an instance of the table class */
$table = new jh_pdf_table(&$pdf, &$ypos, 3, 592, 25.5);
/* Set a function that will be called if a new page is necessary */
$table->setnewpagefunction(newpage);
/* Make the row height static; this is useful for labels
   Bill, is this what you want? ;-) */