Coldfusion CFPDF reading binary database column

Can cfpdf read a binary database column directly?

I currently have this where I run a query to get a column.

Use cffile to write a file to a directory

Then read cfpdf so that I can extract the text.

Is it possible to do this without writing cffile and directly reading the binary?

If so, can I give an example.

+5
source share
3 answers

Which 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#">

: , cfpdf , queryName.columnName "". , cfpdf , .. queryName.columnName[ 1 ]. - .

+3

100%, - :

<cfset myPDF = binaryEncode(binaryData,'base64')>

<cfpdf action="read" source="myPDF" name="PDFObj">
+1

I found an easy way to do this:

<cfheader name="Content-Disposition" value="inline; filename=test.pdf">
<cfcontent type="application/pdf" variable="#qGetFile.uploaded_file#">

This was already in the code that I inherited, but it never worked. I found that the problem is with the data source and not with the code; it has not been set to accept a blob.

0
source

All Articles