Beispiel #1
0
 function alku()
 {
     global $yhtiorow, $firstpage, $pdf, $rectparam, $norm, $norm_bold, $pieni, $ytunnus, $asiakasid, $kukarow, $kala, $tid, $otsikkotid;
     static $sivu;
     $sivu++;
     if (!isset($pdf)) {
         //PDF parametrit
         $pdf = new pdffile();
         $pdf->enable('template');
         $pdf->set_default('margin-top', 0);
         $pdf->set_default('margin-bottom', 0);
         $pdf->set_default('margin-left', 0);
         $pdf->set_default('margin-right', 0);
         $rectparam["width"] = 0.3;
         $norm["height"] = 12;
         $norm["font"] = "Courier";
         $norm_bold["height"] = 12;
         $norm_bold["font"] = "Courier-Bold";
         $pieni["height"] = 8;
         $pieni["font"] = "Courier";
         $query = "SELECT *\n                 FROM asiakas\n                 WHERE yhtio = '{$kukarow['yhtio']}'\n                 and tunnus  = '{$asiakasid}'";
         $assresult = pupe_query($query);
         $assrow = mysql_fetch_assoc($assresult);
         // Tehdään firstpage
         $firstpage = $pdf->new_page("a4");
         //  Tehdään headertemplate
         $tid = $pdf->template->create();
         $pdf->template->rectangle($tid, 20, 20, 0, 580, $rectparam);
         $pdf->template->text($tid, 30, 5, $yhtiorow["nimi"], $pieni);
         $pdf->template->text($tid, 170, 5, "{$assrow['nimi']} {$assrow['nimitark']} ({$ytunnus}) " . t("alennustaulukko"));
         $pdf->template->place($tid, $firstpage, 0, 800);
         //  Tehdään otsikkoheader
         $otsikkotid = $pdf->template->create();
         $pdf->template->text($otsikkotid, 30, 20, t("Osasto"), $norm_bold);
         $pdf->template->text($otsikkotid, 30, 0, t("Tuoteryhmä") . "/" . t("Tuotenumero"), $norm_bold);
         $pdf->template->text($otsikkotid, 330, 0, t("Aleryhmä"), $norm_bold);
         $pdf->template->text($otsikkotid, 450, 0, t("Alennus"), $norm_bold);
         if ($yhtiorow['myynnin_alekentat'] > 1) {
             $pdf->template->text($otsikkotid, 520, 0, t("Alelaji"), $norm_bold);
         }
         $pdf->template->place($otsikkotid, $firstpage, 0, 665, $norm_bold);
         $kala = 650;
         //  Asiakastiedot
         //$pdf->draw_rectangle(737, 20,  674, 300, $firstpage, $rectparam);
         $pdf->draw_text(50, 759, t("Osoite", $kieli), $firstpage, $pieni);
         $pdf->draw_text(50, 747, $assrow["nimi"], $firstpage, $norm);
         $pdf->draw_text(50, 737, $assrow["nimitark"], $firstpage, $norm);
         $pdf->draw_text(50, 727, $assrow["osoite"], $firstpage, $norm);
         $pdf->draw_text(50, 717, $assrow["postino"] . " " . $assrow["postitp"], $firstpage, $norm);
         $pdf->draw_text(50, 707, $assrow["maa"], $firstpage, $norm);
     } else {
         //  Liitetään vaan valmiit templatet uudelle sivulle
         $firstpage = $pdf->new_page("a4");
         $pdf->template->place($tid, $firstpage, 0, 800);
         $pdf->template->place($otsikkotid, $firstpage, 0, 760);
     }
     $pdf->draw_text(520, 805, t("Sivu") . ": {$sivu}", $firstpage, $norm);
 }
Beispiel #2
0
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Id: charts.php 221 2005-06-25 01:22:54Z deelight $
*/
/* This example illustrates the charting subclass
 * These features are still experimental
 */
require '../phppdflib.class.php';
// Starts a new pdffile object
$pdf = new pdffile();
$pdf->set_default('margin', 0);
$firstpage = $pdf->new_page("letter");
$pdf->enable('chart');
$pdf->chart->setcolor('background', 1, 0.5, 0.33);
for ($series = 1; $series < 4; $series++) {
    unset($points);
    switch ($series) {
        case 1:
            $color = 'black';
            break;
        case 2:
            $color = 'blue';
            break;
        case 3:
            $color = 'green';
            break;
    }
    for ($i = 0; $i < 5; $i++) {
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Id: template.php 221 2005-06-25 01:22:54Z deelight $
*/
/* This example illustrates the template subclass
 * These features are still experimental
 */
require '../phppdflib.class.php';
// Starts a new pdffile object
$pdf = new pdffile();
$page = $pdf->new_page("letter");
$pdf->enable('template');
$t1 = $pdf->template->create();
/* Set the overall size of this template.
 * This will be important once auto-placement
 * is working
 */
$pdf->template->size($t1, 500, 80);
/* Put a rectangle at the lower left of the template
 */
$pdf->template->rectangle($t1, 0, 0, 20, 20);
// These next two will look like a lolipop
// A circle on the template
$pdf->template->circle($t1, 200, 5, 12, array('mode' => 'fill'));
// Add a line
$pdf->template->line($t1, array(0 => 200, 1 => 250), array(0 => 5, 1 => 25));
/* Put a fixed text string to the right of the rectangle
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Id: example-packer.php 221 2005-06-25 01:22:54Z deelight $
*/
require '../phppdflib.class.php';
$pdf = new pdffile();
$pdf->enable('packer');
$page = $pdf->packer->new_page();
$pdf->set_default('smode', 'fill');
$pdf->set_default('fillcolor', $pdf->get_color('red'));
$space = new field(100, 200, 100, 200);
$pdf->packer->allocate($space);
$pdf->draw_rectangle(200, 100, 100, 200, $page);
$pdf->set_default('fillcolor', $pdf->get_color('blue'));
$space = new field(150, 300, 150, 400);
$pdf->packer->allocate($space);
$pdf->draw_rectangle(400, 150, 150, 300, $page);
$pdf->set_default('fillcolor', $pdf->get_color('green'));
$space = new field(400, 600, 600, 800);
$pdf->packer->allocate($space);
$pdf->draw_rectangle(800, 400, 600, 600, $page);
$pdf->set_default('fillcolor', $pdf->get_color('black'));
   php pdf generation library
   Copyright (C) Potential Technologies 2002
   http://www.potentialtech.com
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Id: example-import.php 221 2005-06-25 01:22:54Z deelight $
*/
require '../phppdflib.class.php';
// Starts a new pdffile object
$pdf = new pdffile();
$pdf->enable('import');
// Change this to grab a pre-existing PDF file from somewhere
$d = file_get_contents('example.pdf');
if ($pdf->import->append($d)) {
    echo "No errors\n";
} else {
    echo "Error!\n";
}