bookmarks /app/vendors/Pear/mc/PDF.php

Language PHP Lines 74
MD5 Hash 91b55c81de83f5e33007c12b3f8b1bf7
Repository https://github.com/hardsshah/bookmarks.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
// extends the pear PDF class
require_once "File/PDF.php";

class mc_PDF extends File_PDF
{

    function __construct(){
        $this->setInfo(array(
        "title" => 		  "Invoice",
        "subject" => 	  "Invoice",
        "author" => 	  "Made Secure LLC",
        "keywords" => 	"Invoice",
        "creator" => 	  "Made Secure LLC"
            ));
        $this->setCompression(true);
        $this->setAutoPageBreak(true);
    }

    function header(){
        // add an image (file, x-cord, y-cord, [width], [height], [type], [link]) w or h 0 sets to default img will auto size which one is given
        $this->image('img/pdf/msc_logo.jpg', 10, 5, 0, 10, 'jpg', "http://www.madesecure.com/");
        // Line break Create spacing so img does not overlap text
        $this->newLine(15);
        // make a line accross the page, neg value starts from opposite side
        $this->line(10.0, 16.0, -10.0, 16.0);
    }

    function footer(){
        $text ='For questions contact Matthew Campbell. Office: 1.704.461.1664, Email: matt@madesecure.com';
        // Center and display the text
        $offset = ($this->getStringWidth($text))/2;
        $x_pos = 108 - $offset;
        // min from bottom 12.7 plus height 5
        $y_pos = -18;
        $this->text($x_pos, $y_pos, $text);
    }

    /**
     *Set the cursor position to write a line with right alignment
     *
     * @param string $line
     * @return float x position
     */
    function alignRight($line){
        // get position to write at
        $width = $this->getStringWidth($line);
        // calc distance from right side margin plus width of string // neg val not working
        $pos_x = $this->getPageWidth() + $this->_left_margin - $width - 3;
        // set position to write at
        $this->setX($pos_x);
        return $pos_x;
    }
    /**
     * Draw a fold line 1/3 down the page
     */
    function addFoldLine(){
        // Add a fold line 1/3 of page is 93 plus 8 who knows why but it works
        $y = 101.0;
        $this->line(10.0, $y, -10.0, $y);
        // Write the text below the fold line
        $this->setFontSize(6);
        $line = "Fold Along This Line";
        $width = $this->getStringWidth($line);
        //center the text
        $pos_x = 108 - ($width/2);
        $this->setX($pos_x);
        // add fold line text
        $this->setY($y);
        $this->write(3, $line);
    }
}
?>
Back to Top