Steve

Would something like this do the job for you

<!--- CREATE A DOCUMENT USING CFDOCUMENT INTO MEMORY --->
<cfdocument format="pdf" name="BinaryOutput">
<p>This is a document rendered by the cfdocument tag.</p>

<table width="50%" border="2" cellspacing="2" cellpadding="2">
  <tr>
    <td><strong>Name</strong></td>
    <td><strong>Role</strong></td>
  </tr>
  <tr>
    <td>Bill</td>
    <td>Lead</td>
  </tr>
  <tr>
    <td>Susan</td>
    <td>Principal Writer</td>
  </tr>
  <tr>
    <td>Adelaide</td>
    <td>Part Time Senior Writer</td>
  </tr>
  <tr>
    <td>Thomas</td>
    <td>Full Time for 6 months</td>
  </tr>
  <tr>
    <td>Michael</td>
    <td>Full Time for 4 months</td>
  </tr>
</table>
</cfdocument>

<!--- OR READFILE FROM FILESYSTEM--->
<!--- <cffile action="READBINARY" file="#expandpath(".\OldPDF.pdf")#"
variable="BinaryOutput"> --->


<!--- ENCODE THE PDF INTO BASE64 TO BE STORED --->
<cfset BinOutputBase64 = BinaryEncode(BinaryOutput, "Base64")>

<!--- INSERT THE BASE64 ENCODED DATA INTO A TEXT FIELD IN THE DATABASE --->
<cfquery name="InsertPDF" datasource="TestDB">
        SET NOCOUNT ON
        INSERT INTO TestTable
                (TextField)
        VALUES
                (<cfqueryparam value="#BinOutputBase64#"
cfsqltype="CF_SQL_VARCHAR">)
        SELECT @@IDENTITY as NewID
        SET NOCOUNT OFF
</cfquery>

<!--- RETRIEVE THE NEW ID FROM THE INSERT --->
<cfset NewPDFID = InsertPDF.NewID>

<!--- RETRIEVE THE BASE64 CODE FROM THE DATABASE --->
<cfquery name="GetPDF" datasource="TestDB">
        SELECT TextField
        FROM TestTable
        WHERE UID = <cfqueryparam value="#NewPDFID#"
cfsqltype="CF_SQL_INTEGER">
</cfquery>

<!--- RECODE THE BASE64 BACK INTO BINARY --->
<cfset PDFfromDB = BinaryDecode(GetPDF.TextField, "Base64")>

<!--- WRITE THE FILE TO THE FILESYSTEM --->
<cffile action="WRITE" file="#expandpath(".\NewPDF.pdf")#"
output="#PDFfromDB#" addnewline="no" fixnewline="No">

I think that is what you are trying to achieve.

Regards
Daniel

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Wednesday, 15 August 2007 2:43 PM
To: [email protected]
Subject: [cfaussie] Re: Storing PDF files as blobs in a database


Any one got any other ideas on this?  All I want to do is read a PDF file,
insert the data into the database and then be able to query the database and
output the pdf again either to the browser for download or to write it to
the file system again.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Scott Thornton
Sent: Tuesday, 14 August 2007 8:23 AM
To: [email protected]
Subject: [cfaussie] Re: Storing PDF files as blobs in a database


Hi,

I wonder if CFX_PUTIMAGE could be of assistance? or maybe

<cffile action = "readbinary" file = "c:\xxx\xxxx\scan005659.jpg"
variable="image_var_blob">

I know they are image type manipulation....... but it may help.

>>> "Steve Onnis" <[EMAIL PROTECTED]> 13/08/2007 11:04 pm >>>
I am trying to generate PDF files and store them in a database for future
reference instead of writing them to the file system

Can anyone point me in the right direction on doing this?  I have tried a
few things but I cant seem to get it to work,

 
<http://www.inevative.com.au/images/email-stationary/inevativeLogo_small.jpg

> 


Steve Onnis


Director / Head Developer


  <http://www.inevative.com.au/images/email-stationary/email.jpg>
[EMAIL PROTECTED] 

  <http://www.inevative.com.au/images/email-stationary/phone.jpg> +61 3 9001
2258

  <http://www.inevative.com.au/images/email-stationary/mobile.jpg> 0401 667
996

  <http://www.inevative.com.au/images/email-stationary/web.jpg>
www.inevative.com.au 

 <http://www.novahost.com.au>   <http://www.threesquares.com.au>
<http://www.smsonline.com.au>  












-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.17/951 - Release Date: 13/08/2007
10:15 AM



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to