Firebird pdf blob由PHP另存为pdf文件 [英] Firebird pdf blob save as pdf-file by PHP

查看:105
本文介绍了Firebird pdf blob由PHP另存为pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从Firebird 3.0数据库接收到的斑点.

I have a blob which we receive from a Firebird 3.0 database.

if($dbh = ibase_connect($db,$username,$password, 'UTF-8')){
echo "Connecton steht zur Firebird DB steht! <br>";
$sql = "SELECT MEMO FROM DMS where ID = '44'";
// Execute query
$rc = ibase_query($dbh, $sql);
// Get the result row by row as object
$data = ibase_fetch_object($rc);
$blob_data = ibase_blob_info($data->MEMO);
$blob_hndl = ibase_blob_open($data->MEMO);

$inhalt = ibase_blob_get($blob_hndl, $blob_data[0]);

使用

ibase_blob_echo($data->MEMO)

浏览器中有很多标志,因此SQL查询有效.现在,我想将内容(PDF格式)写在磁盘上的pdf文件中.

there comes a lot of signs in browser, so the SQL query works. Now I'd like to write the content (its a PDF) in a pdf file on disk.

每次尝试都没有成功:

file_put_contents('test.pdf', $inhalt);
file_put_contents('test.pdf', ibase_blob_echo($data->MEMO));

等等.

当我们尝试使用Acrobat Reader打开PDF文件时,出现错误消息:不支持PDF文件/文件类型

When we try to open the PDF File with Acrobat Reader, there comes an error message: no PDF File / File-type is not supported

我们如何解决这个问题?

How can we fix this?

推荐答案

感谢您的回答...我们以某种方式解释了这些问题,即上面的代码基本上是正确的.一段时间后,我们发现错误消失了,因为我们将varchar字段的DB Connect中的字符集更改为UTF8.对于Blob,我们现在连接而无需更改Charset,并且读数正常工作.再次感谢你.

thank you for your answers ... We interpreted them in a way, that the code above is basicly correct. After a while, we found out, that the error apears because we changed the charset in the DB Connect to UTF8 for the varchar Fields. For the blob we connect now without Charset change and the readout work properly. Thank you again.

$dbh = ibase_connect($db,$username,$password)

这篇关于Firebird pdf blob由PHP另存为pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆