-1

I am using php-pdftk to generate pdf files. I am attempting to create multiple pdf's, but this only generates 1 file. Here is an example of what I am doing.

$pdf = new Pdf( 'file1.pdf' );
$pdf->send('test1.pdf');

$pdf2 = new Pdf( file2.pdf' );
$pdf2->send('test2.pdf');

This only outputs test1.pdf and I cannot get it to output both. Does anybody know how to do this? Thanks

Moppo
  • 18,797
  • 5
  • 65
  • 64
Juan Rangel
  • 1,763
  • 1
  • 18
  • 34
  • There are two typos in your code snippet: 1. Missing a quote mark around files2.pdf on line 3 2. On line3 you reuse `$pdf` when I suspect it should be `$pdf2` – Paddy Dec 15 '15 at 03:38
  • Thank you. Typos fixed. This code was not the actual code that was running, just some demo code. Thanks again – Juan Rangel Dec 15 '15 at 03:43

1 Answers1

0

It is impossible to send more than one file (independent to the file type) in a single HTTP response.

You may try to zip the resulting files and send this instead.

Jan Slabon
  • 4,736
  • 2
  • 14
  • 29
  • I'm not sure if the usage of e.g. the [ZipArchive](http://php.net/manual/en/class.ziparchive.php) class would be a good answer to your initial question - you didn't asked for this. – Jan Slabon Dec 15 '15 at 17:14