Combine PDF Blob Files from MySQL Database

强颜欢笑 提交于 2019-12-11 07:24:35

问题


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:


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:

  • PHP - How to combine / merge multiple pdf’s

  • How to combine images inside pdf by programme?

  • Need to merge multiple pdf’s into a single PDF with Table Of Contents sections




回答2:


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



来源:https://stackoverflow.com/questions/3024892/combine-pdf-blob-files-from-mysql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!