1. Go to this page and download the library: Download francerz/exfpdf library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$pdf = new ExFPDF();
// ... create PDF
// Output PSR-7 Response object
$factories = new HttpFactoryManager(new ResponseFactory(), new StreamFactory());
$response = $pdf->OutputPsr7WithManager($factories, 'my-file.pdf');
$pdf = new ExFPDF();
// ... create PDF
// Output PSR-7 Response object
$response = $pdf->OutputPsr7WithManager(HttpFactory::getManager(), 'my-file.pdf');
// Sets Y position at 25% (one quarter) from page top.
$pdf->SetY('25%');
// Sets X position at 25% (one quarter) from page left.
$pdf->SetX('25%');
// Draws a cell with 50% width and height of current page size.
$pdf->Cell('50%','50%', '', 1);
// Sets Y position at top margin.
$pdf->SetY('~0');
// Sets X position at left margin.
$pdf->SetX('~0');
// Draws a cell with 25% width and 10% height of current page content.
$pdf->Cell('~25%', '~10%', '', 1);
// translates pointer 10 units right to current X.
$pdf->OffsetX(10);
// translates pointer 20 units bottom to current Y.
$pdf->OffsetY(20);
// translates equivalent to two previous in a single line.
$pdf->OffsetXY(10, 20);
// offset may be negative and relative units
$pdf->OffsetXY(-10, '~10%');
// Defines a coordinate pin at current X,Y with name 'start'.
$pdf->SetPin('start');
// Retrieves 'start' pin positions.
$x = $pdf->GetPinX('start');
$y = $pdf->GetPinY('start');
// Moves pdf position back to pin 'start'
$pdf->MoveToPin('start');
// Moves pdf X position back to pin 'start'
$pdf->MoveToPin('start','X');
// Moves pdf Y position back to pin 'start'
$pdf->MoveToPin('start','Y');
// Moves pdf X position back to pin 'start' and adds 10 units.
$pdf->MoveToPin('start', 'X', 10);
// Moves pdf Y position back to pin 'start' and adds 20 units.
$pdf->MoveToPin('start', 'Y', 20);
// Moves pdf position back to pin 'start' and adds X: 10 units, Y: 20 units.
$pdf->MoveToPin('start', 'XY', 10, 20);
SetLineHeight(float $size)
$pdf->SetFontSize(10);
$pdf->SetLineHeight(1.1); // 110% of actual size (11pt)
$pdf->Cell('100%', null, 'This text is size 10pt, but Cell is 11pt height with LineHeight 1.1');
SetSourceEncoding(string $encoding)
$pdf->SetSourceEncoding('UTF-8');
$pdf->Cell('100%', null, 'Benjamín pidió una bebida de kiwi y fresa; Noé, sin vergüenza, la más exquisita champaña del menú.');