Goal:  To create a PDF that is a certificate, fills in the user's information 
into the appropriate areas over the certificate image that is the background.  
The PDF is then emailed to the user.  I am using Coldfusion Report Builder 
(once you stop laughing, please continue!)

Successes:  I can successfully get the information from my tables into the 
fields.  It also  successfully sends the E-Mail with the PDF as an attachment. 

Problems:  Whenever I attach images to the CFR (Coldfusion Report), it creates 
errors and the email will not be sent.  Here is the weird part.  It does create 
a PDF and the images are in there and everything looks great.  However, the 
E-Mail system on the server refuses to send the E-Mail and hangs.  I end up 
having to delete the mail out of the spool folder and restart the service to 
fix the error.  

Minor Success:  I have been able to get one of the images to work by embedding 
the information into the database and calling it that way (instead of inserting 
the image within the CFR).  However, I have only been able to do this with one 
image thus far. 

I am getting the message:  "insufficient data for an image" whenever I try to 
open the new PDF's that are being created (with all the images being pulled 
from the database).  I am thinking it is either an error being created with 
Acrobat when it makes the PDF (it is currently only version 6 - in the process 
of updating it).  It might also be an error with the way the BLOB was created 
that is storing the image in the Database.  I am going to play with both of 
these ideas.  Also, I am trying to break the email into "parts" in the CFM.  I 
noticed before that if I had the type as "application/pdf" it did not work but 
when I told it to be the type of "image/jpeg" it worked fine.  The only reason 
I could think was because of the image that was being embedded in the PDF.  

Here is the code I am using in my CFM:

<cfinclude template = "includes/header.cfm">
<cfinclude template = "includes/AS_testCookie.cfm">

<div align="center">
        <cfoutput><br />
                <span class="style3">
                        Thank you #URL.nameIssued#<br />
                        Your certificate is being E-Mailed to #URL.eMail#<br />
                        You will receive it shortly
                </span>
        </cfoutput><br /><br />
        <a href="lectures.cfm" class="style2">View Lectures</a>
        <a href="tests.cfm" class="style2">View Tests</a>
</div>



<!-- Report Builder Query -->
<cfquery name="CFReportDataQuery" datasource="sonocme">
        SELECT certificates.primaryKey AS certPrimaryKey, nameIssued, eMail, 
issueDate, testName, testCategory, instructIMG, proDirIMG, Picture, Certificate
        FROM certificates, Temp_Image, CertImage
        WHERE nameIssued='#URL.nameIssued#' AND eMail='#URL.eMail#'
</cfquery>

<cfset namePDF = '#CFReportDataQuery.testName#.pdf'>  

<!-- Send Information to Coldfusion Report Builder -->
<cfreport format="PDF" template="#CFReportDataQuery.testCategory#.cfr" 
query="#CFReportDataQuery#" filename="pdf/#namePDF#" overwrite="Yes"/>

<cfquery datasource="sonocme">
        UPDATE certificates
        SET
                namePDF = '#namePDF#'
        WHERE primaryKey = #CFReportDataQuery.certPrimaryKey#
</cfquery>

<cfmail to="#URL.eMail#" from="[EMAIL PROTECTED]" subject="SONOGRAPHYCME 
CERTIFICATE" type="html">
        <cfmailparam file="images/emailHeader.jpg" disposition="inline" 
contentID="image1">
                <img src="cid:image1" /><br />
                From:  [EMAIL PROTECTED]<br />
                Sent:  #DateFormat(Now(), "mm/dd/yyyy")# #TimeFormat(Now(), 
"h:mm:tt")#<br /><br />             
                Comments:  Congratulations on successful completion!!!  
        <cfmailparam disposition="attachment" file="pdf/#namePDF#" 
type="image/jpeg">
</cfmail>

<cfinclude template="includes/footer.cfm">


PAY SPECIAL ATTENTION TO THE CFMAIL TAG SECTION
Please feel free to ask for clarification or more information if you need it.
Thanks,
-Garebear

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2027
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to