pdf - PHP and FPDI/FPDF: Fatal error: Uncaught Exception: FPDF error: Incorrect output destination -


i have pdf file, , want add new page fpdi/fpdf

fatal error: uncaught exception: fpdf error: incorrect output destination: outfiles/111111.pdf in c:\wamp\www\pdf\fpdi\fpdf.php on line 271 ( ! ) exception: fpdf error: incorrect output destination: outfiles/111111.pdf in c:\wamp\www\pdf\fpdi\fpdf.php on line 271

require_once('fpdi/fpdf.php'); require_once('fpdi/fpdi.php');  foreach(glob('infiles/*.pdf') $file) {     $filename = basename($file);     $fileout = 'outfiles/' . $filename;     //echo $fileout;     $out = new fpdi();      $pagecount = $out->setsourcefile($file);      for($i = 1; $i <= $pagecount; $i++)     {         $tpl = $out->importpage($i);           $out->addpage($format);         $out->usetemplate($tpl);          if($i < $pagecount)         {             $out->addpage($format);         }     }      $out->output($fileout); } 

the output() method requires first parameter destination , snd parameter filename.

so change line to:

$out->output('f', $fileout); 

additionally should know cannot modify pdf document fpdi import pages reusable structure. resulting pdf new pdf document , you'd not added new pages original one.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -