<?php require '../src/fpdf/FPDF.php'; $pdf = new \fpdf\FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 16); $pdf->Cell(40, 10, 'Hello World!'); $pdf->Output();
<?php define('FPDF_FONTPATH', '.'); require '../src/fpdf/FPDF.php'; $pdf = new \fpdf\FPDF(); $pdf->AddFont('Calligrapher', '', 'calligra.php'); $pdf->AddPage(); $pdf->SetFont('Calligrapher', '', 35); $pdf->Cell(0, 10, 'Enjoy new fonts with FPDF!'); $pdf->Output();
function __construct($orientation = 'P', $unit = 'mm', $format = 'A4') { //passar parametros para a classe principal parent::__construct($orientation, $unit, $format); // composição dos caracteres do barcode 128 $this->T128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ] $this->T128[] = array(2, 2, 2, 1, 2, 2); //1 : [!] $this->T128[] = array(2, 2, 2, 2, 2, 1); //2 : ["] $this->T128[] = array(1, 2, 1, 2, 2, 3); //3 : [#] $this->T128[] = array(1, 2, 1, 3, 2, 2); //4 : [$] $this->T128[] = array(1, 3, 1, 2, 2, 2); //5 : [%] $this->T128[] = array(1, 2, 2, 2, 1, 3); //6 : [&] $this->T128[] = array(1, 2, 2, 3, 1, 2); //7 : ['] $this->T128[] = array(1, 3, 2, 2, 1, 2); //8 : [(] $this->T128[] = array(2, 2, 1, 2, 1, 3); //9 : [)] $this->T128[] = array(2, 2, 1, 3, 1, 2); //10 : [*] $this->T128[] = array(2, 3, 1, 2, 1, 2); //11 : [+] $this->T128[] = array(1, 1, 2, 2, 3, 2); //12 : [,] $this->T128[] = array(1, 2, 2, 1, 3, 2); //13 : [-] $this->T128[] = array(1, 2, 2, 2, 3, 1); //14 : [.] $this->T128[] = array(1, 1, 3, 2, 2, 2); //15 : [/] $this->T128[] = array(1, 2, 3, 1, 2, 2); //16 : [0] $this->T128[] = array(1, 2, 3, 2, 2, 1); //17 : [1] $this->T128[] = array(2, 2, 3, 2, 1, 1); //18 : [2] $this->T128[] = array(2, 2, 1, 1, 3, 2); //19 : [3] $this->T128[] = array(2, 2, 1, 2, 3, 1); //20 : [4] $this->T128[] = array(2, 1, 3, 2, 1, 2); //21 : [5] $this->T128[] = array(2, 2, 3, 1, 1, 2); //22 : [6] $this->T128[] = array(3, 1, 2, 1, 3, 1); //23 : [7] $this->T128[] = array(3, 1, 1, 2, 2, 2); //24 : [8] $this->T128[] = array(3, 2, 1, 1, 2, 2); //25 : [9] $this->T128[] = array(3, 2, 1, 2, 2, 1); //26 : [:] $this->T128[] = array(3, 1, 2, 2, 1, 2); //27 : [;] $this->T128[] = array(3, 2, 2, 1, 1, 2); //28 : [<] $this->T128[] = array(3, 2, 2, 2, 1, 1); //29 : [=] $this->T128[] = array(2, 1, 2, 1, 2, 3); //30 : [>] $this->T128[] = array(2, 1, 2, 3, 2, 1); //31 : [?] $this->T128[] = array(2, 3, 2, 1, 2, 1); //32 : [@] $this->T128[] = array(1, 1, 1, 3, 2, 3); //33 : [A] $this->T128[] = array(1, 3, 1, 1, 2, 3); //34 : [B] $this->T128[] = array(1, 3, 1, 3, 2, 1); //35 : [C] $this->T128[] = array(1, 1, 2, 3, 1, 3); //36 : [D] $this->T128[] = array(1, 3, 2, 1, 1, 3); //37 : [E] $this->T128[] = array(1, 3, 2, 3, 1, 1); //38 : [F] $this->T128[] = array(2, 1, 1, 3, 1, 3); //39 : [G] $this->T128[] = array(2, 3, 1, 1, 1, 3); //40 : [H] $this->T128[] = array(2, 3, 1, 3, 1, 1); //41 : [I] $this->T128[] = array(1, 1, 2, 1, 3, 3); //42 : [J] $this->T128[] = array(1, 1, 2, 3, 3, 1); //43 : [K] $this->T128[] = array(1, 3, 2, 1, 3, 1); //44 : [L] $this->T128[] = array(1, 1, 3, 1, 2, 3); //45 : [M] $this->T128[] = array(1, 1, 3, 3, 2, 1); //46 : [N] $this->T128[] = array(1, 3, 3, 1, 2, 1); //47 : [O] $this->T128[] = array(3, 1, 3, 1, 2, 1); //48 : [P] $this->T128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q] $this->T128[] = array(2, 3, 1, 1, 3, 1); //50 : [R] $this->T128[] = array(2, 1, 3, 1, 1, 3); //51 : [S] $this->T128[] = array(2, 1, 3, 3, 1, 1); //52 : [T] $this->T128[] = array(2, 1, 3, 1, 3, 1); //53 : [U] $this->T128[] = array(3, 1, 1, 1, 2, 3); //54 : [V] $this->T128[] = array(3, 1, 1, 3, 2, 1); //55 : [W] $this->T128[] = array(3, 3, 1, 1, 2, 1); //56 : [X] $this->T128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y] $this->T128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z] $this->T128[] = array(3, 3, 2, 1, 1, 1); //59 : [[] $this->T128[] = array(3, 1, 4, 1, 1, 1); //60 : [\] $this->T128[] = array(2, 2, 1, 4, 1, 1); //61 : []] $this->T128[] = array(4, 3, 1, 1, 1, 1); //62 : [^] $this->T128[] = array(1, 1, 1, 2, 2, 4); //63 : [_] $this->T128[] = array(1, 1, 1, 4, 2, 2); //64 : [`] $this->T128[] = array(1, 2, 1, 1, 2, 4); //65 : [a] $this->T128[] = array(1, 2, 1, 4, 2, 1); //66 : [b] $this->T128[] = array(1, 4, 1, 1, 2, 2); //67 : [c] $this->T128[] = array(1, 4, 1, 2, 2, 1); //68 : [d] $this->T128[] = array(1, 1, 2, 2, 1, 4); //69 : [e] $this->T128[] = array(1, 1, 2, 4, 1, 2); //70 : [f] $this->T128[] = array(1, 2, 2, 1, 1, 4); //71 : [g] $this->T128[] = array(1, 2, 2, 4, 1, 1); //72 : [h] $this->T128[] = array(1, 4, 2, 1, 1, 2); //73 : [i] $this->T128[] = array(1, 4, 2, 2, 1, 1); //74 : [j] $this->T128[] = array(2, 4, 1, 2, 1, 1); //75 : [k] $this->T128[] = array(2, 2, 1, 1, 1, 4); //76 : [l] $this->T128[] = array(4, 1, 3, 1, 1, 1); //77 : [m] $this->T128[] = array(2, 4, 1, 1, 1, 2); //78 : [n] $this->T128[] = array(1, 3, 4, 1, 1, 1); //79 : [o] $this->T128[] = array(1, 1, 1, 2, 4, 2); //80 : [p] $this->T128[] = array(1, 2, 1, 1, 4, 2); //81 : [q] $this->T128[] = array(1, 2, 1, 2, 4, 1); //82 : [r] $this->T128[] = array(1, 1, 4, 2, 1, 2); //83 : [s] $this->T128[] = array(1, 2, 4, 1, 1, 2); //84 : [t] $this->T128[] = array(1, 2, 4, 2, 1, 1); //85 : [u] $this->T128[] = array(4, 1, 1, 2, 1, 2); //86 : [v] $this->T128[] = array(4, 2, 1, 1, 1, 2); //87 : [w] $this->T128[] = array(4, 2, 1, 2, 1, 1); //88 : [x] $this->T128[] = array(2, 1, 2, 1, 4, 1); //89 : [y] $this->T128[] = array(2, 1, 4, 1, 2, 1); //90 : [z] $this->T128[] = array(4, 1, 2, 1, 2, 1); //91 : [{] $this->T128[] = array(1, 1, 1, 1, 4, 3); //92 : [|] $this->T128[] = array(1, 1, 1, 3, 4, 1); //93 : [}] $this->T128[] = array(1, 3, 1, 1, 4, 1); //94 : [~] $this->T128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL] $this->T128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3] $this->T128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2] $this->T128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT] $this->T128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap] $this->T128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap] $this->T128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap] $this->T128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1] $this->T128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart] $this->T128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart] $this->T128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart] $this->T128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP] $this->T128[] = array(2, 1); //107 : [END BAR] for ($i = 32; $i <= 95; $i++) { // conjunto de caracteres $this->ABCset .= chr($i); } $this->Aset = $this->ABCset; $this->Bset = $this->ABCset; for ($i = 0; $i <= 31; $i++) { $this->ABCset .= chr($i); $this->Aset .= chr($i); } for ($i = 96; $i <= 126; $i++) { $this->ABCset .= chr($i); $this->Bset .= chr($i); } $this->Cset = "0123456789"; for ($i = 0; $i < 96; $i++) { // convertendo grupos A & B @($this->SetFrom["A"] .= chr($i)); @($this->SetFrom["B"] .= chr($i + 32)); @($this->SetTo["A"] .= chr($i < 32 ? $i + 64 : $i - 32)); @($this->SetTo["B"] .= chr($i)); } }