1. Go to this page and download the library: Download tarfin-labs/easy-pdf 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/ */
tarfin-labs / easy-pdf example snippets
// This will set the active page as 1.
$pdf->setPage(1);
// This will set margin as 10 for left, 15 for top, 20 for right
// and overwrite the default margins.
$pdf->setMargins(10, 15, 20, true);
// $textColor and $lineColor must be RGB as array format. '[255, 255, 255]'
$pdf->setHeaderData($image, $width, $textColor, $lineColor);
// This will set the minimum distance between header and top page margin.
$pdf->setHeaderMargin(10);
// The first parameter is text color and the last one is line color.
$pdf->setFooterData([0, 64, 255], [0, 64, 128]);
// This will set the minimum distance between footer and bottom page margin.
$pdf->setFooterMargin(10);
// This will set the footer font size to 10.
$pdf->setFooterFontSize(10);
// This will set the print to single sided.
$pdf->setDuplex('Simplex');
// This will set duplex and flip on the short edge of the sheet
$pdf->setDuplex('DuplexFlipShortEdge');
// This will set duplex and flip on the long edge of the sheet
$pdf->setDuplex('DuplexFlipLongEdge');
$pdf = EasyPdf::reset()
->withInformation([
'Creator' => 'Tarfin',
'Author' => 'Faruk Can',
'Title' => 'EasyPdf',
'Keywords' => 'easy, pdf',
'AutoPageBreak' => [true, 0],
])
->withConfig([
'ImageScale' => PDF_IMAGE_SCALE_RATIO,
])
->setFont('times', 16) // use default fonts
->loadHtml($html) // each load html creates a new page
->content(); // return pdf content as a string
$pdf = EasyPdf::reset()
->setHeader(false);
php
$pdf = EasyPdf::withInformation([
'Creator' => 'Tarfin',
'Author' => 'Faruk Can',
'Title' => 'EasyPdf',
'Keywords' => 'easy, pdf',
'AutoPageBreak' => [true, 0],
])
->withConfig([
'ImageScale' => PDF_IMAGE_SCALE_RATIO,
])
->setFont('times', 16) // use default fonts
->loadHtml($html) // each load html creates a new page
->content(); // return pdf content as a string
php
// This will return pdf page count.
// $file can be path, url or blob.
$fileCount = EasyPdf::parser($file)->count();
// You can use stream or content method here as well.
$parsedPdf = EasyPdf::parser($file)
->setPage(1)
->save(storage_path('app/imports/new.pdf'));
php
// Pdf paths.
// Pdf paths can be path, url or blob.
$files = [
'/path/to/the/file.pdf',
'/path/to/the/anotherFile.pdf',
];
// You can use stream or content method here as well.
$pdf = EasyPdf::merge($files)
->content();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.