<?php 
$files = json_decode($_REQUEST['files']);
$output='../output/reports/'.$_REQUEST['client'].'/reports.pdf'; 

include '../packages/PDFMerger/tcpdf/tcpdf.php';
include '../packages/PDFMerger/PDFMerger.php';


$pdf = new PDFMerger;
foreach($files AS $file){
$pdf->addPDF($file, 'all','A');
}

$pdf->merge('file', $output , "L");
    echo "s";