<?php
if ( ! defined('WB_ROOT') ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

use Fpdf\Fpdf;
use setasign\Fpdi\Fpdi;

class ConcatPdf extends Fpdi{
    public $files = array();

    public function addFile($file){
        $this->files[] = $files;
    }

    public function concat(){
        foreach($this->files AS $file) {
            $pageCount = $this->setSourceFile($file);
            for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
                $pageId = $this->ImportPage($pageNo);
                $s = $this->getTemplatesize($pageId);
                $this->AddPage($s['orientation'], $s);
                $this->useImportedPage($pageId);
            }
        }
    }
}
