Coldfusion CFPDF 读取二进制数据库列 [英] Coldfusion CFPDF reading a binary database column

查看:14
本文介绍了Coldfusion CFPDF 读取二进制数据库列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cfpdf 可以直接读取二进制数据库列吗?

Can cfpdf read a binary database column directly?

我目前有它,我在其中运行查询以获取该列.

I currently have it where I run a query to get the column.

使用cffile将文件写入目录

Use cffile to write the file to a directory

然后用 cfpdf 阅读,这样我就可以提取文本了.

Then read with cfpdf so I can extracttext.

是否可以在没有cffile直接写入和读取二进制文件的情况下做到这一点?

Is it possible to do this without the cffile write and read the binary file directly?

如果是这样,我可以举个例子吗?

If so, could I get an example.

推荐答案

你用的是什么版本?以下内容适用于我的 CF9/MS SQL(varbinary 列)

What version are you using? The following worked for me with CF9 / MS SQL (varbinary column)

<cfquery name="getPdf" ....>
    SELECT Data 
    FROM   someTable
    WHERE  ID = 123
</cfquery>

<cfset pdfBinary = getPdf.data[1]>
<cfpdf action="extractText" source="pdfBinary" name="result">
<cfdump var="#result#">

澄清一下,当您使用 queryName.columnName 作为来源"时,cfpdf 会抱怨.我怀疑cfpdf 将其视为查询列object,而不是自动获取查询第一行中的值,即queryName.columnName[1].解决方法是创建对它的引用,并改用其他变量.

To clarify, cfpdf complains when you use queryName.columnName as the "source". I suspect cfpdf sees it as a query column object instead of automatically grabbing the value in the query's first row ie queryName.columnName[ 1 ]. The work-around is to create a reference to it, and use the other variable instead.

这篇关于Coldfusion CFPDF 读取二进制数据库列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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