ob_clean();
ini_set("session.auto_start", 0);
define('FPDF_FONTPATH','font/');
define('FPDI_FONTPATH','font/');
require('fpdf.php');
require('fpdi.php');
require('tcpdf.php');
$pdf = new FPDI();
// let's get an id for the background template
$pdf->setSourceFile('/home/user/public_html'.$pdfName);
$backId = $pdf->importPage(1);
// iterate over all pages of HTML_Generated_pdf.pdf and import them
$pageCount = $pdf->setSourceFile('/home/user/public_html/wp-content/themes/myTheme/'.$filename.'.pdf');
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// add a page
$pdf->AddPage($specs['h'] > $specs['w'] ? 'P' : 'L', 'Letter');
// add the background
$pdf->useTemplate($backId);
// import the content page
$pageId = $pdf->importPage($pageNo);
// add it