Skip to content

Commit e18aa32

Browse files
committedJan 27, 2021
removed dependencies from folder and required them by composer.json
1 parent ea1496f commit e18aa32

File tree

128 files changed

+32
-15433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+32
-15433
lines changed
 

‎Classes/PDFMerger.php

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

3+
use setasign\Fpdi\Fpdi;
4+
35
/**
46
* PDFMerger created by Jarrod Nettles December 2009
57
* jarrod@squarecrow.com
68
*
7-
* v1.0.2
9+
* v1.0.5
810
*
911
* Class for easily merging PDFs (or specific pages of PDFs) together into one. Output to a file, browser, download, or return as a string.
1012
* Unfortunately, this class does not preserve many of the enhancements your original PDF might contain. It treats
@@ -14,12 +16,14 @@
1416
* If you put pages 12-14 before 1-5 then 12-15 will be placed first in the output.
1517
*
1618
*
17-
* Uses FPDI 1.3.1 from Setasign
18-
* Uses FPDF 1.6 by Olivier Plathey with FPDF_TPL extension 1.1.3 by Setasign
19+
* Uses FPDI ^2.0 from Setasign
20+
* Uses FPDF 1.82.1 by Fpdf
1921
*
2022
* Both of these packages are free and open source software, bundled with this class for ease of use.
2123
* They are not modified in any way. PDFMerger has all the limitations of the FPDI package - essentially, it cannot import dynamic content
2224
* such as form fields, links or page annotations (anything not a part of the page content stream).
25+
*
26+
* Updated by Andrey Grin January 2021
2327
*
2428
*/
2529
class PDFMerger
@@ -32,12 +36,6 @@ class PDFMerger
3236
*/
3337
public function __construct()
3438
{
35-
if(!class_exists("FPDF")) {
36-
require_once('fpdf/fpdf.php');
37-
}
38-
if(!class_exists("FPDI")) {
39-
require_once('fpdi/fpdi.php');
40-
}
4139
}
4240

4341
/**
@@ -73,7 +71,7 @@ public function merge($outputmode = 'browser', $outputpath = 'newfile.pdf')
7371
{
7472
if (!isset($this->_files) || !is_array($this->_files)): throw new exception("No PDFs to merge."); endif;
7573

76-
$fpdi = new FPDI;
74+
$fpdi = new Fpdi();
7775

7876
//merger operations
7977
foreach ($this->_files as $file) {
@@ -87,18 +85,18 @@ public function merge($outputmode = 'browser', $outputpath = 'newfile.pdf')
8785
for ($i = 1; $i <= $count; $i++) {
8886
$template = $fpdi->importPage($i);
8987
$size = $fpdi->getTemplateSize($template);
90-
$orientation = ($size['h'] > $size['w']) ? 'P' : 'L';
88+
$orientation = ($size['height'] > $size['width']) ? 'P' : 'L';
9189

92-
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
90+
$fpdi->AddPage($orientation, array($size['width'], $size['height']));
9391
$fpdi->useTemplate($template);
9492
}
9593
} else {
9694
foreach ($filepages as $page) {
9795
if (!$template = $fpdi->importPage($page)): throw new exception("Could not load page '$page' in PDF '$filename'. Check that the page exists."); endif;
9896
$size = $fpdi->getTemplateSize($template);
99-
$orientation = ($size['h'] > $size['w']) ? 'P' : 'L';
97+
$orientation = ($size['height'] > $size['width']) ? 'P' : 'L';
10098

101-
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
99+
$fpdi->AddPage($orientation, array($size['width'], $size['height']));
102100
$fpdi->useTemplate($template);
103101
}
104102
}

‎Classes/fpdf/FAQ.htm

-272
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.