Skip to main content
June 24, 2010
Question

cfdocument

  • June 24, 2010
  • 1 reply
  • 332 views

I'm using flash to communicate with a cfc document. I'm calling a function that needs to build a pdf. This is for a c

ertificate of completion for an online course. I can seem to create the pdf fine with just plain text. However, the adding of an image

does not work. I've also explored trying to make my image a pdf and just add the text to the existing pdf, but no luck. Here's my code for the creating a pdf with an image:

<cfdocument format="pdf" name="pdf23">
<cfoutput>  
    Some html content<br>  
    <img src="file://D:\Websites\short_sale_rulebook/Images/Certs/certBG.jpg">
</cfoutput>
    </cfdocument>

<cfset savedFolder = "D:\Websites\short_sale_rulebook\Docs\PDF">
    <cffile action="write" file="#savedFolder#/pdf23.pdf" output="#pdf23#">

Not that I've tried everything for the path of the image. Expand Path, the full path on the server with and without the "file://" or a third slash. I've also tried the actual path http://www... and that doesn't work as well. My pdf just shows the text only.

Solutions?

    This topic has been closed for replies.

    1 reply

    Inspiring
    June 24, 2010

    Using file:///... as the src attribute value for images has worked for me in the past.  See sample below.

    <img src="file:///D:\Websites\short_sale_rulebook\Images\Certs\certBG.jpg">

    June 24, 2010

    I kept trying code that was on the internet and somewhere the merge code I had took the two documents, one being the i

    mage and merged into my image I was trying to load. So it really wasn't a jpg anymore but still had the extension.

    I finally ran out of ideas and downloaded the jpg to look at it and it opened as a pdf??? O

    nce I uploaded the correct jpg I was trying to load again the only thing that worked was the full web address. http://....

    The good news, it works. That was really crazy that my jpg was actually a pdf after a codfusion merge failure...

    Thanks for your help.