views:

92

answers:

2

How do I combine numerous PDF blob files into a single PDF so that can then be printed?

<?php  
include 'config.php'; 
include 'connect.php'; 

$session= $_GET[session]; 

$query = " 
 SELECT $tbl_uploads.username, $tbl_uploads.description,  
        $tbl_uploads.type, $tbl_uploads.size, $tbl_uploads.content,   
        $tbl_members.session 
 FROM $tbl_uploads 
 LEFT JOIN $tbl_members 
 ON $tbl_uploads.username = $tbl_members.username 
 WHERE $tbl_members.session= '$session'";  

$result = mysql_query($query) or die('Error, query failed'); 

while(list($username, $description, $type, $size, $content) =  
  mysql_fetch_array($result))  
{  
header("Content-length: $size"); 
header("Content-type: $type"); 
header("Content-Disposition: inline; filename=$username-$description.pdf"); 
} 

echo $content; 

mysql_close($link); 
exit; 

?>
+1  A: 

How do I combine numerous PDF blob files into a single PDF so that can then be printed?

You don't - at least not by simply combining the byte streams. You will need to process each file, and merge them into a new PDF document.

Some pointers, maybe one of the solutions, depending on the platform you're on, works for you:

Pekka
A: 

pdftk will merge multiple PDF files, as well as PDFsam..

Gary