Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": ">=5.6.20",
"setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.3"
"setasign/fpdi": "^2.4"
},
"authors": [
{
Expand Down
8 changes: 7 additions & 1 deletion src/Jurosh/PDFMerge/PDFMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Exception;
use setasign\Fpdi\Fpdi AS FPDI;
use setasign\Fpdi\PdfReader\PageBoundaries;

/**
* Basic merging of PDF files into one file
Expand All @@ -14,6 +15,11 @@ class PDFMerger {
* @var type Array of PDFObject-s
*/
private $_files;
private $_importExternalLinks;

public function __construct($importExternalLinks = false) {
$this->_importExternalLinks = $importExternalLinks;
}

/**
* Add a PDF for inclusion in the merge with a valid file path.
Expand Down Expand Up @@ -69,7 +75,7 @@ public function merge($outputmode = 'browser', $outputpath = 'newfile.pdf') {
//add the pages
if ($filepages == 'all') {
for ($i = 1; $i <= $count; $i++) {
$template = $fpdi->importPage($i);
$template = $fpdi->importPage($i, PageBoundaries::CROP_BOX, true, $this->_importExternalLinks);
$size = $fpdi->getTemplateSize($template);

$fpdi->AddPage($file->getOrientationCode(), array($size['width'], $size['height']));
Expand Down