Para acabar, me vuelvo a responder yo mismo.
Para poder mostrar el fichero en pantalla correctamente, al final lo he tenido que guardar temporalmente y posteriormente cargarlo, me ha quedado así:
$dbh1 = ibase_pconnect ($cfgDbDatabase, $cfgServerUser, $cfgServerPassword);
$stmt1 = "select ap_pdf from albaran_pdf ";
$stmt1 = $stmt1."where em_codigo='1' and s_codigo='O' and a_codigo=14035";
$sth1 = ibase_query ($dbh1, $stmt1);
$row1 = ibase_fetch_object ($sth1);
$blob_data = ibase_blob_info($row1->AP_PDF);
$blob_hndl = ibase_blob_open($row1->AP_PDF);
$nombre_archivo = 'albaran.pdf';
$contenido = ibase_blob_get($blob_hndl, $blob_data[0]);
if (!$gestor = fopen($nombre_archivo, 'w+')) {
echo "No se puede abrir el archivo ($nombre_archivo)";
exit;
}
// Escribir $contenido a nuestro arcivo abierto.
if (fwrite($gestor, $contenido) === FALSE) {
echo "No se puede escribir al archivo ($nombre_archivo)";
exit;
}
fclose($gestor);
ibase_blob_close($blob_hndl);
$filepa='albaran.pdf';
header('Content-type: application/pdf');
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Length: ' . filesize($filepa));
readfile ($filepa);
Con esto ya funciona correctamente.
un saludo
|