i have some pdf's that are stored in a SQL server with data type Image. Now I want to merge them into a single document with Imagic from a PHP page. here is the code
$combined = new Imagick();
while( $document = mssql_fetch_assoc( $mssqlResult ){
$image = new Imagick();
$image->readImageBlob( $document['Contents'] ) ;
$combined->addImage( $image );
$image->clear();
$image->destroy();
}
$combined->setImageFormat("pdf");
$combined->writeImages( 'test.pdf', true );
this will work and the test.pdf will be saved to sever. but when I try to output therough browser url(some thing like http://www.test.com/test.php), it will not works. the code is
$combined = new Imagick();
while( $document = mssql_fetch_assoc( $mssqlResult ){
$image = new Imagick();
$image->readImageBlob( $document['Contents'] ) ;
$combined->addImage( $image );
$image->clear();
$image->destroy();
}
//$combined->getImageBlob();
//$combined->setImageFormat("pdf");
//$combined->writeImages( 'test.pdf', true );
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="test.pdf"');
echo $combined;
any help would be appreciated