Project

General

Profile

RE: Problem with PdfTable and PageBreak » mypdf-table.php

Andrei Bintintan, 07/17/2014 05:10 PM

 
1
<?php
2

    
3
/**
4
 * Custom PDF class extention for Header and Footer Definitions
5
 *
6
 * @author andy@interpid.eu
7
 *
8
 */
9
class myPDF extends Pdf {
10

    
11

    
12
    /**
13
     * Custom Header
14
     *
15
     * @see Pdf::Header()
16
     */
17
    public function Header () {
18

    
19
        $this->SetY(10);
20
        
21
        /**
22
         * yes, even here we can use the multicell tag! this will be a local object
23
         */
24
        $oMulticell = PdfMulticell::getInstance($this);
25
        
26
        $oMulticell->SetStyle("h1", "dejavusans", "", 6, "160,160,160");
27
        $oMulticell->SetStyle("h2", "dejavusans", "", 6, "0,119,220");
28
        
29
        $oMulticell->multiCell(100, 3, file_get_contents(dirname(__FILE__) . '/content/header-table.txt'));
30
        
31
        $this->Image(dirname(__FILE__) . '/images/interpid_logo.png', 160, 10, 40, 0, '', 'http://www.interpid.eu');
32
//         $this->SetY($this->tMargin);
33
        
34
        
35
  // NOTE: the wrong page break depends on this Ln....
36
        //$this->Ln(30);
37
        $this->SetY(30);
38
    
39
    }
40

    
41

    
42
    /**
43
     * Custom Footer
44
     *
45
     * @see Pdf::Footer()
46
     */
47
    public function Footer () {
48

    
49
        $this->SetY(- 10);
50
        $this->SetFont('dejavusans', 'I', 7);
51
        $this->SetTextColor(170, 170, 170);
52
        $this->MultiCell(0, 4, "Page {$this->PageNo()} / {nb}", 0, 'C');
53
    
54
    }
55

    
56
}
57

    
(1-1/3)