Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image is not displaying in cfdocument pdf for coldfusion 10

I am using ColdFusion 10 Enterprise edition, and am unable to display images when using CFDOCUMENT to generate a PDF. Below is the piece of code I am using:

<cfsavecontent variable="report">
   <table align='center'>
    <cfoutput query="VARIABLES.result">
            <tr>
              <td>
                 <div class='addInfoDetails'>#SHOWINFO#</div>
              </td>
            </tr>
       </cfoutput>  
   </table>
</cfsavecontent>

In the above code, the VARIABLES.result query is coming from database and SHOWINFO is a variable having the content of image and text. For example:

 SHOWINFO  = 
 "<p> Hi This is the test information
     <img alt="image" src="../TestBank/test/info/5KQ.jpg"/>
 </p>"

Here if dump the SHOWINFO variable inside the CFSAVECONTENT, the image displays correctly. But when I convert this into PDF, using CFDOCUMENT, the image is not displaying.

Below is the code block I am using to generate the pdf:

<cfdocument format="PDF" saveasname="TestPDF">
  <cfoutput>#report#</cfoutput>
</cfdocument>

Thanks in advance.

like image 571
Snehanjali Sahoo Avatar asked Feb 16 '23 16:02

Snehanjali Sahoo


1 Answers

I fixed it by adding the attribute "localUrl = yes" in CFDOCUMENT tag.

Now it is working fine for me.

like image 120
Snehanjali Sahoo Avatar answered Mar 02 '23 20:03

Snehanjali Sahoo