Evik James
Evik James

Reputation: 10493

What might cause the images from rendering properly in PDF generation?

I am using ColdFusion 8.

I have a perfectly formatted HTML page that I want to convert into PDF. It takes ColdFusion about 250 milliseconds to create this content. The code is tried and true and works in every respect with no problem, except for in creating a PDF.

I create the PageContent variable like this:

<!--- CREATE PAGE AS CONTENT --->
<cfsavecontent variable="PageContent">
<html>
<head></head>
<body>
<cfoutput>
    // PAGE CONTENT IS HERE
<cfoutput>
</body>
</html>
</cfsavecontent>

I can display this PageContent perfectly as HTML in a browser, open it in Word or Excel. I try to create a PDF like this:

<cfdocument format="pdf">
<cfoutput>
   #PageContent#
</cfoutput>
</cfdocument>

The page content has inline styles, images, divs, and tables. If I remove the image path and file with an empty string, the document works. Here's the

I think that the PDF generator is choking ob the image path, although the paths seem perfect to me and render well everywhere else. The img tag is being fed the full HTTP path, which is totally valid. Here's one that isn't working:

http://dev.iqcatalogs.com/avcat/IMAGES/products/spotlight/ef17_40_4lu_c2_186x279.gif

What might cause the images from rendering properly in PDF?

Upvotes: 0

Views: 347

Answers (2)

Leigh
Leigh

Reputation: 28873

(From the comments above) I am guessing you have looked into the usual suspects already?

ie 2) If your server is behind firewall. As we mentioned earlier, CF server needs to send an HTTP request for the images. If the firewall prevents any outgoing connection from the server, CF will not be able to retrieve them and will show a red-x in place of them. You will need to setup your firewall in such a way that server can send an HTTP request to itself.

Upvotes: 4

Mark A Kruger
Mark A Kruger

Reputation: 7193

Remember that for Cfdocument to work it doesn't matter whether you can pull up the image in your browser. It only matters if the server can pull it up. The most likely cause for this is simply domain resolution - where the server cannot get the right IP address - or where it is blocked from retrieving the content. See this post.

resolution and cfdocument

Upvotes: 4

Related Questions