Skip to content

Commit

Permalink
Updates to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
david4bu committed Jul 2, 2021
1 parent aeb2166 commit 4a22e63
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/LynX39/LaraPdfMerger/PdfManage.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,31 @@ private function doMerge($orientation = null, $meta = [], $duplex=false)
//add the pages
if ($filepages == 'all') {
for ($i = 1; $i <= $count; $i++) {
$template = $this->_fpdi->importPage($i);
$template = $this->_fpdi->importPage($i, '/BleedBox');
$size = $this->_fpdi->getTemplateSize($template);

if ($orientation == null) $fileorientation = $size['w'] < $size['h'] ? 'P' : 'L';

$this->_fpdi->AddPage($fileorientation, array($size['w'], $size['h']));

$this->_fpdi->setPageFormatFromTemplatePage($i, $fileorientation);

$this->_fpdi->useTemplate($template);
$this->_fpdi->importAnnotations($i);
}
} else {
foreach ($filepages as $page) {
if (!$template = $this->_fpdi->importPage($page)) {
if (!$template = $this->_fpdi->importPage($page, '/BleedBox')) {
throw new Exception("Could not load page '$page' in PDF '$filename'. Check that the page exists.");
}
$size = $this->_fpdi->getTemplateSize($template);

if ($orientation == null) $fileorientation = $size['w'] < $size['h'] ? 'P' : 'L';

$this->_fpdi->AddPage($fileorientation, array($size['w'], $size['h']));

$this->_fpdi->setPageFormatFromTemplatePage($page, $fileorientation);

$this->_fpdi->useTemplate($template);
$this->_fpdi->importAnnotations($page);

Expand Down

0 comments on commit 4a22e63

Please sign in to comment.