Skip to content

Instantly share code, notes, and snippets.

@stafast
Created November 23, 2017 19:01
Show Gist options
  • Select an option

  • Save stafast/584b02f0137fb21e5265d1a7cfd9169c to your computer and use it in GitHub Desktop.

Select an option

Save stafast/584b02f0137fb21e5265d1a7cfd9169c to your computer and use it in GitHub Desktop.
TYPO3 PDF Merger
use setasign\Fpdi\Fpdi;
-- -- -- --
header("X-Robots-Tag: noindex", true);
$this->response->setHeader('Cache-control', 'public', TRUE);
$this->response->setHeader('Content-Description', 'File transfer', TRUE);
$this->response->setHeader('Content-Disposition', 'attachment; filename=students.pdf', TRUE);
$this->response->setHeader('Content-type:application/pdf; charset=utf-8', TRUE);
$this->response->sendHeaders();
require_once('fpdf/fpdf.php');
require_once('fpdi/src/autoload.php');
$pdf = new Fpdi();
$pdf->AddPage();
$pdf->setSourceFile('pdfs/1.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->AddPage();
$pdf->setSourceFile('pdfs/2.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->Output();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment