ColdFusion的CFPDF读一个二进制数据库列 [英] Coldfusion CFPDF reading a binary database column
问题描述
能否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读,所以我可以extracttext。
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把它看作一个查询列的对象的而不是自动抓取即查询的第一行中的值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屋!