Project

General

Profile

Problem with PdfTable and PageBreak » mypdf-table.php

Marco Steindl, 07/17/2014 10:01 AM

 
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
    
38
    }
39

    
40

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

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

    
55
}
56

    
(1-1/4)