0

I am using php-pdftk and I am trying to make 1 pdf out of multiple pdfs.

I have all my pdfs in an array however I couldn't figure out how to combine them into one.

$pdfFiles = ['a.pdf', 'b.pdf', 'c.pdf']

$pdf = new Pdf($dir. '/Combined.pdf');

foreach ($pdfFiles as $form) {
        $pdf->
      // I am stuck here
}

How can I perform this task with php-pdftk? I believe it's around here but I couldn't figure out

senty
  • 12,385
  • 28
  • 130
  • 260

1 Answers1

-2

There are several ways you can do this, though this is probably what you are looking for.

$pdfFiles = ['a.pdf', 'b.pdf', 'c.pdf']

$pdf = new Pdf();

foreach ($pdfFiles as $form) {
    $pdf->addPage($form);
}

$pdf->saveAs($dir. '/Combined.pdf');
Ray
  • 2,713
  • 3
  • 29
  • 61