forked from miznokruge/cyber-arief
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xtcpdf.php
75 lines (68 loc) · 2.96 KB
/
xtcpdf.php
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
74
75
<?php
include 'tcpdf/tcpdf.php';
class XTCPDF extends TCPDF {
var $xheadertext = 'PDF created using CakePHP and TCPDF';
var $xheadercolor = array(0, 0, 200);
var $nama_aplikasi = 'Copyright © Mizno Kruge. All rights reserved.';
var $xfooterfont = PDF_FONT_NAME_MAIN;
var $xfooterfontsize = 6;
var $namaorg = 'PT. ANGIN RIBUT';
var $alamat = "Graha Raflesia, Jl.Raflesia Selatan 11 no 10 Citra Raya, Tangerang";
var $telp = '+62 21 2901 3223';
var $fax = "+62 21 2901 3223";
var $email = '[email protected]';
var $website = 'http://www.miznokruge.net';
var $logo = '../../img/logo.png';
var $username = '';
/**
* Overwrites the default header
* set the text in the view using
* $fpdf->xheadertext = 'YOUR ORGANIZATION';
* set the fill color in the view using
* $fpdf->xheadercolor = array(0,0,100); (r, g, b)
* set the font in the view using
* $fpdf->setHeaderFont(array('YourFont','',fontsize));
*/
function Header() {
$style = array('width' => 0.5, 'cap' => 'butt', 'join' => '', 'dash' => 0, 'color' => array(0, 0, 0));
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
//$this->Cell(0, 10, '<img src="' . $img_file . '">');
$this->SetMargins(30, 30);
$this->SetFont('helvetica', 'B', 16);
$this->Cell(0, 100, ' ' . $this->namaorg, 0, false, 'L', 0, '', 0, false, 'M', 'M');
$this->SetFont('helvetica', '', 9);
$this->Ln(5);
$this->Cell(0, 100, $this->alamat, 0, false, 'L', 0, '', 0, false, 'M', 'M');
$this->Ln(4);
$telp = 'Telp : ' . $this->telp;
$this->Cell(0, 10, $telp, 0, false, 'L', 0, '', 0, false, 'M', 'M');
$this->Ln(4);
$this->Cell(0, 10, ' Fax : ' . $this->fax, 0, false, 'L', 0, '', 0, false, 'M', 'M');
$this->Ln(4);
$this->Cell(0, 10, $this->email, 0, false, 'L', 0, '', 0, false, 'M', 'M');
$this->Image($this->logo, 5, 5, 20, 15, '', '', '', false, 300, '', false, false, 0);
$this->Line(0, 25, 1000, 25, $style);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
$this->setPageMark();
}
/**
* Overwrites the default footer
* set the text in the view using
* $fpdf->xfootertext = 'Copyright © %d YOUR ORGANIZATION. All rights reserved.';
*/
function Footer() {
$year = date('Y');
$footertext = 'Generated by ' . $this->nama_aplikasi . ' / User:' . $this->username . ' / Date:' . date("d F Y, G:i:a");
$this->SetY(-20);
$this->SetTextColor(0, 0, 0);
$this->SetFont($this->xfooterfont, '', 5);
$this->Cell(0, 8, $footertext, 'T', 1, 'C');
}
}